diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 6c44fb0df23..570ec45557d 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -420,6 +420,31 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } } + + // Emit errors for non-staged-api crates. + if !self.features.staged_api { + if attr.has_name(sym::rustc_deprecated) + || attr.has_name(sym::unstable) + || attr.has_name(sym::stable) + || attr.has_name(sym::rustc_const_unstable) + || attr.has_name(sym::rustc_const_stable) + { + struct_span_err!( + self.sess, + attr.span, + E0734, + "stability attributes may not be used outside of the standard library", + ) + .emit(); + } + } else { + if attr.has_name(sym::deprecated) { + self.sess + .struct_span_err(attr.span, "`#[deprecated]` cannot be used in staged API") + .span_label(attr.span, "use `#[rustc_deprecated]` instead") + .emit(); + } + } } fn visit_item(&mut self, i: &'a ast::Item) { diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 54c52720ef7..bf108f220e0 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -1,7 +1,6 @@ //! A pass that annotates every item and method with its stability level, //! propagating default levels lexically from parent to children ast nodes. -use rustc_ast::Attribute; use rustc_attr::{self as attr, ConstStability, Stability}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::struct_span_err; @@ -113,12 +112,8 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { { let attrs = self.tcx.get_attrs(def_id.to_def_id()); debug!("annotate(id = {:?}, attrs = {:?})", def_id, attrs); - let mut did_error = false; - if !self.tcx.features().staged_api { - did_error = self.forbid_staged_api_attrs(def_id, attrs, inherit_deprecation.clone()); - } - let depr = if did_error { None } else { attr::find_deprecation(&self.tcx.sess, attrs) }; + let depr = attr::find_deprecation(&self.tcx.sess, attrs); let mut is_deprecated = false; if let Some((depr, span)) = &depr { is_deprecated = true; @@ -148,16 +143,15 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { } } - if self.tcx.features().staged_api { - if let Some(a) = attrs.iter().find(|a| a.has_name(sym::deprecated)) { - self.tcx - .sess - .struct_span_err(a.span, "`#[deprecated]` cannot be used in staged API") - .span_label(a.span, "use `#[rustc_deprecated]` instead") - .span_label(item_sp, "") - .emit(); + if !self.tcx.features().staged_api { + // Propagate unstability. This can happen even for non-staged-api crates in case + // -Zforce-unstable-if-unmarked is set. + if let Some(stab) = self.parent_stab { + if inherit_deprecation.yes() && stab.level.is_unstable() { + self.index.stab_map.insert(def_id, stab); + } } - } else { + self.recurse_with_stability_attrs( depr.map(|(d, _)| DeprecationEntry::local(d, def_id)), None, @@ -329,47 +323,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { self.parent_const_stab = orig_parent_const_stab; } } - - // returns true if an error occurred, used to suppress some spurious errors - fn forbid_staged_api_attrs( - &mut self, - def_id: LocalDefId, - attrs: &[Attribute], - inherit_deprecation: InheritDeprecation, - ) -> bool { - // Emit errors for non-staged-api crates. - let unstable_attrs = [ - sym::unstable, - sym::stable, - sym::rustc_deprecated, - sym::rustc_const_unstable, - sym::rustc_const_stable, - ]; - let mut has_error = false; - for attr in attrs { - let name = attr.name_or_empty(); - if unstable_attrs.contains(&name) { - struct_span_err!( - self.tcx.sess, - attr.span, - E0734, - "stability attributes may not be used outside of the standard library", - ) - .emit(); - has_error = true; - } - } - - // Propagate unstability. This can happen even for non-staged-api crates in case - // -Zforce-unstable-if-unmarked is set. - if let Some(stab) = self.parent_stab { - if inherit_deprecation.yes() && stab.level.is_unstable() { - self.index.stab_map.insert(def_id, stab); - } - } - - has_error - } } impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.stderr b/src/test/ui/deprecation/deprecation-in-staged-api.stderr index cf977fa4b7b..5c14f5ed356 100644 --- a/src/test/ui/deprecation/deprecation-in-staged-api.stderr +++ b/src/test/ui/deprecation/deprecation-in-staged-api.stderr @@ -3,8 +3,6 @@ error: `#[deprecated]` cannot be used in staged API | LL | #[deprecated] | ^^^^^^^^^^^^^ use `#[rustc_deprecated]` instead -LL | fn main() {} - | ------------ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-staged_api.stderr b/src/test/ui/feature-gates/feature-gate-staged_api.stderr index a71d26ce16f..951bb5a1740 100644 --- a/src/test/ui/feature-gates/feature-gate-staged_api.stderr +++ b/src/test/ui/feature-gates/feature-gate-staged_api.stderr @@ -1,15 +1,15 @@ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/feature-gate-staged_api.rs:1:1 - | -LL | #![stable(feature = "a", since = "b")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0734]: stability attributes may not be used outside of the standard library --> $DIR/feature-gate-staged_api.rs:8:1 | LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/feature-gate-staged_api.rs:1:1 + | +LL | #![stable(feature = "a", since = "b")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0734`. diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.rs b/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.rs index a01d85515a8..3acfbd0ca23 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.rs @@ -6,25 +6,38 @@ #![rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library +//~| ERROR missing 'since' [E0542] #[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library +//~| ERROR missing 'since' [E0542] mod rustc_deprecated { - mod inner { #![rustc_deprecated()] } - //~^ ERROR stability attributes may not be used outside of the standard library + mod inner { + #![rustc_deprecated()] + //~^ ERROR stability attributes may not be used outside of the standard library + //~| ERROR missing 'since' [E0542] + } - #[rustc_deprecated()] fn f() { } + #[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library + //~| ERROR missing 'since' [E0542] + fn f() {} - #[rustc_deprecated()] struct S; + #[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library - //~| ERROR stability attributes may not be used outside of the standard library + //~| ERROR missing 'since' [E0542] + //~| ERROR missing 'since' [E0542] + struct S; - #[rustc_deprecated()] type T = S; + #[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library + //~| ERROR missing 'since' [E0542] + type T = S; - #[rustc_deprecated()] impl S { } + #[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library + //~| ERROR missing 'since' [E0542] + impl S {} } fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.stderr index 3c4dcfec02b..4ec78f318c2 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-rustc_deprecated.stderr @@ -1,51 +1,94 @@ +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:9 + | +LL | #![rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:21:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:37:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:11:1 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + error[E0734]: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1 | LL | #![rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:10:1 +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1 + | +LL | #![rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:11:1 | LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:13:17 +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:9 | -LL | mod inner { #![rustc_deprecated()] } - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | #![rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:5 +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:21:5 | -LL | #[rustc_deprecated()] fn f() { } +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:19:5 - | -LL | #[rustc_deprecated()] struct S; - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:19:5 - | -LL | #[rustc_deprecated()] struct S; - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:23:5 - | -LL | #[rustc_deprecated()] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library +error[E0542]: missing 'since' --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5 | -LL | #[rustc_deprecated()] impl S { } +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ -For more information about this error, try `rustc --explain E0734`. +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error[E0542]: missing 'since' + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:37:5 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 15 previous errors + +Some errors have detailed explanations: E0542, E0734. +For more information about an error, try `rustc --explain E0542`. diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-stable.rs b/src/test/ui/feature-gates/issue-43106-gating-of-stable.rs index 73ff965307f..621ec01bbe2 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-stable.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-stable.rs @@ -10,21 +10,26 @@ #[stable()] //~^ ERROR stability attributes may not be used outside of the standard library mod stable { - mod inner { #![stable()] } - //~^ ERROR stability attributes may not be used outside of the standard library + mod inner { + #![stable()] + //~^ ERROR stability attributes may not be used outside of the standard library + } - #[stable()] fn f() { } + #[stable()] //~^ ERROR stability attributes may not be used outside of the standard library + fn f() {} - #[stable()] struct S; + #[stable()] //~^ ERROR stability attributes may not be used outside of the standard library - //~| ERROR stability attributes may not be used outside of the standard library + struct S; - #[stable()] type T = S; + #[stable()] //~^ ERROR stability attributes may not be used outside of the standard library + type T = S; - #[stable()] impl S { } + #[stable()] //~^ ERROR stability attributes may not be used outside of the standard library + impl S {} } fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-stable.stderr index 2573db1d684..677fef3a926 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-stable.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-stable.stderr @@ -1,8 +1,32 @@ error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:7:1 + --> $DIR/issue-43106-gating-of-stable.rs:14:9 | -LL | #![stable()] - | ^^^^^^^^^^^^ +LL | #![stable()] + | ^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:18:5 + | +LL | #[stable()] + | ^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:22:5 + | +LL | #[stable()] + | ^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:26:5 + | +LL | #[stable()] + | ^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-stable.rs:30:5 + | +LL | #[stable()] + | ^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:10:1 @@ -11,41 +35,11 @@ LL | #[stable()] | ^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:13:17 + --> $DIR/issue-43106-gating-of-stable.rs:7:1 | -LL | mod inner { #![stable()] } - | ^^^^^^^^^^^^ +LL | #![stable()] + | ^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:16:5 - | -LL | #[stable()] fn f() { } - | ^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:19:5 - | -LL | #[stable()] struct S; - | ^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:19:5 - | -LL | #[stable()] struct S; - | ^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:23:5 - | -LL | #[stable()] type T = S; - | ^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:26:5 - | -LL | #[stable()] impl S { } - | ^^^^^^^^^^^ - -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0734`. diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-unstable.rs b/src/test/ui/feature-gates/issue-43106-gating-of-unstable.rs index d8339b00c12..d507bcd8f15 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-unstable.rs +++ b/src/test/ui/feature-gates/issue-43106-gating-of-unstable.rs @@ -10,21 +10,26 @@ #[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library mod unstable { - mod inner { #![unstable()] } - //~^ ERROR stability attributes may not be used outside of the standard library + mod inner { + #![unstable()] + //~^ ERROR stability attributes may not be used outside of the standard library + } - #[unstable()] fn f() { } + #[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library + fn f() {} - #[unstable()] struct S; + #[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library - //~| ERROR stability attributes may not be used outside of the standard library + struct S; - #[unstable()] type T = S; + #[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library + type T = S; - #[unstable()] impl S { } + #[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library + impl S {} } fn main() {} diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-unstable.stderr index 500675e054c..a2f361878c6 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-unstable.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-unstable.stderr @@ -1,8 +1,32 @@ error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:7:1 + --> $DIR/issue-43106-gating-of-unstable.rs:14:9 | -LL | #![unstable()] - | ^^^^^^^^^^^^^^ +LL | #![unstable()] + | ^^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:18:5 + | +LL | #[unstable()] + | ^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:22:5 + | +LL | #[unstable()] + | ^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:26:5 + | +LL | #[unstable()] + | ^^^^^^^^^^^^^ + +error[E0734]: stability attributes may not be used outside of the standard library + --> $DIR/issue-43106-gating-of-unstable.rs:30:5 + | +LL | #[unstable()] + | ^^^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:10:1 @@ -11,41 +35,11 @@ LL | #[unstable()] | ^^^^^^^^^^^^^ error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:13:17 + --> $DIR/issue-43106-gating-of-unstable.rs:7:1 | -LL | mod inner { #![unstable()] } - | ^^^^^^^^^^^^^^ +LL | #![unstable()] + | ^^^^^^^^^^^^^^ -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:16:5 - | -LL | #[unstable()] fn f() { } - | ^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:19:5 - | -LL | #[unstable()] struct S; - | ^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:19:5 - | -LL | #[unstable()] struct S; - | ^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:23:5 - | -LL | #[unstable()] type T = S; - | ^^^^^^^^^^^^^ - -error[E0734]: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:26:5 - | -LL | #[unstable()] impl S { } - | ^^^^^^^^^^^^^ - -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0734`. diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs index 1f0a7a8f8a5..1627d1d3f9f 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs @@ -3,4 +3,5 @@ #[unstable()] //~ ERROR: stability attributes may not be used #[stable()] //~ ERROR: stability attributes may not be used #[rustc_deprecated()] //~ ERROR: stability attributes may not be used -fn main() { } +//~^ ERROR missing 'since' +fn main() {} diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index 32b0f405d6f..a2b2d3cbe59 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -16,6 +16,13 @@ error[E0734]: stability attributes may not be used outside of the standard libra LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0542]: missing 'since' + --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ -For more information about this error, try `rustc --explain E0734`. +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0542, E0734. +For more information about an error, try `rustc --explain E0542`. diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs index fc2c2b587fe..dfbd9ea5ebf 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs @@ -1,4 +1,5 @@ #[unstable()] //~ ERROR: stability attributes may not be used #[stable()] //~ ERROR: stability attributes may not be used #[rustc_deprecated()] //~ ERROR: stability attributes may not be used -fn main() { } +//~^ ERROR missing 'since' +fn main() {} diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index 7648effc480..9af8d1df4ea 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -16,6 +16,13 @@ error[E0734]: stability attributes may not be used outside of the standard libra LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0542]: missing 'since' + --> $DIR/stability-attribute-non-staged.rs:3:1 + | +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ -For more information about this error, try `rustc --explain E0734`. +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0542, E0734. +For more information about an error, try `rustc --explain E0542`.