Skip to content

Commit 39f318b

Browse files
committed
Update error format for E0232
1 parent 499484f commit 39f318b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,12 @@ fn check_on_unimplemented<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
903903
}
904904
}
905905
} else {
906-
span_err!(ccx.tcx.sess, attr.span, E0232,
907-
"this attribute must have a value, \
908-
eg `#[rustc_on_unimplemented = \"foo\"]`")
906+
struct_span_err!(
907+
ccx.tcx.sess, attr.span, E0232,
908+
"this attribute must have a value")
909+
.span_label(attr.span, &format!("attribute requires a value"))
910+
.note(&format!("eg `#[rustc_on_unimplemented = \"foo\"]`"))
911+
.emit();
909912
}
910913
}
911914
}

src/test/compile-fail/E0232.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
#![feature(on_unimplemented)]
1212

13-
#[rustc_on_unimplemented] //~ ERROR E0232
13+
#[rustc_on_unimplemented]
14+
//~^ ERROR E0232
15+
//~| NOTE attribute requires a value
16+
//~| NOTE eg `#[rustc_on_unimplemented = "foo"]`
1417
trait Bar {}
1518

1619
fn main() {

0 commit comments

Comments
 (0)