-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add bug! for unused OpaqueCast post borrowck #116140
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
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
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 add a comment to ProjectionElem::OpaqueCast
that this projection should not exist in MirPase::Runtime
, extend the changes mentioned in the MirPhase::Runtime(RuntimePhase::Initial)
docs, and change the mir validator to fail if it encounters an OpaqueCast
during MirPhase::Runtime
r=me afterwards
@@ -316,7 +316,9 @@ where | |||
{ | |||
use rustc_middle::mir::ProjectionElem::*; | |||
Ok(match proj_elem { | |||
OpaqueCast(ty) => base.transmute(self.layout_of(ty)?, self)?, | |||
OpaqueCast(_) => { | |||
bug!("OpaqueCast should be unreachable here!"); |
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 make this span_bug!(self.cur_span(), ...
? That will make this much easier to debug, should that ever come up.
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 PR is sadly wrong given that OpaqueCast
does exist after analysis, we just don't have a single test which actually encounters it 😅 @ouz-a will add such tests in a different PR 😁
As lcnr mentioned this pr is wrong, so closing it in favor of newer one. |
Monomorphize OpaqueCast In previous attempt, rust-lang#116140 we thought `OpaqueCast` was unused during few places, but we were wrong, in reality we didn't have any test that could test it, so in this pr attempt is to correct the behavior of few `OpaqueCast`s in rustc. r? `@lcnr`
Monomorphize OpaqueCast In previous attempt, rust-lang#116140 we thought `OpaqueCast` was unused during few places, but we were wrong, in reality we didn't have any test that could test it, so in this pr attempt is to correct the behavior of few `OpaqueCast`s in rustc. r? `@lcnr`
Monomorphize OpaqueCast In previous attempt, rust-lang#116140 we thought `OpaqueCast` was unused during few places, but we were wrong, in reality we didn't have any test that could test it, so in this pr attempt is to correct the behavior of few `OpaqueCast`s in rustc. r? `@lcnr`
While working on #115025 we discovered some of the
ProjectionElem::OpaqueCast
were unused, so this change reflects their current behavior more clearly.r? @lcnr