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

ice: attempted .def_id() on invalid res: Err #120992

Closed
matthiaskrgr opened this issue Feb 12, 2024 · 7 comments · Fixed by #121198
Closed

ice: attempted .def_id() on invalid res: Err #120992

matthiaskrgr opened this issue Feb 12, 2024 · 7 comments · Fixed by #121198
Labels
C-bug Category: This is a bug. F-unnamed_fields `#![feature(unnamed_fields)]` 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

auto-reduced (treereduce-rust):

#[repr(C)]



#[repr(C)]
struct Bar {
    _: union {
        a: u8,
    },
}




#[repr(C)]




#[repr(C)]




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

        
          union  ,
    },
    
      union ,
}



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

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



#[repr(C)]
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:

#![allow(incomplete_features)]
#![feature(unnamed_fields)]

#[derive{
        pub a: u8
    }]
#[repr(C)]
struct Foo {
    a: u8,
}

#[derive(Clone, Copy)]
#[repr(C)]
struct Bar {
    _: union {
        a: u8,
    },
}


// duplicated with a normal field
#[derive(Clone, Copy)]
#[repr(C)]
union A {
    // 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]
        a: 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)]
#[repr(C)]
struct B {
    _: 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)
        _: 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: 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 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)
            _: 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 (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 {
            _: struct {
                a: u8, //~ ERROR field `a` is already declared [E0124]
            },
        },
        // 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
#[derive(Clone, Copy)]
#[repr(C)]
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: 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
    },
}

