Skip to content

ICE when returning a Box with a reference as its Allocator #81246

@beepster4096

Description

@beepster4096

Code

#![feature(allocator_api)]

fn ice() -> Box<(), &'static std::alloc::Global> {todo!()}

fn main(){
    ice();
}

Meta

rustc --version --verbose:

rustc 1.51.0-nightly (a4cbb44ae 2021-01-20)
binary: rustc
commit-hash: a4cbb44ae2c80545db957763b502dc7f6ea22085
commit-date: 2021-01-20
host: x86_64-pc-windows-msvc
release: 1.51.0-nightly
LLVM version: 11.0.1

Error output

thread 'rustc' panicked at 'assertion failed: i < this.fields.count()', /rustc/a4cbb44ae2c80545db957763b502dc7f6ea22085\compiler\rustc_middle\src\ty\layout.rs:2149:21
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.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (a4cbb44ae 2021-01-20) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden
query stack during panic:
error: could not compile `icetest`
Backtrace

thread 'rustc' panicked at 'assertion failed: i < this.fields.count()', /rustc/a4cbb44ae2c80545db957763b502dc7f6ea22085\compiler\rustc_middle\src\ty\layout.rs:2149:21
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.51.0-nightly (a4cbb44ae 2021-01-20) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `icetest`

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions