-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Do not ICE on generic type mismatch in anonymous const #80278
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
Conversation
r? @varkor (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
640e7d2
to
5032c20
Compare
This comment has been minimized.
This comment has been minimized.
5032c20
to
9cee678
Compare
This comment has been minimized.
This comment has been minimized.
9cee678
to
8cefed1
Compare
This comment has been minimized.
This comment has been minimized.
8cefed1
to
c82598f
Compare
This comment has been minimized.
This comment has been minimized.
c82598f
to
bae3fbb
Compare
👆 This is what I get for being lazy and trying to avoid building the compiler 😅 |
self.tcx.hir().opt_local_def_id(cause.body_id).unwrap_or_else(|| { | ||
self.tcx.hir().body_owner_def_id(hir::BodyId { hir_id: cause.body_id }) | ||
}); | ||
|
||
if let hir::def::DefKind::AnonConst = self.tcx.hir().def_kind(body_owner_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.
This seems quite subtle, for instance in being sure that AnonConst
is the only special case. Are there no general methods for doing this (and should there be, if this pattern is used elsewhere)?
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.
IIUC a DefId
can be given to any of the variants of DefKind
. Maybe closures/generators can cause problems too?
Fixes #80062.