Add transparent as valid repr hint

This commit is contained in:
Esteban Küber 2018-06-06 14:18:13 -07:00
parent 3580de8c6d
commit 48e45eec30
3 changed files with 11 additions and 11 deletions

View File

@ -696,7 +696,7 @@ impl EarlyLintPass for BadRepr {
let mut warn = if let Some(ref lit) = attr.value_str() {
// avoid warning about empty `repr` on `#[repr = "foo"]`
let sp = match format!("{}", lit).as_ref() {
"C" | "packed" | "rust" | "u*" | "i*" => {
"C" | "packed" | "rust" | "u*" | "i*" | "transparent" => {
let lo = attr.span.lo() + BytePos(2);
let hi = attr.span.hi() - BytePos(1);
suggested = true;
@ -731,8 +731,8 @@ impl EarlyLintPass for BadRepr {
warn
};
if !suggested {
warn.help("valid hints include `#[repr(C)]`, `#[repr(packed)]` and \
`#[repr(rust)]`");
warn.help("valid hints include `#[repr(C)]`, `#[repr(packed)]`, \
`#[repr(rust)]` and `#[repr(transparent)]`");
warn.note("for more information, visit \
<https://doc.rust-lang.org/nomicon/other-reprs.html>");
}

View File

@ -193,7 +193,7 @@ LL | mod inner { #![repr="3900"] }
| ^^^^^^^^^^^^^^^ needs a hint
|
= note: #[warn(bad_repr)] on by default
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -202,7 +202,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #[repr = "3900"] fn f() { }
| ^^^^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -211,7 +211,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #[repr = "3900"] type T = S;
| ^^^^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -220,7 +220,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #[repr = "3900"] impl S { }
| ^^^^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -229,7 +229,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #[repr = "3900"]
| ^^^^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -238,7 +238,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #![repr = "3900"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: unused attribute

View File

@ -5,7 +5,7 @@ LL | #[repr]
| ^^^^^^^ needs a hint
|
= note: #[warn(bad_repr)] on by default
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal
@ -14,7 +14,7 @@ warning: `repr` attribute isn't configurable with a literal
LL | #[repr = "B"]
| ^^^^^^^^^^^^^ needs a hint
|
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]` and `#[repr(rust)]`
= help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
= note: for more information, visit <https://doc.rust-lang.org/nomicon/other-reprs.html>
warning: `repr` attribute isn't configurable with a literal