-
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
ICE: unprintable span #26480
Comments
Had the same issue, it seems to me that it's caused by macros: https://gist.github.com/2084b4bb800dd6a08939 macro_rules! jerry(
($name:expr) => {
pub static NAME: *mut u8 = $name as *mut u8;
}
);
jerry!(b"Kiwi\0");
|
I just hit this myself. Most error spans deal with only a single token tree, but the one around casts is different as the start and end points come from two different token trees, because it’s Minimal test case: macro_rules! cast {
($x:expr) => ($x as ())
}
fn main() {
cast!(2);
}
Of course, if the expression and type both come from the macro invocation and are in order, you’ll end up with a rather odd span too: macro_rules! cast_aspersions {
($expr:expr, various stuff here, $ty:ty) => ($expr as $ty)
}
fn main() {
cast_aspersions!(2, various stuff here, ());
}
Really, for an error like this you need two distinct spans rather than one like these two examples below. I wonder how many other of our error messages are like that?
I think this should be labelled A-diagnostics; it doesn’t hold up compilation, just causes it to be unable to print that span. |
I don't know the version, but play.rust-lang.org nightly (and stable, for that matter, as well -- the error printed there is
thread 'rustc' panicked at 'capacity overflow'
).This is a weird one:
errors with
But, if you add parentheses around
$arr.len() * size_of($arr[0])
, the ICE disappears, andis printed instead.
Also, on a completely unrelated note, a C-style
sizeof(x)
would be very useful, instead of having to usesize_of::<T>()
.The text was updated successfully, but these errors were encountered: