From 48e45eec30312e7490f3b24c7692d06f83d47d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 6 Jun 2018 14:18:13 -0700 Subject: [PATCH] Add `transparent` as valid `repr` hint --- src/librustc_lint/builtin.rs | 6 +++--- .../issue-43106-gating-of-builtin-attrs.stderr | 12 ++++++------ src/test/ui/suggestions/repr.stderr | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index fbd153982b7c..b1b1440fbd28 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -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 \ "); } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 013504c554de..2b6396249bb8 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -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 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 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 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 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 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 warning: unused attribute diff --git a/src/test/ui/suggestions/repr.stderr b/src/test/ui/suggestions/repr.stderr index 24a22a81c4aa..efc7e0fd2bed 100644 --- a/src/test/ui/suggestions/repr.stderr +++ b/src/test/ui/suggestions/repr.stderr @@ -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 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 warning: `repr` attribute isn't configurable with a literal