diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 751c87a9fe519..9296907465810 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -366,6 +366,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { kind = AnnotationKind::DeprecationProhibited; const_stab_inherit = InheritConstStability::Yes; } + hir::ItemKind::Use(_, _) => { + kind = AnnotationKind::DeprecationProhibited; + } hir::ItemKind::Struct(ref sd, _) => { if let Some(ctor_def_id) = sd.ctor_def_id() { self.annotate( diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index aa841db045ce7..f17687ed6e41b 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -10,11 +10,6 @@ pub use self::global::GlobalAlloc; #[stable(feature = "alloc_layout", since = "1.28.0")] pub use self::layout::Layout; #[stable(feature = "alloc_layout", since = "1.28.0")] -#[deprecated( - since = "1.52.0", - note = "Name does not follow std convention, use LayoutError", - suggestion = "LayoutError" -)] #[allow(deprecated, deprecated_in_future)] pub use self::layout::LayoutErr; #[stable(feature = "alloc_layout_error", since = "1.50.0")] diff --git a/library/std/src/collections/mod.rs b/library/std/src/collections/mod.rs index 889ed3c538035..ba57c5eb3530d 100644 --- a/library/std/src/collections/mod.rs +++ b/library/std/src/collections/mod.rs @@ -433,8 +433,7 @@ pub use self::hash_map::HashMap; #[doc(inline)] pub use self::hash_set::HashSet; #[stable(feature = "rust1", since = "1.0.0")] -// FIXME(#82080) The deprecation here is only theoretical, and does not actually produce a warning. -#[deprecated(note = "moved to `std::ops::Bound`", since = "1.26.0")] +// FIXME(#82080) This has moved but #[deprecated] on `use` is unsupported. #[doc(hidden)] pub use crate::ops::Bound; diff --git a/tests/ui/deprecation/deprecation-sanity.rs b/tests/ui/deprecation/deprecation-sanity.rs index 9ea75b68f81ce..27a8fc3580ae0 100644 --- a/tests/ui/deprecation/deprecation-sanity.rs +++ b/tests/ui/deprecation/deprecation-sanity.rs @@ -39,4 +39,11 @@ impl Default for X { } } +mod inner { + pub struct Y; +} + +#[deprecated] //~ ERROR this `#[deprecated]` annotation has no effect +pub use inner::Y; + fn main() { } diff --git a/tests/ui/deprecation/deprecation-sanity.stderr b/tests/ui/deprecation/deprecation-sanity.stderr index 383212ad9b4b8..e05fbc0aa14cd 100644 --- a/tests/ui/deprecation/deprecation-sanity.stderr +++ b/tests/ui/deprecation/deprecation-sanity.stderr @@ -68,7 +68,13 @@ LL | #[deprecated = "hello"] | = note: `#[deny(useless_deprecated)]` on by default -error: aborting due to 10 previous errors +error: this `#[deprecated]` annotation has no effect + --> $DIR/deprecation-sanity.rs:46:1 + | +LL | #[deprecated] + | ^^^^^^^^^^^^^ help: remove the unnecessary deprecation attribute + +error: aborting due to 11 previous errors Some errors have detailed explanations: E0538, E0539, E0541, E0565. For more information about an error, try `rustc --explain E0538`. diff --git a/tests/ui/imports/unused-import-issue-87973.fixed b/tests/ui/imports/unused-import-issue-87973.fixed index d1167d7d4861a..402655e4fbc88 100644 --- a/tests/ui/imports/unused-import-issue-87973.fixed +++ b/tests/ui/imports/unused-import-issue-87973.fixed @@ -1,5 +1,6 @@ //@ run-rustfix #![deny(unused_imports)] +#![allow(useless_deprecated)] // Check that attributes get removed too. See #87973. //~^ ERROR unused import diff --git a/tests/ui/imports/unused-import-issue-87973.rs b/tests/ui/imports/unused-import-issue-87973.rs index 1b016ff814c6b..0186ddd5ec75f 100644 --- a/tests/ui/imports/unused-import-issue-87973.rs +++ b/tests/ui/imports/unused-import-issue-87973.rs @@ -1,5 +1,6 @@ //@ run-rustfix #![deny(unused_imports)] +#![allow(useless_deprecated)] // Check that attributes get removed too. See #87973. #[deprecated] diff --git a/tests/ui/imports/unused-import-issue-87973.stderr b/tests/ui/imports/unused-import-issue-87973.stderr index a43e92b145802..3628f319411ca 100644 --- a/tests/ui/imports/unused-import-issue-87973.stderr +++ b/tests/ui/imports/unused-import-issue-87973.stderr @@ -1,5 +1,5 @@ error: unused import: `std::fs` - --> $DIR/unused-import-issue-87973.rs:8:5 + --> $DIR/unused-import-issue-87973.rs:9:5 | LL | use std::fs; | ^^^^^^^