rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.72k stars 12.5k forks source link

ICE: ` Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt()` #121722

Open matthiaskrgr opened 6 months ago

matthiaskrgr commented 6 months ago

auto-reduced (treereduce-rust):


#[repr(C)]
struct Foo {
    _: u8,
}

struct Bar {
    _: union {
        a: u8,
    },
}

#[repr(C)]

#[main(C)]

#[repr(C)]
union C {
    _: struct {
        _: union {

            ,

            , 

             ,

            _: {
        _: struct  ,
            },

            _: Foo, 
            _: Bar, 

            _: struct ,
        },

          union  ,
    },

      union ,
}

#[repr(C)]
struct D {

    _: Foo,

    a: u8, 

    _: union {
        a: u8, 
    }  union ,
}

union D2 {

    _: Bar,

    a: u8, 

    _: union {
        a: u8, 
    }  union ,
}

#[repr(C)]
struct E {
    _: struct {

        ,

        , 

          union  ,
    },

      union ,
}

#[repr(C)]

union E2 {
    _: struct {

        ,

        , 

          union  ,
    },

      union ,
}
original code

original: ````rust #![allow(incomplete_features)] #![feature(unnamed_fields)] #[derive(Clone, Copy)] #[repr(C)] struct Foo { _: u8, } #[derive(Clone, Copy)] #[derive(Clone, Copy)] struct Bar { _: union { a: u8, }, } // duplicated with a normal field #[derive(Clone, Copy)] #[repr(C)] union E { // referent field a: u8, // normal field a: u8, //~ ERROR field `a` is already declared [E0124] // nested field _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] incomplete_features: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field _: union { _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, }, // nested field in a named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a nested field #[derive(Clone, Copy)] #[main(C)] struct B { _: union { // referent field _: Foo, // normal field (within the same anonymous adt) a: u8, //~ ERROR field `a` is already declared [E0124] // nested field (within the same anonymous adt) _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field (within the same anonymous adt) _: union { _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, }, // nested field in a named adt (within the same anonymous adt) _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt (within the same anonymous adt) _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, }, // normal field a: u8, //~ ERROR field `a` is already declared [E0124] // nested field _: struct { a: main, //~ ERROR field `a` is already declared [E0124] }, // more nested field _: union { _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, }, // nested field in a named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, // nested field in a named adt // nested field in a named adt in an anoymous adt _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a more nested field #[derive(Clone, Copy)] #[repr(C)] union C { _: struct { _: union { // referent field a: u8, // normal field (within the same anonymous adt) a: u8, //~ ERROR field `a` is already declared [E0124] // nested field (within the same anonymous adt) _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field (within the same anonymous adt) _: { _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, } { _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, }, // nested field in a named adt (within the same anonymous adt) _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt (within the same anonymous adt) _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, }, // normal field (within the direct outer anonymous adt) a: u8, //~ ERROR field `a` is already declared [E0124] // nested field (within the direct outer anonymous adt) _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field (within the direct outer anonymous adt) _: union { _: union { a: u8, //~ ERROR field `a` is already declared }, }, // nested field in a named adt (within the direct outer anonymous adt) _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt (within the direct outer anonymous adt) _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, }, // normal field a: u8, //~ ERROR field `a` is already declared [E0124] // nested field _: union { a: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field _: struct { _: union { a: u8, //~ ERROR field `a` is already declared [E0124] }, }, // nested field in a named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: union { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a nested field in a named adt #[derive(Clone, Copy)] #[repr(C)] struct D { // referent field `a` _: Foo, // normal field a: u8, //~ ERROR field `a` is already declared // nested field _: union { a: u8, //~ ERROR field `a` is already declared }, // more nested field _: struct { _: union { a: u8, //~ ERROR field `a` is already declared }, }, // nested field in another named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: union { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a nested field in a nested field of a named adt #[allow(incomplete_features)] #[repr(derive)] union D2 { // referent field `a` _: Bar, // normal field a: u8, //~ ERROR field `a` is already declared // nested field _: union { a: u8, //~ ERROR field `a` is already declared }, // more nested field _: struct { _: union { a: u8, //~ ERROR field `a` is already declared }, }, // nested field in another named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: union { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a nested field in a named adt in an anonymous adt #[derive(Clone, Copy)] #[repr(C)] struct E { _: struct { // referent field `a` _: Foo, // normal field (within the same anonymous adt) a: u8, //~ ERROR field `a` is already declared // nested field (within the same anonymous adt) _: struct { a: u8, //~ ERROR field `a` is already declared }, // more nested field (within the same anonymous adt) _: union { _: struct { a: u8a: //~ ERROR field `a` is already declared }, }, // nested field in a named adt (within the same anonymous adt) _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt (within the same anonymous adt) _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, }, // normal field a: u8, //~ ERROR field `a` is already declared // nested field _: union { incomplete_features: u8, //~ ERROR field `a` is already declared }, // more nested field _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, // nested field in another named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: union { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } // duplicated with a nested field in a named adt in an anonymous adt #[repr(C)] #[derive(Clone, Copy)] union E2 { _: struct { // referent field `a` _: Bar, // normal field (within the same anonymous adt) a: u8, //~ ERROR field `a` is already declared // nested field (within the same anonymous adt) _: struct { a: u8, //~ ERROR field `a` is already declared [E0124] // nested field _: union { a: u8, //~ ERROR field `a` is already declared [E0124] }, // more nested field _: struct u8, //~ ERROR field `a` is already declared }, // more nested field (within the same anonymous adt) _: union { _: struct { u8: u8, //~ ERROR field `a` is already declared }, }, // nested field in a named adt (within the same anonymous adt) _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt (within the same anonymous adt) _: struct { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, }, // normal field a: u8, //~ ERROR field `a` is already declared // nested field _: union { a: u8, //~ ERROR field `a` is already declared }, // more nested field _: struct { _: union { a: u8, //~ ERROR field `a` is already declared }, }, // nested field in another named adt _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared // nested field in a named adt in an anoymous adt _: union { _: Foo, //~ ERROR field `a` is already declared _: Bar, //~ ERROR field `a` is already declared }, } fn main() {} ````