// 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
        },
        // more nested field (within the same anonymous adt)
        _: union {
            _: struct {
                a: 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 (b381d3ab2 2024-02-12)
binary: rustc
commit-hash: b381d3ab27f788f990551100c4425bb782d26d76
commit-date: 2024-02-12
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

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

Program output

error: expected identifier, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:34:15
   |
32 |         _: union {
   |            ----- while parsing this union
33 |             
34 |               ,
   |               ^ expected identifier

error: expected `:`, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:38:18
   |
31 |     _: struct {
   |        ------ while parsing this struct
...
38 |           union  ,
   |                  ^ expected `:`

error: expected `:`, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:41:13
   |
30 | union C {
   |       - while parsing this union
...
41 |       union ,
   |             ^ expected `:`

error: expected `,`, or `}`, found `union`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:56:6
   |
56 |     }  union ,
   |      ^ help: try adding a comma: `,`

error: expected `:`, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:56:14
   |
47 | struct D {
   |        - while parsing this struct
...
56 |     }  union ,
   |              ^ expected `:`

error: expected `,`, or `}`, found `union`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:71:6
   |
71 |     }  union ,
   |      ^ help: try adding a comma: `,`

error: expected `:`, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:71:14
   |
62 | union D2 {
   |       -- while parsing this union
...
71 |     }  union ,
   |              ^ expected `:`

error: expected identifier, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:80:9
   |
78 |     _: struct {
   |        ------ while parsing this struct
79 |         
80 |         ,
   |         ^ expected identifier

error: expected `:`, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:89:13
   |
77 | struct E {
   |        - while parsing this struct
...
89 |       union ,
   |             ^ expected `:`

error: expected identifier, found `,`
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:98:9
   |
96 |     _: struct {
   |        ------ while parsing this struct
97 |         
98 |         ,
   |         ^ expected identifier

error: expected `:`, found `,`
   --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:107:13
    |
95  | union E2 {
    |       -- while parsing this union
...
107 |       union ,
    |             ^ expected `:`

error[E0412]: cannot find type `Foo` in this scope
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:49:8
   |
49 |     _: Foo,
   |        ^^^ not found in this scope

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:11:5
   |
11 |     _: union {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:11:8
   |
11 |       _: union {
   |  ________^
12 | |         a: u8,
13 | |     },
   | |_____^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:31:5
   |
31 |     _: struct {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:32:9
   |
32 |         _: union {
   |         ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:32:12
   |
32 |           _: union {
   |  ____________^
33 | |             
34 | |               ,
35 | |         },
   | |_________^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:31:8
   |
31 |       _: struct {
   |  ________^
32 | |         _: union {
33 | |             
34 | |               ,
...  |
38 | |           union  ,
39 | |     },
   | |_____^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:49:5
   |
49 |     _: Foo,
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:54:5
   |
54 |     _: union {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:54:8
   |
54 |       _: union {
   |  ________^
55 | |         a: u8, 
56 | |     }  union ,
   | |_____^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:64:5
   |
64 |     _: Bar,
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:69:5
   |
69 |     _: union {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:69:8
   |
69 |       _: union {
   |  ________^
70 | |         a: u8, 
71 | |     }  union ,
   | |_____^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:78:5
   |
78 |     _: struct {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:78:8
   |
78 |       _: struct {
   |  ________^
79 | |         
80 | |         ,
81 | |
...  |
85 | |           union  ,
86 | |     },
   | |_____^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
  --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:96:5
   |
96 |     _: struct {
   |     ^
   |
   = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
   = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0658]: unnamed fields are not yet fully implemented
   --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:96:8
    |
96  |       _: struct {
    |  ________^
97  | |         
98  | |         ,
99  | |
...   |
103 | |           union  ,
104 | |     },
    | |_____^
    |
    = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
    = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
    = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
   --> /tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs:108:2
    |
108 | }
    |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.dKdiA7gV4Gjk/rustc_testrunner_tmpdir_reporting.uLoaCLooipW8/mvce.rs`

thread 'rustc' panicked at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/compiler/rustc_hir/src/def.rs:647:45:
attempted .def_id() on invalid res: Err
stack backtrace:
   0:     0x7f9a1e38a476 - std::backtrace_rs::backtrace::libunwind::trace::h3f288a3148e8bb15
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f9a1e38a476 - std::backtrace_rs::backtrace::trace_unsynchronized::h7277353061928bc0
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9a1e38a476 - std::sys_common::backtrace::_print_fmt::hbf79f06a8c92ca0e
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f9a1e38a476 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0afd1ff8e38a8a84
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9a1e3dd030 - core::fmt::rt::Argument::fmt::h7f26a9b6a6522b09
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/rt.rs:142:9
   5:     0x7f9a1e3dd030 - core::fmt::write::he7de9de816f98016
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f9a1e37dc6f - std::io::Write::write_fmt::h38e65bf4265dc66c
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/io/mod.rs:1854:15
   7:     0x7f9a1e38a254 - std::sys_common::backtrace::_print::hf1424a842a74edeb
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9a1e38a254 - std::sys_common::backtrace::print::hbb43acdb160822bd
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9a1e38d047 - std::panicking::default_hook::{{closure}}::h9c602a562527e529
  10:     0x7f9a1e38cda9 - std::panicking::default_hook::h9cb3bf5f6c73326f
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:292:9
  11:     0x7f9a2115cfdc - std[73253c920228642]::panicking::update_hook::<alloc[940273873142bb35]::boxed::Box<rustc_driver_impl[f037f419b039420a]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f9a1e38d796 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1e0fe9ec90d27cc3
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2030:9
  13:     0x7f9a1e38d796 - std::panicking::rust_panic_with_hook::hb5ad56797fd964c4
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:785:13
  14:     0x7f9a1e38d4e2 - std::panicking::begin_panic_handler::{{closure}}::hd364aeee29433213
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:659:13
  15:     0x7f9a1e38a976 - std::sys_common::backtrace::__rust_end_short_backtrace::ha10bb1568b9ec73d
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f9a1e38d234 - rust_begin_unwind
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:647:5
  17:     0x7f9a1e3d9785 - core::panicking::panic_fmt::h91fa7152f33c7717
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/panicking.rs:72:14
  18:     0x7f9a2123fdb3 - <rustc_hir[6019942fb8e590f1]::def::Res>::def_id
  19:     0x7f9a238aa75c - <rustc_hir_analysis[9a410817be2ff534]::collect::FieldUniquenessCheckContext>::check_field.cold.0
  20:     0x7f9a23042a54 - rustc_hir_analysis[9a410817be2ff534]::collect::convert_variant
  21:     0x7f9a23042363 - rustc_hir_analysis[9a410817be2ff534]::collect::adt_def
  22:     0x7f9a2247aa15 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::adt_def::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>
  23:     0x7f9a2247b0e1 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  24:     0x7f9a2247a3de - rustc_query_impl[b78e7f0549dc02d3]::query_impl::adt_def::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7f9a226e7cd7 - rustc_middle[dbb6cff8550fbced]::query::plumbing::query_get_at::<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>>
  26:     0x7f9a22963560 - rustc_hir_analysis[9a410817be2ff534]::outlives::inferred_outlives_crate
  27:     0x7f9a22962420 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::inferred_outlives_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f9a231fc34e - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::SingleCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  29:     0x7f9a231fce46 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::inferred_outlives_crate::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f9a22964bf5 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::inferred_outlives_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 16usize]>>
  31:     0x7f9a22518503 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  32:     0x7f9a22517eea - rustc_query_impl[b78e7f0549dc02d3]::query_impl::inferred_outlives_of::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f9a22563e22 - rustc_hir_analysis[9a410817be2ff534]::collect::predicates_defined_on
  34:     0x7f9a22563c53 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::predicates_defined_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
  35:     0x7f9a22564de7 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  36:     0x7f9a22564920 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::predicates_defined_on::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f9a22566595 - rustc_hir_analysis[9a410817be2ff534]::collect::predicates_of::predicates_of
  38:     0x7f9a22566493 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
  39:     0x7f9a22564e14 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  40:     0x7f9a225649fe - rustc_query_impl[b78e7f0549dc02d3]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f9a227a2970 - <rustc_hir_analysis[9a410817be2ff534]::collect::CollectItemTypesVisitor as rustc_hir[6019942fb8e590f1]::intravisit::Visitor>::visit_item
  42:     0x7f9a227a18c8 - rustc_hir_analysis[9a410817be2ff534]::collect::collect_mod_item_types
  43:     0x7f9a227a185b - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 0usize]>>
  44:     0x7f9a22ef2d3b - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_span[a4806a91d128f927]::def_id::LocalModDefId, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  45:     0x7f9a22ef285f - rustc_query_impl[b78e7f0549dc02d3]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7f9a2256e30e - rustc_hir_analysis[9a410817be2ff534]::check_crate
  47:     0x7f9a22de0419 - rustc_interface[ceb207a8fb5539d]::passes::analysis
  48:     0x7f9a22de005f - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>
  49:     0x7f9a232c6064 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::SingleCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  50:     0x7f9a232c5dc7 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  51:     0x7f9a231409fb - rustc_interface[ceb207a8fb5539d]::interface::run_compiler::<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}
  52:     0x7f9a2336ef12 - std[73253c920228642]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>
  53:     0x7f9a2336ed3e - <<std[73253c920228642]::thread::Builder>::spawn_unchecked_<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#1} as core[ed182bbac36ed604]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x7f9a1e396985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h37d86e7af57ec8cf
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
  55:     0x7f9a1e396985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h99a2218ed45ac1ce
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
  56:     0x7f9a1e396985 - std::sys::pal::unix::thread::Thread::new::thread_start::h6344e9d30547345d
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys/pal/unix/thread.rs:108:17
  57:     0x7f9a1e17b9eb - <unknown>
  58:     0x7f9a1e1ff7cc - <unknown>
  59:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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 (b381d3ab2 2024-02-12) 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 `Bar`
#3 [predicates_defined_on] computing predicates of `Bar`
#4 [predicates_of] computing predicates of `Bar`
#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 29 previous errors

Some errors have detailed explanations: E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.

@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. F-unnamed_fields `#![feature(unnamed_fields)]` labels Feb 12, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 12, 2024
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Feb 12, 2024

#![feature(unnamed_fields)]
#[repr(C)]
struct D {
    _: Foo,
    _: union {
    }
}

pub fn main() {}

#115367

@fmease
Copy link
Member

fmease commented Feb 13, 2024

Lol, what's up with all the unnecessary whitespace in your treereduce reproducers? Could you teach treereduce to reduce that? :P

@fmease
Copy link
Member

fmease commented Feb 13, 2024

Also I would probably place the MCVE from #120992 (comment) into the issue description and the original reproducer inside a <details /> (or omit it entirely) since this GitHub issue is super hard to read imo

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 13, 2024
@matthiaskrgr
Copy link
Member Author

auto-reduced (treereduce-rust):

struct TypedArenaChunk {
    next: Optionlet _: usize = ()
    
    
    
}


original:

struct TypedArenaChunk {
    next: Optionlet _: usize = ()
    //~^ ERROR mismatched types
    //~| ERROR expected `;`String>>
    //~^ ERROR unmatched angle bracket
}

fn main() {}

Version information

rustc 1.78.0-nightly (b381d3ab2 2024-02-12)
binary: rustc
commit-hash: b381d3ab27f788f990551100c4425bb782d26d76
commit-date: 2024-02-12
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

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

Program output

error: expected `,`, or `}`, found reserved identifier `_`
 --> /tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs:2:20
  |
2 |     next: Optionlet _: usize = ()
  |                    ^ help: try adding a comma: `,`

error: default values on `struct` fields aren't supported
 --> /tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs:2:29
  |
2 |     next: Optionlet _: usize = ()
  |                             ^^^^^ help: remove this unsupported default value

error[E0412]: cannot find type `Optionlet` in this scope
   --> /tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs:2:11
    |
2   |     next: Optionlet _: usize = ()
    |           ^^^^^^^^^ help: an enum with a similar name exists: `Option`
    |
   ::: /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/option.rs:571:1
    |
571 | pub enum Option<T> {
    | ------------------ similarly named enum `Option` defined here

error[E0658]: unnamed fields are not yet fully implemented
 --> /tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs:2:21
  |
2 |     next: Optionlet _: usize = ()
  |                     ^
  |
  = note: see issue #49804 <https://github.com/rust-lang/rust/issues/49804> for more information
  = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
  = note: this compiler was built on 2024-02-12; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs:6:2
  |
6 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.BqZKfZYQSE4S/rustc_testrunner_tmpdir_reporting.a3eGjPeXLcM9/mvce.rs`

thread 'rustc' panicked at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/compiler/rustc_hir/src/def.rs:647:45:
attempted .def_id() on invalid res: PrimTy(Uint(Usize))
stack backtrace:
   0:     0x7fc25db8a476 - std::backtrace_rs::backtrace::libunwind::trace::h3f288a3148e8bb15
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fc25db8a476 - std::backtrace_rs::backtrace::trace_unsynchronized::h7277353061928bc0
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc25db8a476 - std::sys_common::backtrace::_print_fmt::hbf79f06a8c92ca0e
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fc25db8a476 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0afd1ff8e38a8a84
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc25dbdd030 - core::fmt::rt::Argument::fmt::h7f26a9b6a6522b09
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/rt.rs:142:9
   5:     0x7fc25dbdd030 - core::fmt::write::he7de9de816f98016
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fc25db7dc6f - std::io::Write::write_fmt::h38e65bf4265dc66c
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/io/mod.rs:1854:15
   7:     0x7fc25db8a254 - std::sys_common::backtrace::_print::hf1424a842a74edeb
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc25db8a254 - std::sys_common::backtrace::print::hbb43acdb160822bd
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc25db8d047 - std::panicking::default_hook::{{closure}}::h9c602a562527e529
  10:     0x7fc25db8cda9 - std::panicking::default_hook::h9cb3bf5f6c73326f
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:292:9
  11:     0x7fc26095cfdc - std[73253c920228642]::panicking::update_hook::<alloc[940273873142bb35]::boxed::Box<rustc_driver_impl[f037f419b039420a]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fc25db8d796 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1e0fe9ec90d27cc3
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2030:9
  13:     0x7fc25db8d796 - std::panicking::rust_panic_with_hook::hb5ad56797fd964c4
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:785:13
  14:     0x7fc25db8d4e2 - std::panicking::begin_panic_handler::{{closure}}::hd364aeee29433213
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:659:13
  15:     0x7fc25db8a976 - std::sys_common::backtrace::__rust_end_short_backtrace::ha10bb1568b9ec73d
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fc25db8d234 - rust_begin_unwind
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:647:5
  17:     0x7fc25dbd9785 - core::panicking::panic_fmt::h91fa7152f33c7717
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/panicking.rs:72:14
  18:     0x7fc260a3fdb3 - <rustc_hir[6019942fb8e590f1]::def::Res>::def_id
  19:     0x7fc2630aa75c - <rustc_hir_analysis[9a410817be2ff534]::collect::FieldUniquenessCheckContext>::check_field.cold.0
  20:     0x7fc262842bb8 - rustc_hir_analysis[9a410817be2ff534]::collect::convert_variant
  21:     0x7fc262842363 - rustc_hir_analysis[9a410817be2ff534]::collect::adt_def
  22:     0x7fc261c7aa15 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::adt_def::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>
  23:     0x7fc261c7b0e1 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  24:     0x7fc261c7a3de - rustc_query_impl[b78e7f0549dc02d3]::query_impl::adt_def::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7fc261ee7cd7 - rustc_middle[dbb6cff8550fbced]::query::plumbing::query_get_at::<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>>
  26:     0x7fc25fec1bf2 - rustc_hir_analysis[9a410817be2ff534]::collect::type_of::type_of
  27:     0x7fc261c7c466 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7fc261c7b0e1 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefIdCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  29:     0x7fc261c7abdd - rustc_query_impl[b78e7f0549dc02d3]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7fc261fa28e6 - <rustc_hir_analysis[9a410817be2ff534]::collect::CollectItemTypesVisitor as rustc_hir[6019942fb8e590f1]::intravisit::Visitor>::visit_item
  31:     0x7fc261fa18c8 - rustc_hir_analysis[9a410817be2ff534]::collect::collect_mod_item_types
  32:     0x7fc261fa185b - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 0usize]>>
  33:     0x7fc2626f2d3b - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_span[a4806a91d128f927]::def_id::LocalModDefId, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  34:     0x7fc2626f285f - rustc_query_impl[b78e7f0549dc02d3]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7fc261d6e30e - rustc_hir_analysis[9a410817be2ff534]::check_crate
  36:     0x7fc2625e0419 - rustc_interface[ceb207a8fb5539d]::passes::analysis
  37:     0x7fc2625e005f - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>
  38:     0x7fc262ac6064 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::SingleCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
  39:     0x7fc262ac5dc7 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7fc2629409fb - rustc_interface[ceb207a8fb5539d]::interface::run_compiler::<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}
  41:     0x7fc262b6ef12 - std[73253c920228642]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>
  42:     0x7fc262b6ed3e - <<std[73253c920228642]::thread::Builder>::spawn_unchecked_<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#1} as core[ed182bbac36ed604]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7fc25db96985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h37d86e7af57ec8cf
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
  44:     0x7fc25db96985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h99a2218ed45ac1ce
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
  45:     0x7fc25db96985 - std::sys::pal::unix::thread::Thread::new::thread_start::h6344e9d30547345d
                               at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys/pal/unix/thread.rs:108:17
  46:     0x7fc25d9809eb - <unknown>
  47:     0x7fc25da047cc - <unknown>
  48:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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 (b381d3ab2 2024-02-12) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [adt_def] computing ADT definition for `TypedArenaChunk`
#1 [type_of] computing type of `TypedArenaChunk`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0412, E0601, E0658.
For more information about an error, try `rustc --explain E0412`.

@matthiaskrgr
Copy link
Member Author

@fmease im actually running rustfmt after reducing before generating the report, but treereduce sometimes slighlty misreduces the code (e.g. fn a(a: i32, b: i32, c:i32) to fn a(, , c: i32 or sth, so that rustfmt bails out due to syntax error and no longer squashes empty lines :/
Also likely to encounter code that rustfmt does not know about yet, sometimes it also just removes the part that would ICE lol.

I can see if I can add some kind of self-coded cleanup after rustfmt even.

@matthiaskrgr
Copy link
Member Author

Right now the report is generated fully automatic, the "reduced" mvce is never put into details, the original one only if its bigger than X lines, also the program output should match the mvce imo, mmh

@clubby789
Copy link
Contributor

All of the examples in here no longer ICE so I'm pretty sure #121198 got this too

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. F-unnamed_fields `#![feature(unnamed_fields)]` 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.

4 participants