-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Properly check associated consts for infer placeholders #112506
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
955922a
to
2b40268
Compare
{ | ||
// Account for `const C: _;`. | ||
let mut visitor = HirPlaceholderCollector::default(); | ||
visitor.visit_trait_item(trait_item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why we only want to call visit_trait_item
if !tcx.sess.diagnostic().has_stashed_diagnostic(ty.span, StashKey::ItemNoType)
holds, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if there is a stashed diagnostic then we will already be emitting an error, and visiting this item will provide a redundant/useless error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#98202 (Implement `TryFrom<&OsStr>` for `&str`) - rust-lang#107619 (Specify behavior of HashSet::insert) - rust-lang#109814 (Stabilize String::leak) - rust-lang#111974 (Update runtime guarantee for `select_nth_unstable`) - rust-lang#112109 (Don't print unsupported split-debuginfo modes with `-Zunstable-options`) - rust-lang#112506 (Properly check associated consts for infer placeholders) r? `@ghost` `@rustbot` modify labels: rollup
We only reported an error if it was in a "suggestable" position (according to
is_suggestable_infer_ty
) -- this isn't correct for infer tys that can show up in other places in the constant's type, like behind a dyn trait.fixes #112491