Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coherence: stack overflow #124805

Closed
matthiaskrgr opened this issue May 6, 2024 · 1 comment · Fixed by #124808
Closed

coherence: stack overflow #124805

matthiaskrgr opened this issue May 6, 2024 · 1 comment · Fixed by #124808
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Comments

@matthiaskrgr
Copy link
Member

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

@matthiaskrgr matthiaskrgr added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 6, 2024
@matthiaskrgr
Copy link
Member Author

   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#492 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#493 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#494 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#495 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#496 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#497 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#498 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#499 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#500 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()
   from /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-baba34ae40c356f7.so
#501 0x00007ffff5383e54 in <rustc_next_trait_solver::canonicalizer::RegionsToStatic<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle::ty::sty::FnSig> ()

@bors bors closed this as completed in ad73b16 May 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 6, 2024
Rollup merge of rust-lang#124808 - compiler-errors:super, r=lcnr

Use `super_fold` in `RegionsToStatic` visitor

so as to avoid an infinite stack cycle

fixes rust-lang#124805
r? lcnr
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants