Skip to content

Commit 889080d

Browse files
committed
Revert "middle: add implies_by to #[unstable]"
This reverts commit 224aec2.
1 parent 321f1f7 commit 889080d

12 files changed

+3
-150
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,6 @@ pub enum StabilityLevel {
142142
/// Relevant `rust-lang/rust` issue.
143143
issue: Option<NonZeroU32>,
144144
is_soft: bool,
145-
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
146-
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
147-
/// contained a item.
148-
///
149-
/// ```pseudo-Rust
150-
/// #[unstable(feature = "foo", issue = "...")]
151-
/// fn foo() {}
152-
/// #[unstable(feature = "foo", issue = "...")]
153-
/// fn foobar() {}
154-
/// ```
155-
///
156-
/// ...becomes...
157-
///
158-
/// ```pseudo-Rust
159-
/// #[stable(feature = "foo", since = "1.XX.X")]
160-
/// fn foo() {}
161-
/// #[unstable(feature = "foobar", issue = "...", implied_by = "foo")]
162-
/// fn foobar() {}
163-
/// ```
164-
implied_by: Option<Symbol>,
165145
},
166146
/// `#[stable]`
167147
Stable {
@@ -302,7 +282,6 @@ where
302282
let mut issue = None;
303283
let mut issue_num = None;
304284
let mut is_soft = false;
305-
let mut implied_by = None;
306285
for meta in metas {
307286
let Some(mi) = meta.meta_item() else {
308287
handle_errors(
@@ -368,11 +347,6 @@ where
368347
}
369348
is_soft = true;
370349
}
371-
sym::implied_by => {
372-
if !get(mi, &mut implied_by) {
373-
continue 'outer;
374-
}
375-
}
376350
_ => {
377351
handle_errors(
378352
&sess.parse_sess,
@@ -401,7 +375,6 @@ where
401375
reason: UnstableReason::from_opt_reason(reason),
402376
issue: issue_num,
403377
is_soft,
404-
implied_by,
405378
};
406379
if sym::unstable == meta_name {
407380
stab = Some((Stability { level, feature }, attr.span));

compiler/rustc_middle/src/middle/stability.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,7 @@ impl<'tcx> TyCtxt<'tcx> {
423423

424424
match stability {
425425
Some(Stability {
426-
level: attr::Unstable { reason, issue, is_soft, implied_by },
427-
feature,
428-
..
426+
level: attr::Unstable { reason, issue, is_soft }, feature, ..
429427
}) => {
430428
if span.allows_unstable(feature) {
431429
debug!("stability: skipping span={:?} since it is internal", span);
@@ -435,13 +433,6 @@ impl<'tcx> TyCtxt<'tcx> {
435433
return EvalResult::Allow;
436434
}
437435

438-
// If this item was previously part of a now-stabilized feature which is still
439-
// active (i.e. the user hasn't removed the attribute for the stabilized feature
440-
// yet) then allow use of this item.
441-
if let Some(implied_by) = implied_by && self.features().active(implied_by) {
442-
return EvalResult::Allow;
443-
}
444-
445436
// When we're compiling the compiler itself we may pull in
446437
// crates from crates.io, but those crates may depend on other
447438
// crates also pulled in from crates.io. We want to ideally be

compiler/rustc_passes/src/stability.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
634634
reason: UnstableReason::Default,
635635
issue: NonZeroU32::new(27812),
636636
is_soft: false,
637-
implied_by: None,
638637
},
639638
feature: sym::rustc_private,
640639
};

compiler/rustc_resolve/src/macros.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -796,16 +796,9 @@ impl<'a> Resolver<'a> {
796796
) {
797797
let span = path.span;
798798
if let Some(stability) = &ext.stability {
799-
if let StabilityLevel::Unstable { reason, issue, is_soft, implied_by } = stability.level
800-
{
799+
if let StabilityLevel::Unstable { reason, issue, is_soft } = stability.level {
801800
let feature = stability.feature;
802-
803-
let is_allowed = |feature| {
804-
self.active_features.contains(&feature) || span.allows_unstable(feature)
805-
};
806-
let allowed_by_implication =
807-
implied_by.map(|feature| is_allowed(feature)).unwrap_or(false);
808-
if !is_allowed(feature) && !allowed_by_implication {
801+
if !self.active_features.contains(&feature) && !span.allows_unstable(feature) {
809802
let lint_buffer = &mut self.lint_buffer;
810803
let soft_handler =
811804
|lint, span, msg: &_| lint_buffer.buffer_lint(lint, node_id, span, msg);

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,6 @@ symbols! {
800800
impl_lint_pass,
801801
impl_macros,
802802
impl_trait_in_bindings,
803-
implied_by,
804803
import,
805804
import_shadowing,
806805
imported_main,

src/test/ui/stability-attribute/auxiliary/stability-attribute-implies.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-no-feature.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-no-feature.stderr

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-using-stable.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-using-stable.stderr

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)