Skip to content

coherence: stack overflow #124805

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

#[derive(Debug)]
struct X<const FN: fn() = { || {} }>;

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (9c9b56879 2024-05-05)
binary: rustc
commit-hash: 9c9b568792ef20d8459c745345dd3e79b7c7fa8c
commit-date: 2024-05-05
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

Error output

<output>
Backtrace

error[E0601]: `main` function not found in crate `a`
 --> a.rs:2:38
  |
2 | struct X<const FN: fn() = { || {} }>;
  |                                      ^ consider adding a `main` function to `a.rs`

error: using function pointers as const generic parameters is forbidden
 --> a.rs:2:20
  |
2 | struct X<const FN: fn() = { || {} }>;
  |                    ^^^^
  |
  = note: the only supported types are integers, `bool` and `char`

error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x30d8936)[0x7e96c9ed8936]
/usr/lib/libc.so.6(+0x40770)[0x7e96c6c5a770]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f5f)[0x7e96ca979f5f]

### cycle encountered after 3 frames with period 4
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f64)[0x7e96ca979f64]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f64)[0x7e96ca979f64]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f64)[0x7e96ca979f64]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f64)[0x7e96ca979f64]
### recursed 63 times

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-c823c964cb628bbb.so(+0x3b79f64)[0x7e96ca979f64]

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
[2]    1058737 segmentation fault  rustc a.rs -Znext-solver=coherence

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions