Description
#82080 laid undetected for years due to the silent inability of #[rustc_deprecated]
to apply properly to re-exports. For now people simply have to remember not to use it with re-exports, but it would be nice if it either 1) worked as expected, or at least 2) caused a compiler error so that it couldn't pass silently.
Open question: should the chosen behavior extend to the stable #[deprecated]
attribute as well? If made to work on re-exports this will be a slight increase to the API surface area, but if made into an error it could potentially be a breaking change (although easily understood and justified as a bugfix).
Test case for #[deprecated]
:
mod foo {
#[deprecated]
pub use crate::bar::Bar;
}
mod bar {
pub struct Bar;
}
fn main() {
let _ = foo::Bar; // should warn
let _ = bar::Bar; // should not warn
}
Once (if) this is fixed, then we should go through the stdlib and use this to replace all of the wrapper functions/type aliases that are currently used to trigger deprecated lints (e.g. the items in #82122 ). Better to have a deprecated path than a full-fledged item and symbol.