diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2019-04-06 00:15:49 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2019-05-21 18:17:05 +0200 |
| commit | a1f2dceaebd21a6f8a5f9341bf41724bb20e2a7d (patch) | |
| tree | 92928e104879c4c6aa37de8717d1c339999f35b1 /src/libsyntax/tokenstream.rs | |
| parent | 50a0defd5a93523067ef239936cc2e0755220904 (diff) | |
| download | rust-a1f2dceaebd21a6f8a5f9341bf41724bb20e2a7d.tar.gz rust-a1f2dceaebd21a6f8a5f9341bf41724bb20e2a7d.zip | |
Move `edition` outside the hygiene lock and avoid accessing it
Diffstat (limited to 'src/libsyntax/tokenstream.rs')
| -rw-r--r-- | src/libsyntax/tokenstream.rs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 3cb16c30a50..79efc6bf689 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -557,7 +557,7 @@ impl DelimSpan { mod tests { use super::*; use crate::syntax::ast::Ident; - use crate::with_globals; + use crate::with_default_globals; use crate::parse::token::Token; use crate::util::parser_testing::string_to_stream; use syntax_pos::{Span, BytePos, NO_EXPANSION}; @@ -572,7 +572,7 @@ mod tests { #[test] fn test_concat() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts("foo::bar::baz"); let test_fst = string_to_ts("foo::bar"); let test_snd = string_to_ts("::baz"); @@ -585,7 +585,7 @@ mod tests { #[test] fn test_to_from_bijection() { - with_globals(|| { + with_default_globals(|| { let test_start = string_to_ts("foo::bar(baz)"); let test_end = test_start.trees().collect(); assert_eq!(test_start, test_end) @@ -594,7 +594,7 @@ mod tests { #[test] fn test_eq_0() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts("foo"); let test_eqs = string_to_ts("foo"); assert_eq!(test_res, test_eqs) @@ -603,7 +603,7 @@ mod tests { #[test] fn test_eq_1() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts("::bar::baz"); let test_eqs = string_to_ts("::bar::baz"); assert_eq!(test_res, test_eqs) @@ -612,7 +612,7 @@ mod tests { #[test] fn test_eq_3() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts(""); let test_eqs = string_to_ts(""); assert_eq!(test_res, test_eqs) @@ -621,7 +621,7 @@ mod tests { #[test] fn test_diseq_0() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts("::bar::baz"); let test_eqs = string_to_ts("bar::baz"); assert_eq!(test_res == test_eqs, false) @@ -630,7 +630,7 @@ mod tests { #[test] fn test_diseq_1() { - with_globals(|| { + with_default_globals(|| { let test_res = string_to_ts("(bar,baz)"); let test_eqs = string_to_ts("bar,baz"); assert_eq!(test_res == test_eqs, false) @@ -639,7 +639,7 @@ mod tests { #[test] fn test_is_empty() { - with_globals(|| { + with_default_globals(|| { let test0: TokenStream = Vec::<TokenTree>::new().into_iter().collect(); let test1: TokenStream = TokenTree::Token(sp(0, 1), Token::Ident(Ident::from_str("a"), false)).into(); @@ -653,12 +653,14 @@ mod tests { #[test] fn test_dotdotdot() { - let mut builder = TokenStreamBuilder::new(); - builder.push(TokenTree::Token(sp(0, 1), Token::Dot).joint()); - builder.push(TokenTree::Token(sp(1, 2), Token::Dot).joint()); - builder.push(TokenTree::Token(sp(2, 3), Token::Dot)); - let stream = builder.build(); - assert!(stream.eq_unspanned(&string_to_ts("..."))); - assert_eq!(stream.trees().count(), 1); + with_default_globals(|| { + let mut builder = TokenStreamBuilder::new(); + builder.push(TokenTree::Token(sp(0, 1), Token::Dot).joint()); + builder.push(TokenTree::Token(sp(1, 2), Token::Dot).joint()); + builder.push(TokenTree::Token(sp(2, 3), Token::Dot)); + let stream = builder.build(); + assert!(stream.eq_unspanned(&string_to_ts("..."))); + assert_eq!(stream.trees().count(), 1); + }) } } |
