-
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
Use new promoter to emit errors when required promotion fails #65942
Use new promoter to emit errors when required promotion fails #65942
Conversation
@@ -80,6 +81,17 @@ pub enum Candidate { | |||
Argument { bb: BasicBlock, index: usize }, | |||
} | |||
|
|||
impl Candidate { | |||
/// Returns `true` if we should use the "explicit" rules for promotability for this `Candidate`. | |||
fn is_explicit_context(&self) -> bool { |
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.
"context" doesn't feel right here. Maybe forces_explicit_promotion
?
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 |
… r=eddyb Make `promote_consts` emit the errors when required promotion fails A very minimal version of rust-lang#65942. This will cause a generic "argument X is required to be a constant" message for `simd_shuffle` LLVM intrinsics instead of the [custom one](https://github.com/rust-lang/rust/blob/caa1f8d7b3b021c86a70ff62d23a07d97acff4c4/src/librustc_mir/transform/qualify_consts.rs#L1616). It may be possible to remove this special-casing altogether after rust-lang/stdarch#825. r? @eddyb
… r=eddyb Make `promote_consts` emit the errors when required promotion fails A very minimal version of rust-lang#65942. This will cause a generic "argument X is required to be a constant" message for `simd_shuffle` LLVM intrinsics instead of the [custom one](https://github.com/rust-lang/rust/blob/caa1f8d7b3b021c86a70ff62d23a07d97acff4c4/src/librustc_mir/transform/qualify_consts.rs#L1616). It may be possible to remove this special-casing altogether after rust-lang/stdarch#825. r? @eddyb
This PR adds error reporting to
promote_consts
for when a#[rustc_args_required_const]
argument cannot be promoted. This required some minor refactoring, notablyTempState
s are now determined in a separate MIRVisitor
from the one that collectsCandidate
s for promotion, andCandidate
s are validated at the same time they are collected.This is another step on the road to removing the existing
qualify_consts
entirely.r? @eddyb