Skip to content

Commit 8bcd6a3

Browse files
committed
E0517 Update error format #36109
- Fixes #36109 - Part of #35233
1 parent d53ea97 commit 8bcd6a3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/librustc/hir/check_attr.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ impl<'a> CheckAttrVisitor<'a> {
6262
None => continue,
6363
};
6464

65-
let word: &str = &word.name();
66-
let (message, label) = match word {
65+
let (message, label) = match &*name {
6766
"C" => {
6867
conflicting_reprs += 1;
6968
if target != Target::Struct &&
@@ -80,7 +79,8 @@ impl<'a> CheckAttrVisitor<'a> {
8079
// can be used to modify another repr hint
8180
if target != Target::Struct &&
8281
target != Target::Union {
83-
"attribute should be applied to struct or union"
82+
("attribute should be applied to struct or union",
83+
"a struct or union")
8484
} else {
8585
continue
8686
}

src/test/compile-fail/E0517.rs

+4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99
// except according to those terms.
1010

1111
#[repr(C)] //~ ERROR E0517
12+
//~| requires a struct, enum or union
1213
type Foo = u8;
1314

1415
#[repr(packed)] //~ ERROR E0517
16+
//~| requires a struct
1517
enum Foo2 {Bar, Baz}
1618

1719
#[repr(u8)] //~ ERROR E0517
20+
//~| requires an enum
1821
struct Foo3 {bar: bool, baz: bool}
1922

2023
#[repr(C)] //~ ERROR E0517
24+
//~| requires a struct, enum or union
2125
impl Foo3 {
2226
}
2327

0 commit comments

Comments
 (0)