Skip to content

Commit 98fd50a

Browse files
committed
teach rustc about remove_stable_features and removed no-stack-chech feature. fixes #34915
1 parent 1572bf1 commit 98fd50a

File tree

2 files changed

+40
-7
lines changed

2 files changed

+40
-7
lines changed

src/libsyntax/feature_gate.rs

+24-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>)] = &[
@@ -349,6 +356,11 @@ declare_features! (
349356
// rustc internal
350357
(removed, unmarked_api, "1.0.0", None),
351358
(removed, pushpop_unsafe, "1.2.0", None),
359+
//(removed, no_stack_check, "1.0.0", None),
360+
);
361+
362+
declare_features! (
363+
(stable_removed, no_stack_check, "1.0.0", None),
352364
);
353365

354366
declare_features! (
@@ -505,9 +517,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
505517
not yet settled",
506518
cfg_fn!(structural_match))),
507519

508-
// Not used any more, but we can't feature gate it
509-
("no_stack_check", Normal, Ungated),
510-
511520
("plugin", CrateLevel, Gated(Stability::Unstable,
512521
"plugin",
513522
"compiler plugins are experimental \
@@ -909,8 +918,10 @@ fn find_lang_feature_issue(feature: &str) -> Option<u32> {
909918
// assert!(issue.is_some())
910919
issue
911920
} else {
912-
// search in Accepted or Removed features
913-
match ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).find(|t| t.0 == feature) {
921+
// search in Accepted, Removed, or Stable Removed features
922+
let found = ACCEPTED_FEATURES.iter().chain(REMOVED_FEATURES).chain(STABLE_REMOVED_FEATURES)
923+
.find(|t| t.0 == feature);
924+
match found {
914925
Some(&(_, _, issue)) => issue,
915926
None => panic!("Feature `{}` is not declared anywhere", feature),
916927
}
@@ -1444,9 +1455,15 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute]) -> F
14441455
feature_checker.collect(&features, mi.span);
14451456
}
14461457
else if let Some(&(_, _, _)) = REMOVED_FEATURES.iter()
1447-
.find(|& &(n, _, _)| name == n) {
1458+
.find(|& &(n, _, _)| name == n)
1459+
.or_else(|| STABLE_REMOVED_FEATURES.iter()
1460+
.find(|& &(n, _, _)| name == n)) {
14481461
span_err!(span_handler, mi.span, E0557, "feature has been removed");
14491462
}
1463+
//else if let Some(&(_, _, _)) = STABLE_REMOVED_FEATURES.iter()
1464+
// .find(|& &(n, _, _)| name == n) {
1465+
// span_err!(span_handler, mi.span, E0557, "feature has been removed");
1466+
//}
14501467
else if let Some(&(_, _, _)) = ACCEPTED_FEATURES.iter()
14511468
.find(|& &(n, _, _)| name == n) {
14521469
features.declared_stable_lang_features.push((name, mi.span));
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)