Version information

rustc 1.78.0-nightly (ef324565d 2024-02-27)
binary: rustc
commit-hash: ef324565d071c6d7e2477a195648549e33d6a465
commit-date: 2024-02-27
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: expected identifier, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:36:13 | 34 | _: union { | ----- while parsing this union 35 | 36 | , | ^ expected identifier error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:54:18 | 33 | _: struct { | ------ while parsing this struct ... 54 | union , | ^ expected `:` error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:57:13 | 32 | union C { | - while parsing this union ... 57 | union , | ^ expected `:` error: expected `,`, or `}`, found `union` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:72:6 | 72 | } union , | ^ help: try adding a comma: `,` error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:72:14 | 63 | struct D { | - while parsing this struct ... 72 | } union , | ^ expected `:` error: expected `,`, or `}`, found `union` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:87:6 | 87 | } union , | ^ help: try adding a comma: `,` error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:87:14 | 78 | union D2 { | -- while parsing this union ... 87 | } union , | ^ expected `:` error: expected identifier, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:96:9 | 94 | _: struct { | ------ while parsing this struct 95 | 96 | , | ^ expected identifier error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:105:13 | 93 | struct E { | - while parsing this struct ... 105 | union , | ^ expected `:` error: expected identifier, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:114:9 | 112 | _: struct { | ------ while parsing this struct 113 | 114 | , | ^ expected identifier error: expected `:`, found `,` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:123:13 | 111 | union E2 { | -- while parsing this union ... 123 | union , | ^ expected `:` error: cannot find attribute `main` in this scope --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:26:3 | 26 | #[main(C)] | ^^^^ error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:7:5 | 7 | _: u8, | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:13:5 | 13 | _: union { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:13:8 | 13 | _: union { | ________^ 14 | | a: u8, 15 | | }, | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:33:5 | 33 | _: struct { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:34:9 | 34 | _: union { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:34:12 | 34 | _: union { | ____________^ 35 | | 36 | | , 37 | | ... | 50 | | _: struct , 51 | | }, | |_________^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:33:8 | 33 | _: struct { | ________^ 34 | | _: union { 35 | | 36 | | , ... | 54 | | union , 55 | | }, | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:65:5 | 65 | _: Foo, | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:70:5 | 70 | _: union { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:70:8 | 70 | _: union { | ________^ 71 | | a: u8, 72 | | } union , | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:80:5 | 80 | _: Bar, | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:85:5 | 85 | _: union { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:85:8 | 85 | _: union { | ________^ 86 | | a: u8, 87 | | } union , | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:94:5 | 94 | _: struct { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:94:8 | 94 | _: struct { | ________^ 95 | | 96 | | , 97 | | ... | 101 | | union , 102 | | }, | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:112:5 | 112 | _: struct { | ^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0658]: unnamed fields are not yet fully implemented --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:112:8 | 112 | _: struct { | ________^ 113 | | 114 | | , 115 | | ... | 119 | | union , 120 | | }, | |_____^ | = note: see issue #49804 for more information = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable = note: this compiler was built on 2024-02-27; consider upgrading it if it is out of date error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:124:2 | 124 | } | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs` error: internal compiler error: compiler/rustc_hir_analysis/src/collect.rs:906:32: Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt(): u8 --> /tmp/icemaker_global_tempdir.8RVjYmQMzzwG/rustc_testrunner_tmpdir_reporting.F427u8SIf55Q/mvce.rs:7:5 | 7 | _: u8, | ^^^^^ thread 'rustc' panicked at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/compiler/rustc_middle/src/util/bug.rs:34:50: Box stack backtrace: 0: 0x7fd84e78cc46 - std::backtrace_rs::backtrace::libunwind::trace::hcd31ff68bb8eb3c8 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5 1: 0x7fd84e78cc46 - std::backtrace_rs::backtrace::trace_unsynchronized::h14d76bd5509bf096 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fd84e78cc46 - std::sys_common::backtrace::_print_fmt::hccb1d92c773f2e33 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7fd84e78cc46 - ::fmt::haec236aae0c71094 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fd84e7ddbcc - core::fmt::rt::Argument::fmt::hfe5c81d163ead061 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/core/src/fmt/rt.rs:142:9 5: 0x7fd84e7ddbcc - core::fmt::write::hae70f68f90cda8d6 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/core/src/fmt/mod.rs:1120:17 6: 0x7fd84e7814cf - std::io::Write::write_fmt::h2920683ffc23d04e at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/io/mod.rs:1846:15 7: 0x7fd84e78c9f4 - std::sys_common::backtrace::_print::h5625fa16158ef797 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7fd84e78c9f4 - std::sys_common::backtrace::print::h736502c57d395fe5 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7fd84e78f73b - std::panicking::default_hook::{{closure}}::hd092ecfc821f695b 10: 0x7fd84e78f489 - std::panicking::default_hook::h7f251f2c2a8aa52c at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/panicking.rs:292:9 11: 0x7fd8516a5d3c - std[578157ee06130f18]::panicking::update_hook::>::{closure#0} 12: 0x7fd84e78fea0 - as core::ops::function::Fn>::call::hc774e046b4082d87 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/alloc/src/boxed.rs:2030:9 13: 0x7fd84e78fea0 - std::panicking::rust_panic_with_hook::h50c9145ee7057605 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/panicking.rs:783:13 14: 0x7fd8516d1d74 - std[578157ee06130f18]::panicking::begin_panic::::{closure#0} 15: 0x7fd8516ce9c6 - std[578157ee06130f18]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7fd8516ca186 - std[578157ee06130f18]::panicking::begin_panic:: 17: 0x7fd8516db8d1 - ::emit_producing_guarantee 18: 0x7fd851780ac0 - rustc_middle[2ebf57413533262e]::util::bug::opt_span_bug_fmt::::{closure#0} 19: 0x7fd8517816ba - rustc_middle[2ebf57413533262e]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 20: 0x7fd85176ab78 - rustc_middle[2ebf57413533262e]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 21: 0x7fd851766f24 - rustc_middle[2ebf57413533262e]::util::bug::span_bug_fmt:: 22: 0x7fd8517d497b - ::check_field_in_nested_adt 23: 0x7fd852f82f05 - rustc_hir_analysis[b9c969b446149ad8]::collect::convert_variant 24: 0x7fd852f8275e - rustc_hir_analysis[b9c969b446149ad8]::collect::adt_def 25: 0x7fd852a8b4d5 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 26: 0x7fd852a8bba0 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 27: 0x7fd852a8aea2 - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::adt_def::get_query_non_incr::__rust_end_short_backtrace 28: 0x7fd852c3dc52 - rustc_middle[2ebf57413533262e]::query::plumbing::query_get_at::>> 29: 0x7fd853441853 - rustc_hir_analysis[b9c969b446149ad8]::outlives::inferred_outlives_crate 30: 0x7fd8534406f0 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 31: 0x7fd8537bbe0e - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 32: 0x7fd8537bc8a0 - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::inferred_outlives_crate::get_query_non_incr::__rust_end_short_backtrace 33: 0x7fd852d4fae3 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 34: 0x7fd852d4e641 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 35: 0x7fd852d4e35e - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::inferred_outlives_of::get_query_non_incr::__rust_end_short_backtrace 36: 0x7fd852afd455 - rustc_hir_analysis[b9c969b446149ad8]::collect::predicates_defined_on 37: 0x7fd852afd2a1 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 38: 0x7fd852afd289 - >::call_once 39: 0x7fd852afc566 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 40: 0x7fd852afc0a0 - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::predicates_defined_on::get_query_non_incr::__rust_end_short_backtrace 41: 0x7fd852afb08c - rustc_hir_analysis[b9c969b446149ad8]::collect::predicates_of::predicates_of 42: 0x7fd852afaf93 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 43: 0x7fd852afc581 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 44: 0x7fd852afc17e - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace 45: 0x7fd852d9542a - ::visit_item 46: 0x7fd852d946ea - rustc_hir_analysis[b9c969b446149ad8]::collect::collect_mod_item_types 47: 0x7fd852d94677 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 48: 0x7fd85356edad - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 49: 0x7fd85356e8d7 - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace 50: 0x7fd8532c4b28 - rustc_hir_analysis[b9c969b446149ad8]::check_crate 51: 0x7fd853565bef - rustc_interface[549d5cba17650390]::passes::analysis 52: 0x7fd853565859 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::> 53: 0x7fd853739325 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ba88ac09c9d7b12d]::plumbing::QueryCtxt, false> 54: 0x7fd853739089 - rustc_query_impl[ba88ac09c9d7b12d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 55: 0x7fd853740c16 - rustc_interface[549d5cba17650390]::interface::run_compiler::, rustc_driver_impl[58539505cbc2faf7]::run_compiler::{closure#0}>::{closure#0} 56: 0x7fd8539e7dc5 - std[578157ee06130f18]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[58539505cbc2faf7]::run_compiler::{closure#0}>::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>>::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>> 57: 0x7fd8539e7bf2 - <::spawn_unchecked_, rustc_driver_impl[58539505cbc2faf7]::run_compiler::{closure#0}>::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>>::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>>::{closure#1} as core[6cbd71b2db6ebc95]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 58: 0x7fd84e799875 - as core::ops::function::FnOnce>::call_once::hbfe673f8fb6b1f32 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/alloc/src/boxed.rs:2016:9 59: 0x7fd84e799875 - as core::ops::function::FnOnce>::call_once::h91a1aab6b746134a at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/alloc/src/boxed.rs:2016:9 60: 0x7fd84e799875 - std::sys::pal::unix::thread::Thread::new::thread_start::h8e91ee627a6e8489 at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/std/src/sys/pal/unix/thread.rs:108:17 61: 0x7fd84e58155a - 62: 0x7fd84e5fea3c - 63: 0x0 - note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.78.0-nightly (ef324565d 2024-02-27) running on x86_64-unknown-linux-gnu query stack during panic: #0 [adt_def] computing ADT definition for `D` #1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate #2 [inferred_outlives_of] computing inferred outlives predicates of `Foo` #3 [predicates_defined_on] computing predicates of `Foo` #4 [predicates_of] computing predicates of `Foo` #5 [collect_mod_item_types] collecting item types in top-level module #6 [analysis] running analysis passes on this crate end of query stack error: aborting due to 31 previous errors Some errors have detailed explanations: E0601, E0658. For more information about an error, try `rustc --explain E0601`. ```

matthiaskrgr commented 6 months ago

will try to clean up later.

matthiaskrgr commented 6 months ago
#[repr(C)]
struct Foo {
    _: u8,
}

#[repr(C)]
struct D {
    _: Foo,
}