diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index 466ab82031d..5a79cf68f11 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -679,14 +679,6 @@ where continue; } - if let Some((_, span)) = &depr { - struct_span_err!(diagnostic, attr.span, E0550, "multiple deprecated attributes") - .span_label(attr.span, "repeated deprecation attribute") - .span_label(*span, "first deprecation attribute") - .emit(); - break; - } - // FIXME(jhpratt) remove this eventually if attr.has_name(sym::rustc_deprecated) { diagnostic diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index e588385cfca..2d94a028ebe 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -304,8 +304,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ List: r#"/*opt*/ since = "version", /*opt*/ note = "reason""#, NameValueStr: "reason" ), - // This has special duplicate handling in E0550 to handle duplicates with rustc_deprecated - DuplicatesOk + ErrorFollowing ), // Crate properties: @@ -463,10 +462,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== ungated!(feature, CrateLevel, template!(List: "name1, name2, ..."), DuplicatesOk), - // DuplicatesOk since it has its own validation + // FIXME(jhpratt) remove this eventually ungated!( rustc_deprecated, Normal, - template!(List: r#"since = "version", note = "...""#), DuplicatesOk // See E0550 + template!(List: r#"since = "version", note = "...""#), ErrorFollowing ), // DuplicatesOk since it has its own validation ungated!( diff --git a/src/test/ui/deprecation/deprecation-sanity.rs b/src/test/ui/deprecation/deprecation-sanity.rs index 4fc3fddadb9..9ea75b68f81 100644 --- a/src/test/ui/deprecation/deprecation-sanity.rs +++ b/src/test/ui/deprecation/deprecation-sanity.rs @@ -24,7 +24,7 @@ mod bogus_attribute_types_1 { } #[deprecated(since = "a", note = "b")] -#[deprecated(since = "a", note = "b")] //~ ERROR multiple deprecated attributes +#[deprecated(since = "a", note = "b")] //~ ERROR multiple `deprecated` attributes fn multiple1() { } #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr index 7e70c35eeab..973c672df91 100644 --- a/src/test/ui/deprecation/deprecation-sanity.stderr +++ b/src/test/ui/deprecation/deprecation-sanity.stderr @@ -1,3 +1,15 @@ +error: multiple `deprecated` attributes + --> $DIR/deprecation-sanity.rs:27:1 + | +LL | #[deprecated(since = "a", note = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/deprecation-sanity.rs:26:1 + | +LL | #[deprecated(since = "a", note = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0541]: unknown meta item 'reason' --> $DIR/deprecation-sanity.rs:4:43 | @@ -40,14 +52,6 @@ error[E0565]: item in `deprecated` must be a key/value pair LL | #[deprecated("test")] | ^^^^^^ -error[E0550]: multiple deprecated attributes - --> $DIR/deprecation-sanity.rs:27:1 - | -LL | #[deprecated(since = "a", note = "b")] - | -------------------------------------- first deprecation attribute -LL | #[deprecated(since = "a", note = "b")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute - error[E0538]: multiple 'since' items --> $DIR/deprecation-sanity.rs:30:27 | @@ -64,5 +68,5 @@ LL | #[deprecated = "hello"] error: aborting due to 10 previous errors -Some errors have detailed explanations: E0538, E0541, E0550, E0551, E0565. +Some errors have detailed explanations: E0538, E0541, E0551, E0565. For more information about an error, try `rustc --explain E0538`. diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs index f37a8f328a7..cc30e6ab9a9 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs @@ -59,7 +59,7 @@ fn multiple3() { } #[stable(feature = "a", since = "b")] //~ ERROR invalid stability version found #[deprecated(since = "b", note = "text")] -#[deprecated(since = "b", note = "text")] //~ ERROR multiple deprecated attributes +#[deprecated(since = "b", note = "text")] //~ ERROR multiple `deprecated` attributes #[rustc_const_unstable(feature = "c", issue = "none")] #[rustc_const_unstable(feature = "d", issue = "none")] //~ ERROR multiple stability levels pub const fn multiple4() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index 9e2d9f27084..fcb1eefddbc 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -1,3 +1,15 @@ +error: multiple `deprecated` attributes + --> $DIR/stability-attribute-sanity.rs:62:1 + | +LL | #[deprecated(since = "b", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute + | +note: attribute also specified here + --> $DIR/stability-attribute-sanity.rs:61:1 + | +LL | #[deprecated(since = "b", note = "text")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0541]: unknown meta item 'reason' --> $DIR/stability-attribute-sanity.rs:8:42 | @@ -82,14 +94,6 @@ error[E0544]: multiple stability levels LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0550]: multiple deprecated attributes - --> $DIR/stability-attribute-sanity.rs:62:1 - | -LL | #[deprecated(since = "b", note = "text")] - | ----------------------------------------- first deprecation attribute -LL | #[deprecated(since = "b", note = "text")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute - error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:64:1 | @@ -128,5 +132,5 @@ LL | #[stable(feature = "a", since = "1.0.0")] error: aborting due to 20 previous errors -Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0544, E0546, E0547, E0549, E0550. +Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0544, E0546, E0547, E0549. For more information about an error, try `rustc --explain E0539`.