diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 7c125c3a8983e..5c7bad443c7e9 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -171,7 +171,19 @@ impl OptimizeAttr { } } -#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, StableHash, PrintAttribute)] +#[derive( + PartialEq, + Eq, + Debug, + PartialOrd, + Ord, + Encodable, + Decodable, + Copy, + Clone, + StableHash, + PrintAttribute +)] pub enum ReprAttr { ReprInt(IntType), ReprRust, @@ -187,7 +199,7 @@ pub enum TransparencyError { MultipleTransparencyAttrs(Span, Span), } -#[derive(Eq, PartialEq, Debug, Copy, Clone)] +#[derive(Eq, PartialEq, Debug, Copy, Clone, PartialOrd, Ord)] #[derive(Encodable, Decodable, StableHash, PrintAttribute)] pub enum IntType { SignedInt(ast::IntTy), diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index d38b1cf47bd6f..dd110a83f98a7 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -272,6 +272,30 @@ declare_lint! { }; } +declare_lint! { + /// The `repeated_reprs` lint detects when the same representation is + /// specified more than once in a `#[repr(..)]` attribute. + /// + /// ### Example + /// + /// ```rust + /// #[repr(C)] + /// #[repr(C)] + /// enum Foo { A } + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// While some representations may be specified more than once, the compiler + /// will reject repeated uses of some others. For consistency, prefer to + /// only specify the representation once. + pub REPEATED_REPRS, + Warn, + "detects repeated representations in `#[repr(..)]` attributes", +} + declare_lint! { /// The `meta_variable_misuse` lint detects possible meta-variable misuse /// in macro definitions. diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 079fdd923ac0d..3083cdc920683 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -40,7 +40,8 @@ use rustc_session::errors::feature_err; use rustc_session::lint; use rustc_session::lint::builtin::{ CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, MALFORMED_DIAGNOSTIC_ATTRIBUTES, - MALFORMED_DIAGNOSTIC_FORMAT_LITERALS, MISPLACED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES, + MALFORMED_DIAGNOSTIC_FORMAT_LITERALS, MISPLACED_DIAGNOSTIC_ATTRIBUTES, REPEATED_REPRS, + UNUSED_ATTRIBUTES, }; use rustc_span::edition::Edition; use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym}; @@ -1236,20 +1237,49 @@ impl<'tcx> CheckAttrVisitor<'tcx> { ReprAttr::ReprC => { is_c = true; } - ReprAttr::ReprAlign(..) => {} - ReprAttr::ReprPacked(_) => {} + ReprAttr::ReprAlign(..) => (), + ReprAttr::ReprPacked(..) => (), ReprAttr::ReprSimd => { is_simd = true; } ReprAttr::ReprTransparent => { is_transparent = true; } - ReprAttr::ReprInt(_) => { + ReprAttr::ReprInt(..) => { int_reprs += 1; } }; } + if !reprs.is_empty() { + let sorted_reprs = { + let mut to_sort = reprs.to_owned(); + to_sort.sort(); + to_sort + }; + + // To collect all duplicates, get subslices where all of the elements of the subslice + // are equal, then filter out all those whose length is not 1. We could return warnings + // for each of them, but that's annoyingly excessive. So we instead collect all spans in + // one big Vec. + let spans: Vec = sorted_reprs + .chunk_by(|(a, _), (b, _)| a == b) + .map(ToOwned::to_owned) + .filter(|slice| slice.len() != 1) + .flatten() + .map(|(_, span)| span) + .collect(); + + if !spans.is_empty() { + self.tcx.emit_node_span_lint( + REPEATED_REPRS, + hir_id, + spans, + diagnostics::RepeatedRepr, + ); + } + } + // Just point at all repr hints if there are any incompatibilities. // This is not ideal, but tracking precisely which ones are at fault is a huge hassle. let hint_spans = reprs.iter().map(|(_, span)| *span); diff --git a/compiler/rustc_passes/src/diagnostics.rs b/compiler/rustc_passes/src/diagnostics.rs index f6c4b0cf77d12..c38b56608fcf8 100644 --- a/compiler/rustc_passes/src/diagnostics.rs +++ b/compiler/rustc_passes/src/diagnostics.rs @@ -695,6 +695,11 @@ pub(crate) struct TransparentIncompatible { pub target: String, } +#[derive(Diagnostic)] +#[diag("`#[repr(..)]` attribute is specified more than once")] +#[note("for consistency, only specify the representation once")] +pub(crate) struct RepeatedRepr; + #[derive(Diagnostic)] #[diag("deprecated attribute must be paired with either stable or unstable attribute", code = E0549)] pub(crate) struct DeprecatedAttribute { diff --git a/tests/ui/attributes/issue-100631.rs b/tests/ui/attributes/issue-100631.rs index 0fefcf83fd516..9a30691a39ec3 100644 --- a/tests/ui/attributes/issue-100631.rs +++ b/tests/ui/attributes/issue-100631.rs @@ -2,6 +2,7 @@ // can reasonably deal with multiple attributes. // `repr` will use `TyCtxt::get_attrs` since it's `DuplicatesOk`. #[repr(C)] //~ ERROR: unsupported representation for zero-variant enum [E0084] +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] #[repr(C)] enum Foo {} diff --git a/tests/ui/attributes/issue-100631.stderr b/tests/ui/attributes/issue-100631.stderr index b2bd0a9632513..0ecc19ae85b3d 100644 --- a/tests/ui/attributes/issue-100631.stderr +++ b/tests/ui/attributes/issue-100631.stderr @@ -1,12 +1,24 @@ -error[E0084]: unsupported representation for zero-variant enum +warning: `#[repr(..)]` attribute is specified more than once --> $DIR/issue-100631.rs:4:8 | LL | #[repr(C)] | ^ +LL | LL | #[repr(C)] + | ^ + | + = note: for consistency, only specify the representation once + = note: `#[warn(repeated_reprs)]` on by default + +error[E0084]: unsupported representation for zero-variant enum + --> $DIR/issue-100631.rs:4:8 + | +LL | #[repr(C)] + | ^ +... LL | enum Foo {} | -------- zero-variant enum -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0084`. diff --git a/tests/ui/lint/unused/unused-attr-duplicate.rs b/tests/ui/lint/unused/unused-attr-duplicate.rs index 54c040f4bcac4..c013041ed4159 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.rs +++ b/tests/ui/lint/unused/unused-attr-duplicate.rs @@ -64,8 +64,7 @@ fn t1() {} #[must_use = "some message"] //~^ ERROR unused attribute //~| WARN this was previously accepted -// No warnings for #[repr], would require more logic. -#[repr(C)] +#[repr(C)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] #[repr(C)] #[non_exhaustive] #[non_exhaustive] //~ ERROR unused attribute diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr index 3e4cb99a09e34..6e4f7d23604c2 100644 --- a/tests/ui/lint/unused/unused-attr-duplicate.stderr +++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr @@ -16,6 +16,17 @@ note: the lint level is defined here LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/unused-attr-duplicate.rs:67:8 + | +LL | #[repr(C)] + | ^ +LL | #[repr(C)] + | ^ + | + = note: for consistency, only specify the representation once + = note: `#[warn(repeated_reprs)]` on by default + error: unused attribute --> $DIR/unused-attr-duplicate.rs:14:1 | @@ -193,128 +204,128 @@ LL | #[must_use] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:71:1 + --> $DIR/unused-attr-duplicate.rs:70:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:70:1 + --> $DIR/unused-attr-duplicate.rs:69:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:77:1 + --> $DIR/unused-attr-duplicate.rs:76:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:76:1 + --> $DIR/unused-attr-duplicate.rs:75:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:81:1 + --> $DIR/unused-attr-duplicate.rs:80:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:80:1 + --> $DIR/unused-attr-duplicate.rs:79:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:84:1 + --> $DIR/unused-attr-duplicate.rs:83:1 | LL | #[cold] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:83:1 + --> $DIR/unused-attr-duplicate.rs:82:1 | LL | #[cold] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:86:1 + --> $DIR/unused-attr-duplicate.rs:85:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:85:1 + --> $DIR/unused-attr-duplicate.rs:84:1 | LL | #[track_caller] | ^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:100:1 + --> $DIR/unused-attr-duplicate.rs:99:1 | LL | #[export_name = "exported_symbol_name2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:99:1 + --> $DIR/unused-attr-duplicate.rs:98:1 | LL | #[export_name = "exported_symbol_name"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:105:1 + --> $DIR/unused-attr-duplicate.rs:104:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:104:1 + --> $DIR/unused-attr-duplicate.rs:103:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:109:1 + --> $DIR/unused-attr-duplicate.rs:108:1 | LL | #[used] | ^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:108:1 + --> $DIR/unused-attr-duplicate.rs:107:1 | LL | #[used] | ^^^^^^^ error: unused attribute - --> $DIR/unused-attr-duplicate.rs:113:1 + --> $DIR/unused-attr-duplicate.rs:112:1 | LL | #[link_section = "__DATA,__mod_init_func"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:112:1 + --> $DIR/unused-attr-duplicate.rs:111:1 | LL | #[link_section = "__TEXT,__text"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: unused attribute - --> $DIR/unused-attr-duplicate.rs:94:5 + --> $DIR/unused-attr-duplicate.rs:93:5 | LL | #[link_name = "rust_dbg_extern_identity_u32"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/unused-attr-duplicate.rs:93:5 + --> $DIR/unused-attr-duplicate.rs:92:5 | LL | #[link_name = "this_does_not_exist"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! -error: aborting due to 25 previous errors +error: aborting due to 25 previous errors; 1 warning emitted diff --git a/tests/ui/repr/conflicting-repr-hints.rs b/tests/ui/repr/conflicting-repr-hints.rs index ed82b6a742c8d..81a94aad78ff6 100644 --- a/tests/ui/repr/conflicting-repr-hints.rs +++ b/tests/ui/repr/conflicting-repr-hints.rs @@ -43,7 +43,7 @@ struct I(i32); //~ ERROR type has conflicting packed representation hints #[repr(packed)] struct J(i32); //~ ERROR type has conflicting packed representation hints -#[repr(packed, packed(1))] +#[repr(packed, packed(1))] //~ WARN attribute is specified more than once struct K(i32); #[repr(packed, align(8))] diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr index 4da3d454e037d..8f2655fd716f1 100644 --- a/tests/ui/repr/conflicting-repr-hints.stderr +++ b/tests/ui/repr/conflicting-repr-hints.stderr @@ -17,6 +17,15 @@ LL | #[repr(u32, u64)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #68585 +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/conflicting-repr-hints.rs:46:8 + | +LL | #[repr(packed, packed(1))] + | ^^^^^^ ^^^^^^^^^ + | + = note: for consistency, only specify the representation once + = note: `#[warn(repeated_reprs)]` on by default + error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:29:1 | @@ -77,7 +86,7 @@ error[E0587]: type has conflicting packed and align representation hints LL | pub union U { | ^^^^^^^^^^^ -error: aborting due to 12 previous errors +error: aborting due to 12 previous errors; 1 warning emitted Some errors have detailed explanations: E0566, E0587, E0634. For more information about an error, try `rustc --explain E0566`. diff --git a/tests/ui/repr/repr-repeated-attrs.rs b/tests/ui/repr/repr-repeated-attrs.rs new file mode 100644 index 0000000000000..7306b9192f09e --- /dev/null +++ b/tests/ui/repr/repr-repeated-attrs.rs @@ -0,0 +1,69 @@ +// Tests to ensure we warn on repeated `#[repr(..)]` attributes. + +#[repr(transparent, transparent)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR transparent struct cannot have other repr hints +#[repr(transparent)] +struct SeveralTransparentReprs(*mut u8); + +#[repr(transparent)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR transparent struct cannot have other repr hints +#[repr(transparent)] +struct MultilineOnly(*mut u8); + +#[repr(Rust, Rust)] +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +struct SeveralRustReprs(u8); + +#[repr(C, C)] +//~^ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +#[repr(C, C, C)] +struct SeveralC(u8); + +#[repr(u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR conflicting representation hints +//~| WARN this was previously accepted +enum SeveralPrimitiveRerprs { + Variant, +} + +#[repr(C, C, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR conflicting representation hints +//~| WARN this was previously accepted +#[repr(C, u8, u8)] +enum SeveralCAndPrims { + Variant(u8), +} + +#[repr(Rust, u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR conflicting representation hints +//~^^ ERROR conflicting representation hints +//~| WARN this was previously accepted +enum RustAndPrimDisallowed { + Variant(u8), +} + +#[repr(u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR conflicting representation hints +//~| WARN this was previously accepted +#[repr(u16)] +enum ConflictingPrimReprs { + Variant, +} + +#[repr(C, u8)] +//~^ ERROR conflicting representation hints +//~| WARN this was previously accepted +enum CWithIntsCausesFCW1 { + A, + B, +} + +#[repr(C, C, u8, u8, u8)] //~ WARN `#[repr(..)]` attribute is specified more than once [repeated_reprs] +//~^ ERROR conflicting representation hints +//~| WARN this was previously accepted +enum CWithIntsCausesFCW2 { + A, + B, +} + +fn main() {} diff --git a/tests/ui/repr/repr-repeated-attrs.stderr b/tests/ui/repr/repr-repeated-attrs.stderr new file mode 100644 index 0000000000000..a0b8b1d7da3cc --- /dev/null +++ b/tests/ui/repr/repr-repeated-attrs.stderr @@ -0,0 +1,246 @@ +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:3:8 + | +LL | #[repr(transparent, transparent)] + | ^^^^^^^^^^^ ^^^^^^^^^^^ +LL | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ + | + = note: for consistency, only specify the representation once + = note: `#[warn(repeated_reprs)]` on by default + +error[E0692]: transparent struct cannot have other repr hints + --> $DIR/repr-repeated-attrs.rs:3:8 + | +LL | #[repr(transparent, transparent)] + | ^^^^^^^^^^^ ^^^^^^^^^^^ +LL | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:8:8 + | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ +LL | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ + | + = note: for consistency, only specify the representation once + +error[E0692]: transparent struct cannot have other repr hints + --> $DIR/repr-repeated-attrs.rs:8:8 + | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ +LL | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:13:8 + | +LL | #[repr(Rust, Rust)] + | ^^^^ ^^^^ + | + = note: for consistency, only specify the representation once + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:17:8 + | +LL | #[repr(C, C)] + | ^ ^ +LL | +LL | #[repr(C, C, C)] + | ^ ^ ^ + | + = note: for consistency, only specify the representation once + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:22:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ + | + = note: for consistency, only specify the representation once + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:22:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:29:8 + | +LL | #[repr(C, C, u8)] + | ^ ^ ^^ +... +LL | #[repr(C, u8, u8)] + | ^ ^^ ^^ + | + = note: for consistency, only specify the representation once + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:29:8 + | +LL | #[repr(C, C, u8)] + | ^ ^ ^^ +... +LL | #[repr(C, u8, u8)] + | ^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:37:14 + | +LL | #[repr(Rust, u8, u8)] + | ^^ ^^ + | + = note: for consistency, only specify the representation once + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:37:8 + | +LL | #[repr(Rust, u8, u8)] + | ^^^^ ^^ ^^ + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:37:8 + | +LL | #[repr(Rust, u8, u8)] + | ^^^^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:45:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ + | + = note: for consistency, only specify the representation once + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:45:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ +... +LL | #[repr(u16)] + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:53:8 + | +LL | #[repr(C, u8)] + | ^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + +warning: `#[repr(..)]` attribute is specified more than once + --> $DIR/repr-repeated-attrs.rs:61:8 + | +LL | #[repr(C, C, u8, u8, u8)] + | ^ ^ ^^ ^^ ^^ + | + = note: for consistency, only specify the representation once + +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:61:8 + | +LL | #[repr(C, C, u8, u8, u8)] + | ^ ^ ^^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + +error: aborting due to 9 previous errors; 9 warnings emitted + +Some errors have detailed explanations: E0566, E0692. +For more information about an error, try `rustc --explain E0566`. +Future incompatibility report: Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:22:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:29:8 + | +LL | #[repr(C, C, u8)] + | ^ ^ ^^ +... +LL | #[repr(C, u8, u8)] + | ^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:37:8 + | +LL | #[repr(Rust, u8, u8)] + | ^^^^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:45:8 + | +LL | #[repr(u8, u8)] + | ^^ ^^ +... +LL | #[repr(u16)] + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:53:8 + | +LL | #[repr(C, u8)] + | ^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/repr-repeated-attrs.rs:61:8 + | +LL | #[repr(C, C, u8, u8, u8)] + | ^ ^ ^^ ^^ ^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #68585 + = note: `#[deny(conflicting_repr_hints)]` (part of `#[deny(future_incompatible)]`) on by default +