diff options
| author | Gavin Baker <gavinb@antonym.org> | 2016-08-30 11:30:46 +1000 |
|---|---|---|
| committer | Gavin Baker <gavinb@antonym.org> | 2016-09-06 00:20:56 +1000 |
| commit | 8bcd6a33bebb8177781ae07ea1fc0d4a9a679627 (patch) | |
| tree | 936c1db439f901c6ed97f52543fb90b34330bdba /src | |
| parent | d53ea97bfc149da4cdd0fb1fd1beab08295ae45d (diff) | |
| download | rust-8bcd6a33bebb8177781ae07ea1fc0d4a9a679627.tar.gz rust-8bcd6a33bebb8177781ae07ea1fc0d4a9a679627.zip | |
E0517 Update error format #36109
- Fixes #36109 - Part of #35233
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/hir/check_attr.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/E0517.rs | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 6997b5d7702..a3ab5f949e7 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -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 && @@ -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 } diff --git a/src/test/compile-fail/E0517.rs b/src/test/compile-fail/E0517.rs index be06e809915..b79cb2c44af 100644 --- a/src/test/compile-fail/E0517.rs +++ b/src/test/compile-fail/E0517.rs @@ -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 { } |
