-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix ICE in const_trait check code #102361
Conversation
This fixes rust-lang#102156.
r? @eholk (rust-highfive has picked a reviewer for you, use r? to override) |
//~^ ERROR | ||
//~| 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.
Maybe add the error code to make it a tad clearer, or is it mostly unnecessary for this case? Not sure on the error annotations guidelines.
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.
The errors are expected, but checking the error message is mostly unnecessary because we are only ensuring that it doesn't ICE.
@@ -199,7 +199,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> { | |||
.. | |||
}) = item.kind | |||
{ | |||
let def_id = trait_ref.trait_def_id().unwrap(); | |||
let Some(def_id) = trait_ref.trait_def_id() else { return; }; |
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.
Do we want to return here or break out of the block so that intravisit::walk_item
still runs?
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.
Done.
@bors r+ |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#102361 (Fix ICE in const_trait check code) - rust-lang#102373 (Flush delayed bugs before codegen) - rust-lang#102483 (create def ids for impl traits during ast lowering) - rust-lang#102490 (Generate synthetic region from `impl` even in closure body within an associated fn) - rust-lang#102492 (Don't lower assoc bindings just to deny them) - rust-lang#102493 (Group together more size assertions.) - rust-lang#102521 (rustdoc: add missing margin to no-docblock methods) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This fixes #102156.