Expand output and suggestions, fix tests

This commit is contained in:
Esteban Küber 2018-06-06 12:31:43 -07:00
parent 36381fabaf
commit 2c7099baeb
6 changed files with 292 additions and 154 deletions

View file

@ -309,20 +309,25 @@ mod bench {
#[repr = "3900"]
//~^ WARN unused attribute
//~| WARN `repr` attribute isn't configurable with a literal
mod repr {
mod inner { #![repr="3900"] }
//~^ WARN unused attribute
//~| WARN `repr` attribute isn't configurable with a literal
#[repr = "3900"] fn f() { }
//~^ WARN unused attribute
//~| WARN `repr` attribute isn't configurable with a literal
struct S;
#[repr = "3900"] type T = S;
//~^ WARN unused attribute
//~| WARN `repr` attribute isn't configurable with a literal
#[repr = "3900"] impl S { }
//~^ WARN unused attribute
//~| WARN `repr` attribute isn't configurable with a literal
}
#[path = "3800"]

View file

@ -0,0 +1,28 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-pass
#[repr]
//^ WARN `repr` attribute must have a hint
struct _A {}
#[repr = "B"]
//^ WARN `repr` attribute isn't configurable with a literal
struct _B {}
#[repr = "C"]
//^ WARN `repr` attribute isn't configurable with a literal
struct _C {}
#[repr(C)]
struct _D {}
fn main() {}

View file

@ -0,0 +1,24 @@
warning: `repr` attribute must have a hint
--> $DIR/repr.rs:13:1
|
LL | #[repr]
| ^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
--> $DIR/repr.rs:17:1
|
LL | #[repr = "B"]
| ^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
--> $DIR/repr.rs:21:3
|
LL | #[repr = "C"]
| ^^^^^^^^^^ help: give `repr` a hint: `repr(C)`