about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-01 00:28:44 -0700
committerbors <bors@rust-lang.org>2016-06-01 00:28:44 -0700
commit806a5535dac1afe79176ea7053661953c89eaa5e (patch)
tree99d22a2009b161f10079a54f94fd3cd754c51910 /src/libsyntax
parent433d70cda2e6d61d5bbb20423f0937a643cf34b4 (diff)
parent42e593a540ac5b08d4bd1cb6fd3d0fcb9ae74a8f (diff)
Auto merge of #34004 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

- Successful merges: #33385, #33606, #33841, #33892, #33896, #33915, #33921, #33967, #33970, #33973, #33977
- Failed merges:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs13
-rw-r--r--src/libsyntax/feature_gate.rs10
2 files changed, 11 insertions, 12 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 3522c8863cf..69e24cf0719 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -179,7 +179,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
     for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
         let lhs_tt = match *lhs {
             TokenTree::Delimited(_, ref delim) => &delim.tts[..],
-            _ => cx.span_fatal(sp, "malformed macro lhs")
+            _ => cx.span_bug(sp, "malformed macro lhs")
         };
 
         match TokenTree::parse(cx, lhs_tt, arg) {
@@ -187,7 +187,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
                 let rhs = match rhses[i] {
                     // ignore delimiters
                     TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(),
-                    _ => cx.span_fatal(sp, "malformed macro rhs"),
+                    _ => cx.span_bug(sp, "malformed macro rhs"),
                 };
                 // rhs has holes ( `$id` and `$(...)` that need filled)
                 let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic,
@@ -326,19 +326,14 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
     NormalTT(exp, Some(def.span), def.allow_internal_unstable)
 }
 
-// why is this here? because of https://github.com/rust-lang/rust/issues/27774
-fn ref_slice<A>(s: &A) -> &[A] { use std::slice::from_raw_parts; unsafe { from_raw_parts(s, 1) } }
-
 fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &TokenTree) -> bool {
     // lhs is going to be like TokenTree::Delimited(...), where the
     // entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens.
     match lhs {
         &TokenTree::Delimited(_, ref tts) => check_matcher(cx, &tts.tts),
-        tt @ &TokenTree::Sequence(..) => check_matcher(cx, ref_slice(tt)),
         _ => {
-            cx.span_err(lhs.get_span(),
-                        "invalid macro matcher; matchers must be contained \
-                         in balanced delimiters or a repetition indicator");
+            cx.span_err(lhs.get_span(), "invalid macro matcher; matchers must \
+                                         be contained in balanced delimiters");
             false
         }
     }
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));
                     }