mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 12:39:31 +03:00
@@ -62,8 +62,7 @@ fn check_repr(&self, attr: &ast::Attribute, target: Target) {
|
||||
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 @@ fn check_repr(&self, attr: &ast::Attribute, target: Target) {
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user