-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Avoid collecting associated types for undefined trait #137631
Conversation
rustbot has assigned @compiler-errors. Use |
HIR ty lowering was modified cc @fmease |
45e148a
to
1ac2051
Compare
} | ||
|
||
fn main() { | ||
let _: dyn Tr + ?Foo(); |
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.
This doesn't have to do with parenthesized syntax. This also ICEs: + ?Foo<Assoc = ()>
.
Please edit the test name so it's more clear what it's testing, add the issue number as a comment like:
// Fix for <https://github.com/issues....>
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.
Sorry, I forgot to mention explicitly:
Change the test to use + ?Foo<Assoc = ()>
rather than the parentheses syntax.
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.
Ok. Thanks.
trait_def, | ||
); | ||
let trait_def = path.res.opt_def_id(); | ||
let assoc_item = trait_def.and_then(|trait_def_id| { |
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.
Please leave a comment here saying that we don't want to unwrap a trait def id if it resolves incorrectly.
Actually, #137554 is the same issue, but with a different kind of item. Instead of calling |
This comment has been minimized.
This comment has been minimized.
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.
Add a test for #137554, and squash this into one commit.
Also no need to click the "request review" button; I'll review the PR when I have free time. All it does is give me an unnecessary notification.
let _: dyn Tr + ?Foo<Assoc = ()>; | ||
//~^ ERROR: `?Trait` is not permitted in trait object types | ||
//~| ERROR: cannot find trait `Foo` in this scope | ||
//~| ERROR: the value of the associated type `Item` in `Tr` must be specifi |
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.
//~| ERROR: the value of the associated type `Item` in `Tr` must be specifi | |
//~| ERROR: the value of the associated type `Item` in `Tr` must be specified |
rename ui tests check if res is trait def fix typo regression test for rust-lang#137554
4a77dae
to
b7a5497
Compare
@bors r+ rollup |
…rrors Avoid collecting associated types for undefined trait Fixes rust-lang#137508 Fixes rust-lang#137554
Rollup of 10 pull requests Successful merges: - rust-lang#134585 (remove `MaybeUninit::uninit_array`) - rust-lang#136187 (Use less CString in the examples of CStr.) - rust-lang#136457 (Expose algebraic floating point intrinsics) - rust-lang#137201 (Teach structured errors to display short `Ty<'_>`) - rust-lang#137620 (Fix `attr` cast for espidf) - rust-lang#137631 (Avoid collecting associated types for undefined trait) - rust-lang#137635 (Don't suggest constraining unstable associated types) - rust-lang#137642 (Rustc dev guide subtree update) - rust-lang#137660 (Update gcc submodule) - rust-lang#137670 (revert accidental change in get_closest_merge_commit) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#134585 (remove `MaybeUninit::uninit_array`) - rust-lang#136187 (Use less CString in the examples of CStr.) - rust-lang#137201 (Teach structured errors to display short `Ty<'_>`) - rust-lang#137620 (Fix `attr` cast for espidf) - rust-lang#137631 (Avoid collecting associated types for undefined trait) - rust-lang#137635 (Don't suggest constraining unstable associated types) - rust-lang#137642 (Rustc dev guide subtree update) - rust-lang#137660 (Update gcc submodule) - rust-lang#137670 (revert accidental change in get_closest_merge_commit) - rust-lang#137671 (Make -Z unpretty=mir suggest -Z dump-mir as well for discoverability) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137631 - TaKO8Ki:issue-137508, r=compiler-errors Avoid collecting associated types for undefined trait Fixes rust-lang#137508 Fixes rust-lang#137554
Fixes #137508
Fixes #137554