Skip to content

type ascription: stack overflow #149431

@matthiaskrgr

Description

@matthiaskrgr

Code

const ARRAY_REF: [!; 1] = todo!();
fn main() {
    type_ascribe!(ARRAY_REF[0], i32)
}

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (c86564c41 2025-11-27)
binary: rustc
commit-hash: c86564c412a5949088a53b665d8b9a47ec610a39
commit-date: 2025-11-27
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5

Error output

error[E0658]: use of unstable library feature `type_ascription`: placeholder syntax for type ascription
 --> code.rs:3:5
  |
3 |     type_ascribe!(ARRAY_REF[0], i32)
  |     ^^^^^^^^^^^^
  |
  = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
  = help: add `#![feature(type_ascription)]` to the crate attributes to enable
  = note: this compiler was built on 2025-11-27; consider upgrading it if it is out of date

error[E0658]: the `!` type is experimental
 --> code.rs:1:19
  |
1 | const ARRAY_REF: [!; 1] = todo!();
  |                   ^
  |
  = note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information
  = help: add `#![feature(never_type)]` to the crate attributes to enable
  = note: this compiler was built on 2025-11-27; consider upgrading it if it is out of date

error[E0080]: evaluation panicked: not yet implemented
 --> code.rs:1:27
  |
1 | const ARRAY_REF: [!; 1] = todo!();
  |                           ^^^^^^^ evaluation of `ARRAY_REF` failed here
  |
Backtrace

error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x3ad574c) [0x7f7a54ad574c]
/usr/lib/libc.so.6(+0x3e540) [0x7f7a50c3e540]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(_RNvMs1_NtNtCshPD3nR7tEK4_12rustc_middle3hir3mapNtNtNtB9_2ty7context6TyCtxt15parent_hir_node+0x2b) [0x7f7a5629e7fd]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56030eb) [0x7f7a566030eb]

### cycle encountered after 4 frames with period 5
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
### recursed 50 times

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-d012d9d43742cddd.so(+0x56032ee) [0x7f7a566032ee]

note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
[1]    4073700 segmentation fault  rustc code.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-never_type`#![feature(never_type)]`F-type_ascription`#![feature(type_ascription)]`I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions