-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustc panic with "assertion failed: !value.needs_subst()" #50518
Comments
I have the same error, interesstingly the error seems to have something to do with PhantomData:
Edit 1 & 2: Smaller example |
After some testing i found out it has nothing to do with the PhantomData, since the following code still gives the same error:
edit: further simplification |
I think it's related to promoting references to fat pointers in const contexts. In your example you promote a closure |
It seems that the Problem only occurs, when using the associated constant from inside the implementation block: |
I found a different example which gives the same error: struct MyBox<T>(*mut T);
impl<T> MyBox<T> {
fn get(&self) -> Option<&T> {
match self.0 {
Self::NULL => None,
ptr => unsafe { Some(&*ptr) },
}
}
const NULL: *mut T = ::std::ptr::null_mut();
}
It only ICEs if I initialize const NULL: *mut T = 0 as *mut T; Moving the function outside the impl block still ICEs, but with a different error: struct MyBox<T>(*mut T);
impl<T> MyBox<T> {
const NULL: *mut T = ::std::ptr::null_mut();
}
fn get<'a, T>(ptr: *mut T) -> Option<&'a T> {
match ptr {
MyBox::<T>::NULL => None,
ptr => unsafe { Some(&*ptr) },
}
}
|
Hit this in https://github.com/matklad/once_cell, in stable(1.28.0), beta(1.29.0-beta.1) and nightly ( 2018-08-03). Here's the commit which exemplifies the issue: matklad/once_cell@ea1c14b (run |
Triage: both the original example and the once_cell bug no longer reproduce for me on 1.31.1 (2018 release) and 1.34.1 (stable at the time of writing). The issue should probably be closed. Or do we want to add run-pass test just in case? |
Lets add a regression test. |
It was fixed somewhere between 1.28.0 and 1.31.1 closes rust-lang#50518
test for rust-lang#50518 It was fixed somewhere between 1.28.0 and 1.31.1 closes rust-lang#50518 r? @estebank Where's the best place to add this test? I *think* we want "compile-pass" for this test (no need to run a binary, and not running saves us a millisecond of process creation) , but there's no compile-pass anymore. Should this be UI test with empty stdout, stderr and zero return code?
test for rust-lang#50518 It was fixed somewhere between 1.28.0 and 1.31.1 closes rust-lang#50518 r? @estebank Where's the best place to add this test? I *think* we want "compile-pass" for this test (no need to run a binary, and not running saves us a millisecond of process creation) , but there's no compile-pass anymore. Should this be UI test with empty stdout, stderr and zero return code?
test for rust-lang#50518 It was fixed somewhere between 1.28.0 and 1.31.1 closes rust-lang#50518 r? @estebank Where's the best place to add this test? I *think* we want "compile-pass" for this test (no need to run a binary, and not running saves us a millisecond of process creation) , but there's no compile-pass anymore. Should this be UI test with empty stdout, stderr and zero return code?
Rollup of 8 pull requests Successful merges: - #59979 (to_xe_bytes for isize and usize returns an array of different size) - #60491 (std: Update compiler-builtins crate) - #60550 (Add tests for concrete const types) - #60572 (Add test for #59972) - #60627 (test for #50518) - #60634 (Document + Cleanup lang_items.rs) - #60641 (Instead of ICEing on incorrect pattern, use delay_span_bug) - #60644 (Use `delay_span_bug` for "Failed to unify obligation") Failed merges: r? @ghost
The below example panics with:
thread 'main' panicked at 'assertion failed: !value.needs_subst()', librustc/traits/query/normalize_erasing_regions.rs:69:9
I've tried minimizing the example as much as possible and that's the best I can do for now.
Version: rustc 1.27.0-nightly (428ea5f 2018-05-06)
The text was updated successfully, but these errors were encountered: