-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Diagnostic: "constant evaluation error" without further details #41893
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
Comments
I was able to learn more with: diff --git a/src/librustc/middle/const_val.rs b/src/librustc/middle/const_val.rs
index 3bbaf5c929..7e98f25894 100644
--- a/src/librustc/middle/const_val.rs
+++ b/src/librustc/middle/const_val.rs
@@ -205,6 +205,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
diag.span_note(primary_span,
&format!("for {} here", primary_kind));
}
+ panic!("{:?}", self.description());
}
pub fn report(&self,
Let’s keep this issue about the error description not being shown. I’ll file a separate issue about the unimplemented bit. Smaller test case with same results: #![feature(nonzero, const_fn)]
extern crate core;
use core::nonzero::NonZero;
fn main() {
const FOO: NonZero<u64> = unsafe { NonZero::new(2) };
if let FOO = FOO {}
} |
It's not related to const eval apparently, because fn main() {
const I: usize = 0 - 1;
if let I = 42 {}
} produces
as expected. I assume it has something to do with the emitter itself. Playpen: https://is.gd/RrPhcP |
The span issue has been fixed -- closing.
|
@Mark-Simulacrum What test case is this? On both test cases in this issue I still get “constant evaluation error” “for pattern here” without further details, on rustc 1.20.0-nightly (69c65d2 2017-06-28). I think this should be re-opened. |
Oh, I see that this the first test case, and the first line of code in the error message is from libcore. It also looks like you built this compiler yourself. Is the fix maybe on in Nightly yet? Or does the first part of the error message only show up when libcore sources are available at the same path they were compiled? |
@SimonSapin Have you tried installing the |
It probably ends up at a different path than on the build servers, though? Does rustc know where to find it? |
FWIW, I have a non-default |
Regardless, I think it’s a bug to skip half of the error message with relevant info when the corresponding source is not available to show context. |
It might be a bug in rustc/rustup interaction; I'll reopen for now. I test with a locally compiled rustc. |
Ok, so I’m convinced this is two issues:
|
@SimonSapin Ah that second one is the result of the new label system... I find it a bit problematic in general, given the fact that we still have the "error headers" - we should only have one system IMO, and it should look like the current "error headers" with no source code (but still show the path, line & column for manual lookup). As for finding cc @rust-lang/dev-tools |
I believe this is now a duplicate of #53081. |
rustc 1.19.0-nightly (d3abc80 2017-05-09)
The error message doesn’t say what’s wrong with this pattern. Based on code in
src/librustc/middle/const_val.rs
it looks like more info should be printed, withConstEvalErr::description
.CC @eddyb
The text was updated successfully, but these errors were encountered: