Skip to content

Commit

Permalink
E0517 Update error format rust-lang#36109
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinb authored and jakllsch committed Sep 8, 2016
1 parent a0f1251 commit aebac23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ impl<'a> CheckAttrVisitor<'a> {
None => continue,
};

let word: &str = &word.name();
let (message, label) = match word {
let (message, label) = match &*name {
"C" => {
conflicting_reprs += 1;
if target != Target::Struct &&
Expand All @@ -80,7 +79,8 @@ impl<'a> CheckAttrVisitor<'a> {
// can be used to modify another repr hint
if target != Target::Struct &&
target != Target::Union {
"attribute should be applied to struct or union"
("attribute should be applied to struct or union",
"a struct or union")
} else {
continue
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/compile-fail/E0517.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
// except according to those terms.

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

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

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

#[repr(C)] //~ ERROR E0517
//~| requires a struct, enum or union
impl Foo3 {
}

Expand Down

0 comments on commit aebac23

Please sign in to comment.