-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Refactor the const eval diagnostic API #51316
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
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 |
📌 Commit 0cc9e7b has been approved by |
src/librustc/middle/const_val.rs
Outdated
pub enum ErrKind<'tcx> { | ||
|
||
NonConstPath, | ||
UnimplementedConstVal(&'static str), | ||
CouldNotResolve, | ||
IndexOutOfBounds { len: u64, index: u64 }, |
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.
Is this still needed? I think Miri
covers it already.
@bors r=nikomatsakis |
📌 Commit 50ebd33 has been approved by |
@bors r=nikomatsakis These keep dropping like flies. We should be able to remove const_val::ErrKind soonish |
📌 Commit 13496ff has been approved by |
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 |
@bors r- needs a rebase |
☔ The latest upstream changes (presumably #51369) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=nikomatsakis |
📌 Commit 14d08e5 has been approved by |
Refactor the const eval diagnostic API * no longer report "const eval error" for things that have typeck errors * errors and lints have saner spans and messages * unified the diagnostic logic (const eval errors were slightly different depending on where they were reported, and there was also code duplication between the different reporters) * report errors if an erroneous constant is used inside a promoted (fixes most of rust-lang#50814)
@@ -534,8 +534,7 @@ fn process_predicate<'a, 'gcx, 'tcx>( | |||
} else { | |||
Err(CodeSelectionError(ConstEvalFailure(ConstEvalErr { | |||
span: obligation.cause.span, | |||
kind: ErrKind::UnimplementedConstVal("could not resolve") | |||
.into(), | |||
kind: ErrKind::CouldNotResolve.into(), |
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.
Wait, what error does miri produce from its own failed Instance::resolve
?
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.
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.
That's... disappointing. I believe failing to resolve means "still too polymorphic", does miri not have any general errors for that, short of the layout ones?
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.
No, but I will add one when refactoring away the old ctfe error enum
Refactor the const eval diagnostic API * no longer report "const eval error" for things that have typeck errors * errors and lints have saner spans and messages * unified the diagnostic logic (const eval errors were slightly different depending on where they were reported, and there was also code duplication between the different reporters) * report errors if an erroneous constant is used inside a promoted (fixes most of #50814)
☀️ Test successful - status-appveyor, status-travis |
const FOO: u32 = 0 - 1; println!("{}", FOO);
#50814)