Skip to content

Fatal Error: used more than once - [E0062] #2381

Closed
@MahadMuhammad

Description

@MahadMuhammad

Fatal Error - used more than once

  • Fixing this error will improve gccrs to emit error codes similiar to rustc.
  • You can view the same on compiler-explorer

I tried this code from E0062:

struct Foo {
    x: i32,
}

fn main() {
    let x = Foo {
                x: 0,
                x: 0, // error: field `x` specified more than once
            };
}

I expected to see this happen:

  • Give error like rustc
error[E0062]: field `x` specified more than once
 --> <source>:8:17
  |
7 |                 x: 0,
  |                 ---- first use of `x`
8 |                 x: 0, // error: field `x` specified more than once
  |                 ^ used more than once

error: aborting due to previous error

For more information about this error, try `rustc --explain E0062`.
Compiler returned: 1

Instead, this happened:

  • It gives fatal error
<source>:8:17: fatal error: used more than once
    8 |                 x: 0, // error: field `x` specified more than once
      |                 ^
compilation terminated.
Compiler returned: 1

Meta

  • What version of Rust GCC were you using, git sha 5406b63.
  • Godbolt version : gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions