Skip to content

stack overflow #122364

Closed
Closed
@matthiaskrgr

Description

@matthiaskrgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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