Skip to content

Instantly share code, notes, and snippets.

@trixnz

trixnz/e0062.rs Secret

Last active August 4, 2016 20:29
Show Gist options
  • Save trixnz/ad11e68687529e164427df8f8eb63116 to your computer and use it in GitHub Desktop.
Save trixnz/ad11e68687529e164427df8f8eb63116 to your computer and use it in GitHub Desktop.
let mut err = struct_span_err!(self.tcx.sess,
field.name.span,
E0062,
"field `{}` specified more than once",
field.name.node);
err.span_label(field.name.span, &format!("used more than once"));
if let Some(prev_span) = seen_fields.get(&field.name.node) {
err.span_label(*prev_span, &format!("first use of `{}`", field.name.node));
}
err.emit();
error[E0062]: field `x` specified more than once
--> src\test\compile-fail\E0062.rs:18:9
|
17 | x: 0,
| ---- first use of `x`
18 | x: 0, //~ ERROR E0062
| ^ used more than once
src\test\compile-fail\E0062.rs:18:9: 18:10 error: field `x` specified more than once [E0062]
src\test\compile-fail\E0062.rs:18 x: 0,
^~~~
src\test\compile-fail\E0062.rs:18:9: 18:10 error: field `x` specified more than once [E0062]
src\test\compile-fail\E0062.rs:18 x: 0, //~ ERROR E0062
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment