File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
compiler/rustc_passes/src
tests/ui/stability-attribute Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,12 @@ impl<'tcx> Visitor<'tcx> for LibFeatureCollector<'tcx> {
137137}
138138
139139fn lib_features ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> LibFeatures {
140+ // If `staged_api` is not enabled then we aren't allowed to define lib
141+ // features; there is no point collecting them.
142+ if !tcx. features ( ) . staged_api {
143+ return new_lib_features ( ) ;
144+ }
145+
140146 let mut collector = LibFeatureCollector :: new ( tcx) ;
141147 tcx. hir ( ) . walk_attributes ( & mut collector) ;
142148 collector. lib_features
Original file line number Diff line number Diff line change 1+ // #![feature(staged_api)] // note: `staged_api` not enabled
2+
3+ #![ stable( feature = "foo" , since = "1.0.0" ) ]
4+ //~^ ERROR stability attributes may not be used outside of the standard library
5+
6+ #[ unstable( feature = "foo" , issue = "none" ) ]
7+ //~^ ERROR stability attributes may not be used outside of the standard library
8+ fn foo_unstable ( ) { }
9+
10+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0734]: stability attributes may not be used outside of the standard library
2+ --> $DIR/issue-106589.rs:6:1
3+ |
4+ LL | #[unstable(feature = "foo", issue = "none")]
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+ error[E0734]: stability attributes may not be used outside of the standard library
8+ --> $DIR/issue-106589.rs:3:1
9+ |
10+ LL | #![stable(feature = "foo", since = "1.0.0")]
11+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+ error: aborting due to 2 previous errors
14+
15+ For more information about this error, try `rustc --explain E0734`.
You can’t perform that action at this time.
0 commit comments