-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: expected memory, got Static(DefId(0:6 ... ice-zst-static-access.rs with --emir mir #72105
Comments
This happens on stable, too. Cc @rust-lang/wg-const-eval |
Those tickets report different ICEs, from what I can see. Same source code, but different assertion hit in the compiler. |
Reduced: extern "C" {
static _dispatch_queue_attr_concurrent: [u8; 0];
}
fn main() {
let x: &[u8; 0] =
unsafe { &_dispatch_queue_attr_concurrent };
} when I use an underscore binding extern "C" {
static _dispatch_queue_attr_concurrent: [u8; 0];
}
fn main() {
let _: &[u8; 0] =
unsafe { &_dispatch_queue_attr_concurrent };
} |
The same ICE also triggers on this file in the miri submodule: static ARRAY: [u8; 2] = [0, 1];
fn main() {
let ptr_to_first = &ARRAY[0] as *const u8;
// Illegally use this to access the 2nd element.
let _val = unsafe { *ptr_to_first.add(1) }; //~ ERROR borrow stack
} |
I'm guessing it's rust/src/librustc_middle/ty/print/pretty.rs Line 962 in 09c817e
global_alloc and print different output depending on it
|
PR to fix this is up at #72424 |
@RalfJung I'm getting a similar ice when checking https://github.com/dtolnay/dtoa with
|
That's a bit hard to tell based on a backtrace without line numbers. But with my patch, there is no more There's still an |
Btw it would be great if someone could review that PR. :) Looks like @oli-obk is pretty busy. |
fix ICE when debug-printing MIR Fixes rust-lang#72105 This bug also makes debugging Miri harder as `MIRI_LOG=info` ICEs.
Can confirm this fixed the |
Command:
rustc src/test/ui/consts/ice-zst-static-access.rs --emit mir
Code
This code is from
src/test/ui/consts/ice-zst-static-access.rs
Meta
rustc --version --verbose
:The compiler is at revision aeb4738
Error output
Backtrace
The text was updated successfully, but these errors were encountered: