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: Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt() #121722

Closed
matthiaskrgr opened this issue Feb 28, 2024 · 2 comments · Fixed by #131045
Closed
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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)]
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:

#![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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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 <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-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<dyn Any>
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 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::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::<alloc[1f5b0d5bc2928dda]::boxed::Box<rustc_driver_impl[58539505cbc2faf7]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fd84e78fea0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::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::<rustc_errors[2100e50554992a1d]::ExplicitBug>::{closure#0}
  15:     0x7fd8516ce9c6 - std[578157ee06130f18]::sys_common::backtrace::__rust_end_short_backtrace::<std[578157ee06130f18]::panicking::begin_panic<rustc_errors[2100e50554992a1d]::ExplicitBug>::{closure#0}, !>
  16:     0x7fd8516ca186 - std[578157ee06130f18]::panicking::begin_panic::<rustc_errors[2100e50554992a1d]::ExplicitBug>
  17:     0x7fd8516db8d1 - <rustc_errors[2100e50554992a1d]::diagnostic::BugAbort as rustc_errors[2100e50554992a1d]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7fd851780ac0 - rustc_middle[2ebf57413533262e]::util::bug::opt_span_bug_fmt::<rustc_span[20f1163f305bb5ee]::span_encoding::Span>::{closure#0}
  19:     0x7fd8517816ba - rustc_middle[2ebf57413533262e]::ty::context::tls::with_opt::<rustc_middle[2ebf57413533262e]::util::bug::opt_span_bug_fmt<rustc_span[20f1163f305bb5ee]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7fd85176ab78 - rustc_middle[2ebf57413533262e]::ty::context::tls::with_context_opt::<rustc_middle[2ebf57413533262e]::ty::context::tls::with_opt<rustc_middle[2ebf57413533262e]::util::bug::opt_span_bug_fmt<rustc_span[20f1163f305bb5ee]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7fd851766f24 - rustc_middle[2ebf57413533262e]::util::bug::span_bug_fmt::<rustc_span[20f1163f305bb5ee]::span_encoding::Span>
  22:     0x7fd8517d497b - <rustc_hir_analysis[b9c969b446149ad8]::collect::FieldUniquenessCheckContext>::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::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::adt_def::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7fd852a8bba0 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::DefIdCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 8usize]>>, 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::<rustc_query_system[cf6fea66217b4faa]::query::caches::DefIdCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 8usize]>>>
  29:     0x7fd853441853 - rustc_hir_analysis[b9c969b446149ad8]::outlives::inferred_outlives_crate
  30:     0x7fd8534406f0 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::inferred_outlives_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 8usize]>>
  31:     0x7fd8537bbe0e - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::SingleCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 8usize]>>, 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::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::inferred_outlives_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7fd852d4e641 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::DefIdCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 16usize]>>, 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::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::predicates_defined_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 24usize]>>
  38:     0x7fd852afd289 - <rustc_query_impl[ba88ac09c9d7b12d]::query_impl::predicates_defined_on::dynamic_query::{closure#2} as core[6cbd71b2db6ebc95]::ops::function::FnOnce<(rustc_middle[2ebf57413533262e]::ty::context::TyCtxt, rustc_span[20f1163f305bb5ee]::def_id::DefId)>>::call_once
  39:     0x7fd852afc566 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::DefIdCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 24usize]>>, 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::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 24usize]>>
  43:     0x7fd852afc581 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::DefIdCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 24usize]>>, 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 - <rustc_hir_analysis[b9c969b446149ad8]::collect::CollectItemTypesVisitor as rustc_hir[2b58f08a8a598f50]::intravisit::Visitor>::visit_item
  46:     0x7fd852d946ea - rustc_hir_analysis[b9c969b446149ad8]::collect::collect_mod_item_types
  47:     0x7fd852d94677 - rustc_query_impl[ba88ac09c9d7b12d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 0usize]>>
  48:     0x7fd85356edad - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::DefaultCache<rustc_span[20f1163f305bb5ee]::def_id::LocalModDefId, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 0usize]>>, 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::<rustc_query_impl[ba88ac09c9d7b12d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 1usize]>>
  53:     0x7fd853739325 - rustc_query_system[cf6fea66217b4faa]::query::plumbing::try_execute_query::<rustc_query_impl[ba88ac09c9d7b12d]::DynamicConfig<rustc_query_system[cf6fea66217b4faa]::query::caches::SingleCache<rustc_middle[2ebf57413533262e]::query::erase::Erased<[u8; 1usize]>>, 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::<core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>, rustc_driver_impl[58539505cbc2faf7]::run_compiler::{closure#0}>::{closure#0}
  56:     0x7fd8539e7dc5 - std[578157ee06130f18]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[549d5cba17650390]::util::run_in_thread_with_globals<rustc_interface[549d5cba17650390]::util::run_in_thread_pool_with_globals<rustc_interface[549d5cba17650390]::interface::run_compiler<core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>, 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 - <<std[578157ee06130f18]::thread::Builder>::spawn_unchecked_<rustc_interface[549d5cba17650390]::util::run_in_thread_with_globals<rustc_interface[549d5cba17650390]::util::run_in_thread_pool_with_globals<rustc_interface[549d5cba17650390]::interface::run_compiler<core[6cbd71b2db6ebc95]::result::Result<(), rustc_span[20f1163f305bb5ee]::ErrorGuaranteed>, 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 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbfe673f8fb6b1f32
                               at /rustc/ef324565d071c6d7e2477a195648549e33d6a465/library/alloc/src/boxed.rs:2016:9
  59:     0x7fd84e799875 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::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 - <unknown>
  62:     0x7fd84e5fea3c - <unknown>
  63:                0x0 - <unknown>

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 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 Feb 28, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 28, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: ` Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt() ICE: Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt() Feb 28, 2024
@matthiaskrgr
Copy link
Member Author

will try to clean up later.

@jieyouxu jieyouxu added the A-HIR Area: The high-level intermediate representation (HIR) label Feb 28, 2024
@matthiaskrgr
Copy link
Member Author

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

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

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue F-unnamed_fields `#![feature(unnamed_fields)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 7, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 11, 2024
…s, r=wesleywiser

Retire the `unnamed_fields` feature for now

`#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature.

However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly.

Fixes rust-lang#117942
Fixes rust-lang#121161
Fixes rust-lang#121263
Fixes rust-lang#121299
Fixes rust-lang#121722
Fixes rust-lang#121799
Fixes rust-lang#126969
Fixes rust-lang#131041

Tracking:
* rust-lang#49804

[^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields
[^2]: rust-lang#49804 (comment)
@bors bors closed this as completed in f496659 Oct 11, 2024
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 18, 2024
…s, r=wesleywiser

Retire the `unnamed_fields` feature for now

`#![feature(unnamed_fields)]` was implemented in part in rust-lang#115131 and rust-lang#115367, however work on that feature has (afaict) stalled and in the mean time there have been some concerns raised (e.g.[^1][^2]) about whether `unnamed_fields` is worthwhile to have in the language, especially in its current desugaring. Because it represents a compiler implementation burden including a new kind of anonymous ADT and additional complication to field selection, and is quite prone to bugs today, I'm choosing to remove the feature.

However, since I'm not one to really write a bunch of words, I'm specifically *not* going to de-RFC this feature. This PR essentially *rolls back* the state of this feature to "RFC accepted but not yet implemented"; however if anyone wants to formally unapprove the RFC from the t-lang side, then please be my guest. I'm just not totally willing to summarize the various language-facing reasons for why this feature is or is not worthwhile, since I'm coming from the compiler side mostly.

Fixes rust-lang#117942
Fixes rust-lang#121161
Fixes rust-lang#121263
Fixes rust-lang#121299
Fixes rust-lang#121722
Fixes rust-lang#121799
Fixes rust-lang#126969
Fixes rust-lang#131041

Tracking:
* rust-lang#49804

[^1]: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Unnamed.20struct.2Funion.20fields
[^2]: rust-lang#49804 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-HIR Area: The high-level intermediate representation (HIR) 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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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