aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2020-04-16 17:09:06 -0700
committerChih-Hung Hsieh <chh@google.com>2020-04-16 17:09:06 -0700
commit725b6eca99d4a90c8e6db5d6311e776be20cc9a8 (patch)
tree918149bd0b92ffcc7001bf2d5e8b85fd3446571f /tests
parent3d045a538309e03e999b539d5b760bb495ccf780 (diff)
downloadsyn-725b6eca99d4a90c8e6db5d6311e776be20cc9a8.tar.gz
Upgrade to version 1.0.17
Test: make Change-Id: I2ecb37bf167a85b96c0be6893a40482a7b6a4fa8
Diffstat (limited to 'tests')
-rw-r--r--tests/common/eq.rs66
-rw-r--r--tests/common/parse.rs6
-rw-r--r--tests/repo/mod.rs1
-rw-r--r--tests/test_precedence.rs20
-rw-r--r--tests/test_round_trip.rs6
5 files changed, 51 insertions, 48 deletions
diff --git a/tests/common/eq.rs b/tests/common/eq.rs
index e03b25be..c48e4f6a 100644
--- a/tests/common/eq.rs
+++ b/tests/common/eq.rs
@@ -1,33 +1,33 @@
+extern crate rustc_ast;
extern crate rustc_data_structures;
extern crate rustc_span;
extern crate rustc_target;
-extern crate syntax;
use std::mem;
-use rustc_data_structures::sync::Lrc;
-use rustc_data_structures::thin_vec::ThinVec;
-use rustc_span::source_map::Spanned;
-use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP};
-use syntax::ast::{
- AngleBracketedArgs, AnonConst, Arm, AsmDialect, AssocItem, AssocItemKind, AssocTyConstraint,
+use rustc_ast::ast::{
+ AngleBracketedArgs, AnonConst, Arm, AsmDialect, AssocItemKind, AssocTyConstraint,
AssocTyConstraintKind, Async, AttrId, AttrItem, AttrKind, AttrStyle, Attribute, BareFnTy,
BinOpKind, BindingMode, Block, BlockCheckMode, BorrowKind, CaptureBy, Const, Crate, CrateSugar,
Defaultness, EnumDef, Expr, ExprKind, Extern, Field, FieldPat, FloatTy, FnDecl, FnHeader,
- FnRetTy, FnSig, ForeignMod, GenericArg, GenericArgs, GenericBound, GenericParam,
- GenericParamKind, Generics, GlobalAsm, Ident, ImplPolarity, InlineAsm, InlineAsmOutput, IntTy,
- IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType, LitKind, Local, Mac,
- MacArgs, MacDelimiter, MacStmtStyle, MacroDef, Mod, Movability, MutTy, Mutability, NodeId,
- Param, ParenthesizedArgs, Pat, PatKind, Path, PathSegment, PolyTraitRef, QSelf, RangeEnd,
- RangeLimits, RangeSyntax, Stmt, StmtKind, StrLit, StrStyle, StructField, TraitBoundModifier,
- TraitObjectSyntax, TraitRef, Ty, TyKind, UintTy, UnOp, Unsafe, UnsafeSource, UseTree,
- UseTreeKind, Variant, VariantData, VisibilityKind, WhereBoundPredicate, WhereClause,
- WhereEqPredicate, WherePredicate, WhereRegionPredicate,
+ FnRetTy, FnSig, ForeignItemKind, ForeignMod, GenericArg, GenericArgs, GenericBound,
+ GenericParam, GenericParamKind, Generics, GlobalAsm, Ident, ImplPolarity, InlineAsm,
+ InlineAsmOutput, IntTy, IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType,
+ LitKind, Local, MacArgs, MacCall, MacDelimiter, MacStmtStyle, MacroDef, Mod, Movability, MutTy,
+ Mutability, NodeId, Param, ParenthesizedArgs, Pat, PatKind, Path, PathSegment, PolyTraitRef,
+ QSelf, RangeEnd, RangeLimits, RangeSyntax, Stmt, StmtKind, StrLit, StrStyle, StructField,
+ TraitBoundModifier, TraitObjectSyntax, TraitRef, Ty, TyKind, UintTy, UnOp, Unsafe,
+ UnsafeSource, UseTree, UseTreeKind, Variant, VariantData, VisibilityKind, WhereBoundPredicate,
+ WhereClause, WhereEqPredicate, WherePredicate, WhereRegionPredicate,
};
-use syntax::ptr::P;
-use syntax::token::{self, DelimToken, Token, TokenKind};
-use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree};
-use syntax::util::comments;
+use rustc_ast::ptr::P;
+use rustc_ast::token::{self, DelimToken, Token, TokenKind};
+use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
+use rustc_ast::util::comments;
+use rustc_data_structures::sync::Lrc;
+use rustc_data_structures::thin_vec::ThinVec;
+use rustc_span::source_map::Spanned;
+use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP};
pub trait SpanlessEq {
fn eq(&self, other: &Self) -> bool;
@@ -262,7 +262,6 @@ macro_rules! spanless_eq_enum {
spanless_eq_struct!(AngleBracketedArgs; span args constraints);
spanless_eq_struct!(AnonConst; id value);
spanless_eq_struct!(Arm; attrs pat guard body span id is_placeholder);
-spanless_eq_struct!(AssocItem; attrs id span vis ident defaultness kind !tokens);
spanless_eq_struct!(AssocTyConstraint; id ident kind span);
spanless_eq_struct!(AttrItem; path args);
spanless_eq_struct!(Attribute; kind id style span);
@@ -287,8 +286,8 @@ spanless_eq_struct!(Label; ident);
spanless_eq_struct!(Lifetime; id ident);
spanless_eq_struct!(Lit; token kind span);
spanless_eq_struct!(Local; pat ty init id span attrs);
-spanless_eq_struct!(Mac; path args prior_type_ascription);
-spanless_eq_struct!(MacroDef; body legacy);
+spanless_eq_struct!(MacCall; path args prior_type_ascription);
+spanless_eq_struct!(MacroDef; body macro_rules);
spanless_eq_struct!(Mod; inner items inline);
spanless_eq_struct!(MutTy; ty mutbl);
spanless_eq_struct!(Param; attrs ty pat id span is_placeholder);
@@ -311,7 +310,7 @@ spanless_eq_struct!(WhereClause; predicates span);
spanless_eq_struct!(WhereEqPredicate; id span lhs_ty rhs_ty);
spanless_eq_struct!(WhereRegionPredicate; span lifetime bounds);
spanless_eq_enum!(AsmDialect; Att Intel);
-spanless_eq_enum!(AssocItemKind; Const(0 1) Static(0 1 2) Fn(0 1 2) TyAlias(0 1 2) Macro(0));
+spanless_eq_enum!(AssocItemKind; Const(0 1 2) Fn(0 1 2 3) TyAlias(0 1 2 3) MacCall(0));
spanless_eq_enum!(AssocTyConstraintKind; Equality(ty) Bound(bounds));
spanless_eq_enum!(Async; Yes(span closure_id return_impl_trait_id) No);
spanless_eq_enum!(AttrKind; Normal(0) DocComment(0));
@@ -323,15 +322,16 @@ spanless_eq_enum!(BorrowKind; Ref Raw);
spanless_eq_enum!(CaptureBy; Value Ref);
spanless_eq_enum!(Const; Yes(0) No);
spanless_eq_enum!(CrateSugar; PubCrate JustCrate);
-spanless_eq_enum!(Defaultness; Default Final);
+spanless_eq_enum!(Defaultness; Default(0) Final);
spanless_eq_enum!(Extern; None Implicit Explicit(0));
spanless_eq_enum!(FloatTy; F32 F64);
spanless_eq_enum!(FnRetTy; Default(0) Ty(0));
+spanless_eq_enum!(ForeignItemKind; Static(0 1 2) Fn(0 1 2 3) TyAlias(0 1 2 3) MacCall(0));
spanless_eq_enum!(GenericArg; Lifetime(0) Type(0) Const(0));
spanless_eq_enum!(GenericArgs; AngleBracketed(0) Parenthesized(0));
spanless_eq_enum!(GenericBound; Trait(0 1) Outlives(0));
spanless_eq_enum!(GenericParamKind; Lifetime Type(default) Const(ty));
-spanless_eq_enum!(ImplPolarity; Positive Negative);
+spanless_eq_enum!(ImplPolarity; Positive Negative(0));
spanless_eq_enum!(IntTy; Isize I8 I16 I32 I64 I128);
spanless_eq_enum!(IsAuto; Yes No);
spanless_eq_enum!(LitFloatType; Suffixed(0) Unsuffixed);
@@ -343,7 +343,7 @@ spanless_eq_enum!(Movability; Static Movable);
spanless_eq_enum!(Mutability; Mut Not);
spanless_eq_enum!(RangeEnd; Included(0) Excluded);
spanless_eq_enum!(RangeLimits; HalfOpen Closed);
-spanless_eq_enum!(StmtKind; Local(0) Item(0) Expr(0) Semi(0) Mac(0));
+spanless_eq_enum!(StmtKind; Local(0) Item(0) Expr(0) Semi(0) Empty MacCall(0));
spanless_eq_enum!(StrStyle; Cooked Raw(0));
spanless_eq_enum!(TokenTree; Token(0) Delimited(0 1 2));
spanless_eq_enum!(TraitBoundModifier; None Maybe MaybeConst MaybeConstMaybe);
@@ -361,21 +361,21 @@ spanless_eq_enum!(ExprKind; Box(0) Array(0) Call(0 1) MethodCall(0 1) Tup(0)
While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(0 1) Closure(0 1 2 3 4 5)
Block(0 1) Async(0 1 2) Await(0) TryBlock(0) Assign(0 1 2) AssignOp(0 1 2)
Field(0 1) Index(0 1) Range(0 1 2) Path(0 1) AddrOf(0 1 2) Break(0 1)
- Continue(0) Ret(0) InlineAsm(0) Mac(0) Struct(0 1 2) Repeat(0 1) Paren(0)
+ Continue(0) Ret(0) InlineAsm(0) MacCall(0) Struct(0 1 2) Repeat(0 1) Paren(0)
Try(0) Yield(0) Err);
-spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0 1 2) Const(0 1)
- Fn(0 1 2) Mod(0) ForeignMod(0) GlobalAsm(0) TyAlias(0 1 2) Enum(0 1)
+spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0 1 2) Const(0 1 2)
+ Fn(0 1 2 3) Mod(0) ForeignMod(0) GlobalAsm(0) TyAlias(0 1 2 3) Enum(0 1)
Struct(0 1) Union(0 1) Trait(0 1 2 3 4) TraitAlias(0 1)
Impl(unsafety polarity defaultness constness generics of_trait self_ty items)
- Mac(0) MacroDef(0));
+ MacCall(0) MacroDef(0));
spanless_eq_enum!(LitKind; Str(0 1) ByteStr(0) Byte(0) Char(0) Int(0 1)
Float(0 1) Bool(0) Err(0));
spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2) TupleStruct(0 1)
Or(0) Path(0 1) Tuple(0) Box(0) Ref(0 1) Lit(0) Range(0 1 2) Slice(0) Rest
- Paren(0) Mac(0));
+ Paren(0) MacCall(0));
spanless_eq_enum!(TyKind; Slice(0) Array(0 1) Ptr(0) Rptr(0 1) BareFn(0) Never
Tup(0) Path(0 1) TraitObject(0 1) ImplTrait(0 1) Paren(0) Typeof(0) Infer
- ImplicitSelf Mac(0) Err CVarArgs);
+ ImplicitSelf MacCall(0) Err CVarArgs);
impl SpanlessEq for Ident {
fn eq(&self, other: &Self) -> bool {
diff --git a/tests/common/parse.rs b/tests/common/parse.rs
index acdd172f..689289da 100644
--- a/tests/common/parse.rs
+++ b/tests/common/parse.rs
@@ -1,14 +1,14 @@
+extern crate rustc_ast;
extern crate rustc_expand;
extern crate rustc_parse as parse;
extern crate rustc_session;
extern crate rustc_span;
-extern crate syntax;
+use rustc_ast::ast;
+use rustc_ast::ptr::P;
use rustc_session::parse::ParseSess;
use rustc_span::source_map::FilePathMapping;
use rustc_span::FileName;
-use syntax::ast;
-use syntax::ptr::P;
use std::panic;
diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs
index 6ab8d2e2..c1dc7e0a 100644
--- a/tests/repo/mod.rs
+++ b/tests/repo/mod.rs
@@ -124,6 +124,7 @@ pub fn base_dir_filter(entry: &DirEntry) -> bool {
"test/ui/include-single-expr-helper.rs" |
"test/ui/include-single-expr-helper-1.rs" |
"test/ui/issues/auxiliary/issue-21146-inc.rs" |
+ "test/ui/json-bom-plus-crlf-multifile-aux.rs" |
"test/ui/macros/auxiliary/macro-comma-support.rs" |
"test/ui/macros/auxiliary/macro-include-items-expr.rs" => false,
diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs
index 80f51308..fe2b7642 100644
--- a/tests/test_precedence.rs
+++ b/tests/test_precedence.rs
@@ -14,18 +14,18 @@
//! spans.
//! 5. Compare the expressions with one another, if they are not equal fail.
+extern crate rustc_ast;
extern crate rustc_data_structures;
extern crate rustc_span;
-extern crate syntax;
mod features;
use quote::quote;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use regex::Regex;
+use rustc_ast::ast;
+use rustc_ast::ptr::P;
use rustc_span::edition::Edition;
-use syntax::ast;
-use syntax::ptr::P;
use walkdir::{DirEntry, WalkDir};
use std::fs::File;
@@ -165,7 +165,7 @@ fn test_expressions(exprs: Vec<syn::Expr>) -> (usize, usize) {
let mut passed = 0;
let mut failed = 0;
- syntax::with_globals(Edition::Edition2018, || {
+ rustc_ast::with_globals(Edition::Edition2018, || {
for expr in exprs {
let raw = quote!(#expr).to_string();
@@ -208,12 +208,14 @@ fn libsyntax_parse_and_rewrite(input: &str) -> Option<P<ast::Expr>> {
///
/// This method operates on libsyntax objects.
fn libsyntax_brackets(mut libsyntax_expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
+ use rustc_ast::ast::{
+ Block, BorrowKind, Expr, ExprKind, Field, MacCall, Pat, Stmt, StmtKind, Ty,
+ };
+ use rustc_ast::mut_visit::MutVisitor;
+ use rustc_ast::util::map_in_place::MapInPlace;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_span::DUMMY_SP;
use std::mem;
- use syntax::ast::{Block, BorrowKind, Expr, ExprKind, Field, Mac, Pat, Stmt, StmtKind, Ty};
- use syntax::mut_visit::MutVisitor;
- use syntax::util::map_in_place::MapInPlace;
struct BracketsVisitor {
failed: bool,
@@ -246,7 +248,7 @@ fn libsyntax_brackets(mut libsyntax_expr: P<ast::Expr>) -> Option<P<ast::Expr>>
}
fn noop_visit_expr<T: MutVisitor>(e: &mut Expr, vis: &mut T) {
- use syntax::mut_visit::{noop_visit_expr, visit_opt, visit_thin_attrs};
+ use rustc_ast::mut_visit::{noop_visit_expr, visit_opt, visit_thin_attrs};
match &mut e.kind {
ExprKind::AddrOf(BorrowKind::Raw, ..) => {}
ExprKind::Struct(path, fields, expr) => {
@@ -300,7 +302,7 @@ fn libsyntax_brackets(mut libsyntax_expr: P<ast::Expr>) -> Option<P<ast::Expr>>
let _ = ty;
}
- fn visit_mac(&mut self, mac: &mut Mac) {
+ fn visit_mac(&mut self, mac: &mut MacCall) {
// By default when folding over macros, libsyntax panics. This is
// because it's usually not what you want, you want to run after
// macro expansion. We do want to do that (syn doesn't do macro
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index a7e48c84..d4f525b1 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -2,23 +2,23 @@
#![recursion_limit = "1024"]
#![feature(rustc_private)]
+extern crate rustc_ast;
extern crate rustc_errors;
extern crate rustc_expand;
extern crate rustc_parse as parse;
extern crate rustc_session;
extern crate rustc_span;
-extern crate syntax;
mod features;
use quote::quote;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
+use rustc_ast::ast;
use rustc_errors::PResult;
use rustc_session::parse::ParseSess;
use rustc_span::edition::Edition;
use rustc_span::source_map::FilePathMapping;
use rustc_span::FileName;
-use syntax::ast;
use walkdir::{DirEntry, WalkDir};
use std::fs::File;
@@ -80,7 +80,7 @@ fn test_round_trip() {
let back = quote!(#krate).to_string();
let equal = panic::catch_unwind(|| {
- syntax::with_globals(Edition::Edition2018, || {
+ rustc_ast::with_globals(Edition::Edition2018, || {
let sess = ParseSess::new(FilePathMapping::empty());
let before = match libsyntax_parse(content, &sess) {
Ok(before) => before,