-
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
Promoteds are statics and statics have a place, not just a value #52597
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
promoted: Some(index), | ||
}; | ||
let c = bx.tcx().const_eval(param_env.and(cid)); | ||
let (llval, ty) = self.simd_shuffle_indices( |
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.
What is the point of this?
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.
SIMD shuffle indices are an array, which usually is specified inline, and not via an explicit constant. so the array is promoted and we need to read it 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.
I see. A comment to that effect would be great.
src/librustc_mir/borrow_check/mod.rs
Outdated
@@ -2030,6 +2039,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { | |||
}), | |||
} | |||
} | |||
// promoteds may never be mutated | |||
Place::Promoted(_) => Err(place), |
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 should probably be a bug!()
? I can’t think of any case where you’d genuinely want to report an error to the user if you somehow end up with a &mut promoted
at this point in code.
@@ -326,6 +327,9 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( | |||
Overlap::EqualOrDisjoint | |||
} | |||
} | |||
(Place::Promoted(_), Place::Promoted(_)) | |
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.
Shouldn’t this also return an EqualOrDisjoint
if the two promoteds are the same?
This is r=me once #52571 lands and the issues are fixed. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
c0ab624
to
d4ab267
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #52571) made this pull request unmergeable. Please resolve the merge conflicts. |
d3f05e5
to
cbd4274
Compare
"could not evaluate constant operand", | ||
); | ||
// Allow RalfJ to sleep soundly knowing that even refactorings that remove | ||
// the above error (or silence it under some conditions) will not cause UB |
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.
❤️
@bors r=nagisa |
📌 Commit cbd4274 has been approved by |
Promoteds are statics and statics have a place, not just a value r? @eddyb This makes everything around promoteds a little simpler
☀️ Test successful - status-appveyor, status-travis |
Tested on commit rust-lang/rust@6a3db03. Direct link to PR: <rust-lang/rust#52597> 💔 miri on windows: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-pass → build-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra).
|
// and we can then extract the value by evaluating the promoted. | ||
mir::Operand::Copy(mir::Place::Promoted(box(index, ty))) | | ||
mir::Operand::Move(mir::Place::Promoted(box(index, ty))) => { | ||
let param_env = ty::ParamEnv::reveal_all(); |
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 should probably be something like self.param_env
(minor future hazard if we start deduplicating instances).
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 PR already landed.Does anyone take care of fixing this?^^
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 is rustc_codegen_llvm... we don't have a param env, everything is monomorphized
let type_checker = &mut self.cx; | ||
|
||
// FIXME -- For now, use the substitutions from | ||
// `value.ty` rather than `value.val`. The |
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.
Heh, value.val
mention here is outdated (cc @nikomatsakis).
r? @eddyb
This makes everything around promoteds a little simpler