diff options
| author | Ralf Jung <post@ralfj.de> | 2025-01-01 19:09:01 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-01-15 09:41:33 +0100 |
| commit | cf0ab86251f1ab3e11132332695eee73ff746e27 (patch) | |
| tree | 6b9380ad1a5179aad154516d2b54d0bd3b9bb20f /compiler/rustc_attr_data_structures/src | |
| parent | 561a097b653c53d264fb60b417ba07c19ee14f4a (diff) | |
allowed_through_unstable_modules: support showing a deprecation message when the unstable module name is used
Diffstat (limited to 'compiler/rustc_attr_data_structures/src')
| -rw-r--r-- | compiler/rustc_attr_data_structures/src/stability.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/rustc_attr_data_structures/src/stability.rs b/compiler/rustc_attr_data_structures/src/stability.rs index 3c77d4c766c..dfda04387ec 100644 --- a/compiler/rustc_attr_data_structures/src/stability.rs +++ b/compiler/rustc_attr_data_structures/src/stability.rs @@ -101,6 +101,16 @@ impl PartialConstStability { } } +#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)] +#[derive(HashStable_Generic)] +pub enum AllowedThroughUnstableModules { + /// This does not get a deprecation warning. We still generally would prefer people to use the + /// fully stable path, and a warning will likely be emitted in the future. + WithoutDeprecation, + /// Emit the given deprecation warning. + WithDeprecation(Symbol), +} + /// The available stability levels. #[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)] #[derive(HashStable_Generic)] @@ -137,9 +147,8 @@ pub enum StabilityLevel { Stable { /// Rust release which stabilized this feature. since: StableSince, - /// Is this item allowed to be referred to on stable, despite being contained in unstable - /// modules? - allowed_through_unstable_modules: bool, + /// This is `Some` if this item allowed to be referred to on stable via unstable modules. + allowed_through_unstable_modules: Option<AllowedThroughUnstableModules>, }, } |
