Skip to content

Commit 161cb36

Browse files
committed
Update error message for E0084
1 parent 43c090e commit 161cb36

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/librustc_typeck/check/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1245,8 +1245,11 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
12451245
let hint = *ccx.tcx.lookup_repr_hints(def_id).get(0).unwrap_or(&attr::ReprAny);
12461246

12471247
if hint != attr::ReprAny && vs.is_empty() {
1248-
span_err!(ccx.tcx.sess, sp, E0084,
1249-
"unsupported representation for zero-variant enum");
1248+
struct_span_err!(
1249+
ccx.tcx.sess, sp, E0084,
1250+
"unsupported representation for zero-variant enum")
1251+
.span_label(sp, &format!("unsupported enum representation"))
1252+
.emit();
12501253
}
12511254

12521255
let repr_type_ty = ccx.tcx.enum_repr_type(Some(&hint)).to_ty(ccx.tcx);

src/test/compile-fail/E0084.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// except according to those terms.
1010

1111
#[repr(i32)]
12-
enum Foo {} //~ ERROR E0084
12+
enum Foo {}
13+
//~^ ERROR E0084
14+
//~| unsupported enum representation
1315

1416
fn main() {
1517
}

0 commit comments

Comments
 (0)