struct InterruptSectorManager {
field: &'static (),
}
static FOO: [InterruptSectorManager; 2] = [InterruptSectorManager { field: &() }; 2];
Original
pub const TASK_NUM: usize = 10;
pub const INTERRUPT_NUM: usize = 14;
#[derive(Debug, Clone,Copy)]
pub struct Node
{
pub(crate) elem: fn(),
pub(crate) next: *mut Node,
pub(crate) prev: *mut Node,
}
pub struct InterruptManager
{
pub(crate) interrupt_table: &'static[self::InterruptSectorManager;1 * desc::INTERRUPT_NUM],
}
pub struct InterruptSectorManager
{
//pub(crate) interrupt_sector_table: &'static[Node; desc::TASK_NUMB],
pub(crate) interrupt_sector_table: &'static [&'static [Node; desc::TASK_NUM]; desc::INTERRUPT_NUM],
}
pub static TASK_CONT: [Node; desc::TASK_NUM] =
[Node{ elem: def_fn , next: 0 as *mut Node, prev: 0 as *mut Node }; desc::TASK_NUM];
static interrupt_sector_table: [interrupt_manager::InterruptSectorManager; desc::INTERRUPT_NUM] =
[interrupt_manager::InterruptSectorManager{ interrupt_sector_table: &[&TASK_CONT; desc::INTERRUPT_NUM]}; desc::INTERRUPT_NUM];
pub static interrupt_manager: interrupt_manager::InterruptManager = interrupt_manager::InterruptManager{ interrupt_table: &interrupt_sector_table };
rustc --version --verbose:
<version>
note: rustc 1.45.2 (d3fb005a3 2020-07-31) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-arg=-Tlink.x --crate-type lib
thread 'rustc' panicked at 'assertion failed: promoted.is_none()', src/librustc_mir/transform/check_consts/qualifs.rs:252:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
<output>
Backtrace
<backtrace>
Could you provide an MCVE? I.e., it'd be great if your snippet works on https://play.rust-lang.org/ (at least, we should tweak elem).
Minified,
struct InterruptSectorManager {
field: &'static (),
}
static FOO: [InterruptSectorManager; 2] = [InterruptSectorManager { field: &() }; 2];
Seems to have been introduced between at least 1.40.0 and 1.43.0
It's a regression from 1.40.0 to 1.41.0, confirmed in godbolt (https://rust.godbolt.org/z/hssfz9).
I guess reason of this mistake. Seem like, i get address of the newly created array here : interrupt_sector_table: &[&TASK_CONT; desc::INTERRUPT_NUM]}; desc::INTERRUPT_NUM];. Code was update by me and now its capable run on rust-playground
Assigning P-high as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.
Most helpful comment
Minified,
Seems to have been introduced between at least
1.40.0and1.43.0