Skip to content

Commit 465ada6

Browse files
committed
Fix checking for missing stability annotations
Remove couple of unnecessary `#![feature(staged_api)]`.
1 parent 8f1339a commit 465ada6

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

src/liballoc/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,10 @@ mod std {
244244
pub enum Bound<T> {
245245
/// An inclusive bound.
246246
#[stable(feature = "collections_bound", since = "1.17.0")]
247-
Included(T),
247+
Included(#[stable(feature = "collections_bound", since = "1.17.0")] T),
248248
/// An exclusive bound.
249249
#[stable(feature = "collections_bound", since = "1.17.0")]
250-
Excluded(T),
250+
Excluded(#[stable(feature = "collections_bound", since = "1.17.0")] T),
251251
/// An infinite endpoint. Indicates that there is no bound in this direction.
252252
#[stable(feature = "collections_bound", since = "1.17.0")]
253253
Unbounded,

src/librustc/middle/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> {
313313
impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
314314
fn check_missing_stability(&self, id: NodeId, span: Span) {
315315
let def_id = self.tcx.hir.local_def_id(id);
316+
let stab = self.tcx.stability.borrow().stab_map.get(&def_id).cloned();
316317
let is_error = !self.tcx.sess.opts.test &&
317-
!self.tcx.stability.borrow().stab_map.contains_key(&def_id) &&
318+
(stab == None || stab == Some(None)) &&
318319
self.access_levels.is_reachable(id);
319320
if is_error {
320321
self.tcx.sess.span_err(span, "This node does not have a stability attribute");
@@ -420,7 +421,6 @@ impl<'a, 'tcx> Index<'tcx> {
420421
let is_staged_api =
421422
sess.opts.debugging_opts.force_unstable_if_unmarked ||
422423
sess.features.borrow().staged_api;
423-
424424
let mut staged_api = FxHashMap();
425425
staged_api.insert(LOCAL_CRATE, is_staged_api);
426426
Index {

src/libterm/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#![deny(missing_docs)]
5252
#![deny(warnings)]
5353

54-
#![feature(staged_api)]
5554
#![cfg_attr(windows, feature(libc))]
5655
// Handle rustfmt skips
5756
#![feature(custom_attribute)]

src/test/compile-fail-fulldeps/explore-issue-38412.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// aux-build:pub_and_stability.rs
1212

13-
#![feature(staged_api)]
1413
#![feature(unused_feature)]
1514

1615
// A big point of this test is that we *declare* `unstable_declared`,

src/test/compile-fail/lint-forbid-cmdline.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// compile-flags: -F deprecated
1212

13-
#![feature(staged_api)]
1413
#[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
1514
fn main() {
1615
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(staged_api)]
12+
#![stable(feature = "test", since = "0")]
13+
14+
#[stable(feature = "test", since = "0")]
15+
pub struct Reverse<T>(pub T); //~ ERROR This node does not have a stability attribute
16+
17+
fn main() {
18+
// Make sure the field is used to fill the stability cache
19+
Reverse(0).0;
20+
}

0 commit comments

Comments
 (0)