Skip to content

Commit aef07cd

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

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>)] = &[
@@ -354,6 +361,10 @@ declare_features! (
354361
(removed, pushpop_unsafe, "1.2.0", None),
355362
);
356363

364+
declare_features! (
365+
(stable_removed, no_stack_check, "1.0.0", None),
366+
);
367+
357368
declare_features! (
358369
(accepted, associated_types, "1.0.0", None),
359370
// allow overloading augmented assignment operations like `a += b`
@@ -508,9 +519,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
508519
not yet settled",
509520
cfg_fn!(structural_match))),
510521

511-
// Not used any more, but we can't feature gate it
512-
("no_stack_check", Normal, Ungated),
513-
514522
("plugin", CrateLevel, Gated(Stability::Unstable,
515523
"plugin",
516524
"compiler plugins are experimental \
@@ -912,8 +920,10 @@ fn find_lang_feature_issue(feature: &str) -> Option<u32> {
912920
// assert!(issue.is_some())
913921
issue
914922
} else {
915-
// search in Accepted or Removed features
916-
match ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).find(|t| t.0 == feature) {
923+
// search in Accepted, Removed, or Stable Removed features
924+
let found = ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).chain(STABLE_REMOVED_FEATURES)
925+
.find(|t| t.0 == feature);
926+
match found {
917927
Some(&(_, _, issue)) => issue,
918928
None => panic!("Feature `{}` is not declared anywhere", feature),
919929
}
@@ -1451,7 +1461,9 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute]) -> F
14511461
feature_checker.collect(&features, mi.span);
14521462
}
14531463
else if let Some(&(_, _, _)) = REMOVED_FEATURES.iter()
1454-
.find(|& &(n, _, _)| name == n) {
1464+
.find(|& &(n, _, _)| name == n)
1465+
.or_else(|| STABLE_REMOVED_FEATURES.iter()
1466+
.find(|& &(n, _, _)| name == n)) {
14551467
span_err!(span_handler, mi.span, E0557, "feature has been removed");
14561468
}
14571469
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)