]> git.lizzy.rs Git - rust.git/commitdiff
Add `transparent` as valid `repr` hint
authorEsteban Küber <esteban@kuber.com.ar>
Wed, 6 Jun 2018 21:18:13 +0000 (14:18 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Wed, 6 Jun 2018 21:25:50 +0000 (14:25 -0700)
src/librustc_lint/builtin.rs
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr
src/test/ui/suggestions/repr.stderr

index fbd153982b7c40f91994d63302739e6541aba3de..b1b1440fbd282cf0d2e8af6ae8457e7c5162e746 100644 (file)
@@ -696,7 +696,7 @@ fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
                 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 @@ fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
                     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>");
                 }
index 013504c554defe99e53e6d36076a89ebe54a83eb..2b6396249bb82b5bb320f57163839398bb19121f 100644 (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
index 24a22a81c4aa0e511b69014ddb7361ea8cd5b634..efc7e0fd2bed50daad1ff8905c2e0c8509cd97ed 100644 (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