]> git.lizzy.rs Git - rust.git/commitdiff
Do not account for inner/outer attr
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 7 Jun 2018 00:39:58 +0000 (17:39 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Thu, 7 Jun 2018 00:39:58 +0000 (17:39 -0700)
src/librustc_lint/builtin.rs
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr

index d95e0d77d86d388a140e5491e215ec67219750df..b3b737ab28329beb1cb4c507e2b13e7c4e29c9aa 100644 (file)
@@ -687,18 +687,8 @@ impl EarlyLintPass for BadRepr {
     fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) {
         if attr.name() == "repr" {
             let list = attr.meta_item_list();
-            let outer = match attr.style {
-                ast::AttrStyle::Outer => true,
-                ast::AttrStyle::Inner => false,
-            };
 
-            let repr_str = move |lit: &str| {
-                if outer {
-                    format!("#[repr({})]", lit)
-                } else {
-                    format!("#![repr({})]", lit)
-                }
-            };
+            let repr_str = |lit: &str| { format!("#[repr({})]", lit) };
 
             // Emit warnings with `repr` either has a literal assignment (`#[repr = "C"]`) or
             // no hints (``#[repr]`)
index 3569eecd883f6e869d3c180de5a0813a3b58992c..f351a9e69d01135e018894a56a0a840c53e67a0a 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)]`, `#![repr(rust)]` and `#![repr(transparent)]`
+   = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
    = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.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)]`, `#![repr(rust)]` and `#![repr(transparent)]`
+   = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]`
    = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html>
 
 warning: unused attribute