diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 15:57:50 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-06 16:10:37 -0800 |
| commit | 56a9e2fcd5f0b737df81a39b22f72a55c95b44a2 (patch) | |
| tree | c49c538f8e87842bb6371f97ece94ceaa0bcca8e /src/libsyntax | |
| parent | 26cd8eae48ea99bda183c5224bc423991ccfaf1f (diff) | |
| download | rust-56a9e2fcd5f0b737df81a39b22f72a55c95b44a2.tar.gz rust-56a9e2fcd5f0b737df81a39b22f72a55c95b44a2.zip | |
Test fixes and rebase conflicts
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 33 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
3 files changed, 22 insertions, 17 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 95240cd7a87..64c53e298ef 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -287,7 +287,7 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &NamedMatch, sp: Span) { // &MatchedNonterminal(NtTT(box TtDelimited(...))) = lhs` let matcher = match lhs { &MatchedNonterminal(NtTT(ref inner)) => match &**inner { - &TtDelimited(_, ref tts) => tts.tts[], + &TtDelimited(_, ref tts) => tts.tts.as_slice(), _ => cx.span_bug(sp, "wrong-structured lhs for follow check") }, _ => cx.span_bug(sp, "wrong-structured lhs for follow check") @@ -317,9 +317,12 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) Some(&&TtToken(_, CloseDelim(_))) => follow.clone(), Some(&&TtToken(_, ref tok)) => tok.clone(), Some(&&TtSequence(sp, _)) => { - cx.span_err(sp, format!("`${0}:{1}` is followed by a sequence \ - repetition, which is not allowed for `{1}` \ - fragments", name.as_str(), frag_spec.as_str())[]); + cx.span_err(sp, + format!("`${0}:{1}` is followed by a \ + sequence repetition, which is not \ + allowed for `{1}` fragments", + name.as_str(), frag_spec.as_str()) + .as_slice()); Eof }, // die next iteration @@ -337,7 +340,7 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) cx.span_err(sp, format!("`${0}:{1}` is followed by `{2}`, which \ is not allowed for `{1}` fragments", name.as_str(), frag_spec.as_str(), - token_to_string(next))[]); + token_to_string(next)).as_slice()); continue }, } @@ -351,11 +354,12 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) Some(ref u) => { let last = check_matcher(cx, seq.tts.iter(), u); match last { - // Since the delimiter isn't required after the last repetition, make - // sure that the *next* token is sane. This doesn't actually compute - // the FIRST of the rest of the matcher yet, it only considers single - // tokens and simple NTs. This is imprecise, but conservatively - // correct. + // Since the delimiter isn't required after the last + // repetition, make sure that the *next* token is + // sane. This doesn't actually compute the FIRST of + // the rest of the matcher yet, it only considers + // single tokens and simple NTs. This is imprecise, + // but conservatively correct. Some((span, tok)) => { let fol = match tokens.peek() { Some(&&TtToken(_, ref tok)) => tok.clone(), @@ -373,9 +377,9 @@ fn check_matcher<'a, I>(cx: &mut ExtCtxt, matcher: I, follow: &Token) None => last, } }, - // If T has the form $(...)+ or $(...)*, run the algorithm on the contents with - // F set to the token following the sequence. If it accepts, continue, else, - // reject. + // If T has the form $(...)+ or $(...)*, run the algorithm + // on the contents with F set to the token following the + // sequence. If it accepts, continue, else, reject. None => { let fol = match tokens.peek() { Some(&&TtToken(_, ref tok)) => tok.clone(), @@ -449,6 +453,7 @@ fn is_in_follow(cx: &ExtCtxt, tok: &Token, frag: &str) -> bool { // harmless true }, - _ => cx.bug(format!("unrecognized builtin nonterminal {}", frag)[]), + _ => cx.bug(format!("unrecognized builtin nonterminal {}", + frag).as_slice()), } } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 75d231d68b5..f10113254de 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -298,7 +298,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { "the new orphan check rules will eventually be strictly enforced"); } - if attr::contains_name(i.attrs[], + if attr::contains_name(i.attrs.index(&FullRange), "old_impl_check") { self.gate_feature("old_impl_check", i.span, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0ba9f23fc11..92e0395eca4 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2613,7 +2613,7 @@ impl<'a> Parser<'a> { |p| p.parse_token_tree() ); let (sep, repeat) = self.parse_sep_and_kleene_op(); - let name_num = macro_parser::count_names(seq[]); + let name_num = macro_parser::count_names(seq.as_slice()); return TtSequence(mk_sp(sp.lo, seq_span.hi), Rc::new(SequenceRepetition { tts: seq, @@ -2656,7 +2656,7 @@ impl<'a> Parser<'a> { match self.token { token::SubstNt(name, _) => self.fatal(format!("unknown macro variable `{}`", - token::get_ident(name))[]), + token::get_ident(name)).index(&FullRange)), _ => {} } } |
