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

stack overflow #122364

Closed
matthiaskrgr opened this issue Mar 12, 2024 · 1 comment · Fixed by #122366
Closed

stack overflow #122364

matthiaskrgr opened this issue Mar 12, 2024 · 1 comment · Fixed by #122366
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

original #23992

trait Foo {
    type Bar;
    fn foo(self) -> Self::Bar;
}

impl Foo for Box<Foo> {
    type Bar = <Self as Foo>::Bar;
    fn foo(self) -> <Self as Foo>::Bar {
        (*self).foo()
    }
}

Version information

rustc 1.78.0-nightly (5aad51d01 2024-03-12)
binary: rustc
commit-hash: 5aad51d015b8d3f6d823a6bf9dbc8ae3b9fd10c5
commit-date: 2024-03-12
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0601]: `main` function not found in crate `23992`
  --> 23992.rs:11:2
   |
11 | }
   |  ^ consider adding a `main` function to `23992.rs`

warning: trait objects without an explicit `dyn` are deprecated
 --> 23992.rs:6:18
  |
6 | impl Foo for Box<Foo> {
  |                  ^^^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
  = note: `#[warn(bare_trait_objects)]` on by default
help: if this is an object-safe trait, use `dyn`
  |
6 | impl Foo for Box<dyn Foo> {
  |                  +++

error[E0191]: the value of the associated type `Bar` in `Foo` must be specified
 --> 23992.rs:6:18
  |
2 |     type Bar;
  |     -------- `Bar` defined here
...
6 | impl Foo for Box<Foo> {
  |                  ^^^ help: specify the associated type: `Foo<Bar = Type>`

error: rustc interrupted by SIGSEGV, printing backtrace

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-005b29bff0c132ec.so(+0x2ea3573)[0x7fb48cca3573]
/usr/lib/libc.so.6(+0x40770)[0x7fb489b31770]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-005b29bff0c132ec.so(_RNvXs0_NtCslkfv2LWTlR7_14rustc_ty_utils12opaque_typesNtB5_19OpaqueTypeCollectorINtNtCs1WKmo3440Fy_13rustc_type_ir5visit11TypeVisitorNtNtNtCs8laOuMcdVHv_12rustc_middle2ty7context6TyCtxtE8visit_ty+0x1e)[0x7fb48b79f28e]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-005b29bff0c132ec.so(_RNvXs0_NtCslkfv2LWTlR7_14rustc_ty_utils12opaque_typesNtB5_19OpaqueTypeCollectorINtNtCs1WKmo3440Fy_13rustc_type_ir5visit11TypeVisitorNtNtNtCs8laOuMcdVHv_12rustc_middle2ty7context6TyCtxtE8visit_ty+0x1efa)[0x7fb48b7a116a]

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

/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-005b29bff0c132ec.so(_RNvXs0_NtCslkfv2LWTlR7_14rustc_ty_utils12opaque_typesNtB5_19OpaqueTypeCollectorINtNtCs1WKmo3440Fy_13rustc_type_ir5visit11TypeVisitorNtNtNtCs8laOuMcdVHv_12rustc_middle2ty7context6TyCtxtE8visit_ty+0xfe0)[0x7fb48b7a0250]
/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-005b29bff0c132ec.so(_RNvXs0_NtCslkfv2LWTlR7_14rustc_ty_utils12opaque_typesNtB5_19OpaqueTypeCollectorINtNtCs1WKmo3440Fy_13rustc_type_ir5visit11TypeVisitorNtNtNtCs8laOuMcdVHv_12rustc_middle2ty7context6TyCtxtE8visit_ty+0xfe0)[0x7fb48b7a0250]

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
[1]    134294 segmentation fault  rustc 23992.rs

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 12, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 12, 2024
@matthiaskrgr matthiaskrgr added the I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. label Mar 12, 2024
@matthiaskrgr
Copy link
Member Author

regression in #121796 cc @oli-obk 😅

@bors bors closed this as completed in 0b31375 Mar 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 12, 2024
Rollup merge of rust-lang#122366 - oli-obk:opaques_defined_by_overflow, r=lcnr

Fix stack overflow with recursive associated types

fixes rust-lang#122364
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 12, 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants