Skip to content

Commit 4fdeeb7

Browse files
authored
Rollup merge of rust-lang#40110 - benschreiber:nostackcheck, r=brson
Made no_stack_check a stable_removed attribute r? @brson
2 parents c900120 + 9c5e4af commit 4fdeeb7

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

src/libsyntax/feature_gate.rs

+19-7
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ macro_rules! declare_features {
7777
};
7878

7979
($((removed, $feature: ident, $ver: expr, $issue: expr),)+) => {
80-
/// Represents features which has since been removed (it was once Active)
80+
/// Represents unstable features which have since been removed (it was once Active)
8181
const REMOVED_FEATURES: &'static [(&'static str, &'static str, Option<u32>)] = &[
8282
$((stringify!($feature), $ver, $issue)),+
8383
];
8484
};
8585

86+
($((stable_removed, $feature: ident, $ver: expr, $issue: expr),)+) => {
87+
/// Represents stable features which have since been removed (it was once Accepted)
88+
const STABLE_REMOVED_FEATURES: &'static [(&'static str, &'static str, Option<u32>)] = &[
89+
$((stringify!($feature), $ver, $issue)),+
90+
];
91+
};
92+
8693
($((accepted, $feature: ident, $ver: expr, $issue: expr),)+) => {
8794
/// Those language feature has since been Accepted (it was once Active)
8895
const ACCEPTED_FEATURES: &'static [(&'static str, &'static str, Option<u32>)] = &[
@@ -351,6 +358,10 @@ declare_features! (
351358
(removed, pushpop_unsafe, "1.2.0", None),
352359
);
353360

361+
declare_features! (
362+
(stable_removed, no_stack_check, "1.0.0", None),
363+
);
364+
354365
declare_features! (
355366
(accepted, associated_types, "1.0.0", None),
356367
// allow overloading augmented assignment operations like `a += b`
@@ -505,9 +516,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
505516
not yet settled",
506517
cfg_fn!(structural_match))),
507518

508-
// Not used any more, but we can't feature gate it
509-
("no_stack_check", Normal, Ungated),
510-
511519
("plugin", CrateLevel, Gated(Stability::Unstable,
512520
"plugin",
513521
"compiler plugins are experimental \
@@ -909,8 +917,10 @@ fn find_lang_feature_issue(feature: &str) -> Option<u32> {
909917
// assert!(issue.is_some())
910918
issue
911919
} else {
912-
// search in Accepted or Removed features
913-
match ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).find(|t| t.0 == feature) {
920+
// search in Accepted, Removed, or Stable Removed features
921+
let found = ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).chain(STABLE_REMOVED_FEATURES)
922+
.find(|t| t.0 == feature);
923+
match found {
914924
Some(&(_, _, issue)) => issue,
915925
None => panic!("Feature `{}` is not declared anywhere", feature),
916926
}
@@ -1444,7 +1454,9 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute]) -> F
14441454
feature_checker.collect(&features, mi.span);
14451455
}
14461456
else if let Some(&(_, _, _)) = REMOVED_FEATURES.iter()
1447-
.find(|& &(n, _, _)| name == n) {
1457+
.find(|& &(n, _, _)| name == n)
1458+
.or_else(|| STABLE_REMOVED_FEATURES.iter()
1459+
.find(|& &(n, _, _)| name == n)) {
14481460
span_err!(span_handler, mi.span, E0557, "feature has been removed");
14491461
}
14501462
else if let Some(&(_, _, _)) = ACCEPTED_FEATURES.iter()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 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+
#![deny(warnings)]
12+
#![feature(no_stack_check)]
13+
//~^ ERROR: 12:12: 12:26: feature has been removed [E0557]
14+
fn main() {
15+
16+
}

0 commit comments

Comments
 (0)