You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// https://doc.rust-lang.org/error_codes/E0063.htmlstructFoo{x:i32,y:i32,z:i32,}fnmain(){let x = Foo{x:0,y:1};// { dg-error "constructor is missing fields" }}
I expected to see this happen:
Emit error message, similiar to rustc .i.e.,
emit the name of initializer & field
Error message emitted by rustc:
error[E0063]: missing field `y` in initializer of `Foo`
--> <source>:7:13
|
7 | let x = Foo{x:0};// error: missing field: `y`
| ^^^ missing `y`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0063`.Compiler returned:1
Instead, this happened:
No initializer & field information in error messge.
This is the output of gccrs:
- missing field `y` in initializer of `Foo` // rustc output+ error: constructor is missing fields [E0063] // gccrs output
➜ gccrs-build gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/missing_constructor_fields.rs
/home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/missing_constructor_fields.rs:9:13: error: constructor is missing fields[E0063]9 | let x = Foo{x:0,y:1};// { dg-error "constructor is missing fields" }
| ^~~
Analyzing compilation unit
Time variable usr sys wall GGCTOTAL:0.000.000.00146k
Extra diagnostic checks enabled; compiler may run slowly.Configure with --enable-checking=release to disable checks.
Meta
What version of Rust GCC were you using, git sha 5437803.
rust_error_at (struct_expr.get_locus (),
- "constructor is missing fields");+ "missing field %qs in initializer of %qs",+ variant->get_fields ().at (0)->get_name ().c_str (), // This need to be changed+ struct_path_resolved->get_name ().c_str ()); // This is giving right struct name
But @CohenArthur said, we need some more changes to do this....
Improving Error Constructor is missing fields -
E0063
compiler-explorer
I tried this code from
E0063
:I expected to see this happen:
initializer
&field
Instead, this happened:
initializer
&field
information in error messge.Meta
The text was updated successfully, but these errors were encountered: