diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2016-06-01 12:57:42 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2016-06-01 12:57:42 +0530 |
| commit | 86319f7f81d89ad57e98c36ae6b2e53be83ad721 (patch) | |
| tree | ec448e6d90eaf788ba8094da899b8dfb9583e1b1 /src/libsyntax | |
| parent | e214c3e2da41a2f561bdff13c01a21278a65403b (diff) | |
| parent | 06c9e0f5f80d2a2bad9e7b90af73b8dc89f756c6 (diff) | |
| download | rust-86319f7f81d89ad57e98c36ae6b2e53be83ad721.tar.gz rust-86319f7f81d89ad57e98c36ae6b2e53be83ad721.zip | |
Rollup merge of #33973 - zackmdavis:stable_features_warning_notes_version_stabilized, r=brson
stable features lint warning mentions version stabilized To accomplish this, we alter the checks in `rustc::middle::stability` to use the `StabilityLevel` defined in `syntax::attr` (which includes the version in which the feature was stabilized) rather than the local `StabilityLevel` in the same module, and make the `declared_stable_lang_features` field of `syntax::feature_gate::Features` hold a Vec of feature-name, span tuples (in analogy to the `declared_lib_features` field) rather than just spans. Fixes #33394.  r? @brson (tagging Brian because he [wrote](https://github.com/rust-lang/rust/pull/21958) the lint)
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 5687099b27c..08e593ca747 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -59,8 +59,8 @@ macro_rules! declare_features { /// A set of features to be used by later passes. pub struct Features { - /// spans of #![feature] attrs for stable language features. for error reporting - pub declared_stable_lang_features: Vec<Span>, + /// #![feature] attrs for stable language features, for error reporting + pub declared_stable_lang_features: Vec<(InternedString, Span)>, /// #![feature] attrs for non-language (library) features pub declared_lib_features: Vec<(InternedString, Span)>, $(pub $feature: bool),+ @@ -753,6 +753,10 @@ pub fn check_attribute(attr: &ast::Attribute, handler: &Handler, cx.check_attribute(attr, true); } +pub fn find_lang_feature_accepted_version(feature: &str) -> Option<&'static str> { + ACCEPTED_FEATURES.iter().find(|t| t.0 == feature).map(|t| t.1) +} + fn find_lang_feature_issue(feature: &str) -> Option<u32> { if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.0 == feature) { let issue = info.2; @@ -1191,7 +1195,7 @@ pub fn get_features(span_handler: &Handler, krate: &ast::Crate) -> Features { } else if let Some(&(_, _, _)) = ACCEPTED_FEATURES.iter() .find(|& &(n, _, _)| name == n) { - features.declared_stable_lang_features.push(mi.span); + features.declared_stable_lang_features.push((name, mi.span)); } else { features.declared_lib_features.push((name, mi.span)); } |
