1
Fork 0

Move edition outside the hygiene lock and avoid accessing it

This commit is contained in:
John Kåre Alsaker 2019-04-06 00:15:49 +02:00
parent 50a0defd5a
commit a1f2dceaeb
39 changed files with 155 additions and 139 deletions

View file

@ -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);
})
}
}