-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make promote_consts
emit the errors when required promotion fails
#65946
Changes from 3 commits
9bb9833
46b68b0
122c6fe
627e3ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1599,20 +1599,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { | |
// This is not a problem, because the argument explicitly | ||
// requests constness, in contrast to regular promotion | ||
// which happens even without the user requesting it. | ||
// We can error out with a hard error if the argument is not | ||
// constant here. | ||
// | ||
// `promote_consts` is responsible for emitting the error if | ||
// the argument is not promotable. | ||
if !IsNotPromotable::in_operand(self, arg) { | ||
debug!("visit_terminator_kind: candidate={:?}", candidate); | ||
self.promotion_candidates.push(candidate); | ||
} else { | ||
if is_shuffle { | ||
span_err!(self.tcx.sess, self.span, E0526, | ||
"shuffle indices are not constant"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably need to fix tests because this shuffle-specific error message/code isn't emitted anymore? (i.e. now shuffles use the more general error) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no tests for non-const There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can store There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not actually sure how to test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The shuffle intrinsics are only directly used by libcore, so this errors should only be seen by |
||
} else { | ||
self.tcx.sess.span_err(self.span, | ||
&format!("argument {} is required to be a constant", | ||
i + 1)); | ||
} | ||
} | ||
} | ||
} | ||
|
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.
Please remove (comment out? not sure)
E0526
from:src/librustc_mir/error_codes.rs
src/tools/tidy/src/error_codes_check.rs
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 removed it entirely from
tidy
but commented it out inlibrustc_mir
where there's other unused errors that are commented out.