Skip to content

crash: lazy type alias: stack overflow #131994

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(lazy_type_alias)]
type A = [[Y; {}]; {
    type A = [A; {}];
}];

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (662180b34 2024-10-20)
binary: rustc
commit-hash: 662180b34d95f72d05b7c467b0baf4d23d36b1e1
commit-date: 2024-10-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

Error output

<output>
Backtrace

error[E0412]: cannot find type `Y` in this scope
 --> /tmp/crash.rs:2:12
  |
2 | type A = [[Y; {}]; {
  |            ^ not found in this scope

warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/crash.rs:1:12
  |
1 | #![feature(lazy_type_alias)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `crash`
 --> /tmp/crash.rs:4:4
  |
4 | }];
  |    ^ consider adding a `main` function to `/tmp/crash.rs`

error[E0308]: mismatched types
 --> /tmp/crash.rs:2:15
  |
2 | type A = [[Y; {}]; {
  |               ^^ expected `usize`, found `()`

error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x37207d3) [0x732bf89207d3]
/usr/lib/libc.so.6(+0x3d1d0) [0x732bfc5bb1d0]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x5011e81) [0x732bfa211e81]

### cycle encountered after 3 frames with period 4
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x50124ce) [0x732bfa2124ce]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x5011e86) [0x732bfa211e86]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x50124ce) [0x732bfa2124ce]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x5011e86) [0x732bfa211e86]
### recursed 63 times

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-5396912e8af1f65d.so(+0x50124ce) [0x732bfa2124ce]

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-lazy_type_alias`#![feature(lazy_type_alias)]`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

    Status

    Can Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions