Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly check associated consts for infer placeholders #112506

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jun 10, 2023

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

@rustbot
Copy link
Collaborator

rustbot commented Jun 10, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 10, 2023
{
// Account for `const C: _;`.
let mut visitor = HirPlaceholderCollector::default();
visitor.visit_trait_item(trait_item);
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@b-naber
Copy link
Contributor

b-naber commented Jun 14, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 14, 2023

📌 Commit 2b40268 has been approved by b-naber

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 14, 2023
…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
@bors bors merged commit c1b4d07 into rust-lang:master Jun 14, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 14, 2023
@compiler-errors compiler-errors deleted the const-infer-ice branch August 11, 2023 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
5 participants