diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:23 +0000 |
commit | 20431706a863f92cb37dc512fef6e48d192aaf2c (patch) | |
tree | 2867f13f5fd5437ba628c67d7f87309ccadcd286 /vendor/syn/tests | |
parent | Releasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/syn/tests')
-rw-r--r-- | vendor/syn/tests/.gitignore | 1 | ||||
-rw-r--r-- | vendor/syn/tests/common/eq.rs | 64 | ||||
-rw-r--r-- | vendor/syn/tests/debug/gen.rs | 12 | ||||
-rw-r--r-- | vendor/syn/tests/regression/issue1108.rs | 2 | ||||
-rw-r--r-- | vendor/syn/tests/repo/mod.rs | 77 | ||||
-rw-r--r-- | vendor/syn/tests/test_parse_stream.rs | 8 | ||||
-rw-r--r-- | vendor/syn/tests/test_precedence.rs | 19 | ||||
-rw-r--r-- | vendor/syn/tests/test_size.rs | 8 |
8 files changed, 118 insertions, 73 deletions
diff --git a/vendor/syn/tests/.gitignore b/vendor/syn/tests/.gitignore deleted file mode 100644 index 291ed43a2..000000000 --- a/vendor/syn/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.pending-snap diff --git a/vendor/syn/tests/common/eq.rs b/vendor/syn/tests/common/eq.rs index ff100aa41..a53146241 100644 --- a/vendor/syn/tests/common/eq.rs +++ b/vendor/syn/tests/common/eq.rs @@ -3,6 +3,7 @@ extern crate rustc_ast; extern crate rustc_data_structures; extern crate rustc_span; +extern crate thin_vec; use rustc_ast::ast::AngleBracketedArg; use rustc_ast::ast::AngleBracketedArgs; @@ -19,10 +20,11 @@ use rustc_ast::ast::AttrStyle; use rustc_ast::ast::Attribute; use rustc_ast::ast::BareFnTy; use rustc_ast::ast::BinOpKind; -use rustc_ast::ast::BindingMode; +use rustc_ast::ast::BindingAnnotation; use rustc_ast::ast::Block; use rustc_ast::ast::BlockCheckMode; use rustc_ast::ast::BorrowKind; +use rustc_ast::ast::ByRef; use rustc_ast::ast::CaptureBy; use rustc_ast::ast::ClosureBinder; use rustc_ast::ast::Const; @@ -82,6 +84,7 @@ use rustc_ast::ast::Movability; use rustc_ast::ast::MutTy; use rustc_ast::ast::Mutability; use rustc_ast::ast::NodeId; +use rustc_ast::ast::NormalAttr; use rustc_ast::ast::Param; use rustc_ast::ast::ParenthesizedArgs; use rustc_ast::ast::Pat; @@ -127,14 +130,14 @@ use rustc_ast::ast::WhereRegionPredicate; use rustc_ast::ptr::P; use rustc_ast::token::{self, CommentKind, Delimiter, Nonterminal, Token, TokenKind}; use rustc_ast::tokenstream::{ - AttrAnnotatedTokenStream, AttrAnnotatedTokenTree, AttributesData, DelimSpan, LazyTokenStream, - Spacing, TokenStream, TokenTree, + AttrTokenStream, AttrTokenTree, AttributesData, DelimSpan, LazyAttrTokenStream, Spacing, + TokenStream, TokenTree, }; use rustc_data_structures::sync::Lrc; -use rustc_data_structures::thin_vec::ThinVec; use rustc_span::source_map::Spanned; use rustc_span::symbol::{sym, Ident}; use rustc_span::{Span, Symbol, SyntaxContext, DUMMY_SP}; +use thin_vec::ThinVec; pub trait SpanlessEq { fn eq(&self, other: &Self) -> bool; @@ -401,11 +404,12 @@ spanless_eq_struct!(AngleBracketedArgs; span args); spanless_eq_struct!(AnonConst; id value); spanless_eq_struct!(Arm; attrs pat guard body span id is_placeholder); spanless_eq_struct!(AssocConstraint; id ident gen_args kind span); -spanless_eq_struct!(AttrAnnotatedTokenStream; 0); spanless_eq_struct!(AttrItem; path args tokens); +spanless_eq_struct!(AttrTokenStream; 0); spanless_eq_struct!(Attribute; kind id style span); spanless_eq_struct!(AttributesData; attrs tokens); spanless_eq_struct!(BareFnTy; unsafety ext generic_params decl decl_span); +spanless_eq_struct!(BindingAnnotation; 0 1); spanless_eq_struct!(Block; stmts id rules span tokens could_be_bare_literal); spanless_eq_struct!(Crate; attrs items spans id is_placeholder); spanless_eq_struct!(EnumDef; variants); @@ -425,13 +429,14 @@ spanless_eq_struct!(InlineAsmSym; id qself path); spanless_eq_struct!(Item<K>; attrs id span vis ident kind !tokens); spanless_eq_struct!(Label; ident); spanless_eq_struct!(Lifetime; id ident); -spanless_eq_struct!(Lit; token kind span); +spanless_eq_struct!(Lit; token_lit kind span); spanless_eq_struct!(Local; pat ty kind id span attrs !tokens); spanless_eq_struct!(MacCall; path args prior_type_ascription); spanless_eq_struct!(MacCallStmt; mac style attrs tokens); spanless_eq_struct!(MacroDef; body macro_rules); spanless_eq_struct!(ModSpans; !inner_span !inject_use_span); spanless_eq_struct!(MutTy; ty mutbl); +spanless_eq_struct!(NormalAttr; item tokens); spanless_eq_struct!(ParenthesizedArgs; span inputs inputs_span output); spanless_eq_struct!(Pat; id kind span tokens); spanless_eq_struct!(PatField; ident pat is_shorthand attrs id span is_placeholder); @@ -453,19 +458,19 @@ spanless_eq_struct!(Variant; attrs id span !vis ident data disr_expr is_placehol spanless_eq_struct!(Visibility; kind span tokens); spanless_eq_struct!(WhereBoundPredicate; span bound_generic_params bounded_ty bounds); spanless_eq_struct!(WhereClause; has_where_token predicates span); -spanless_eq_struct!(WhereEqPredicate; id span lhs_ty rhs_ty); +spanless_eq_struct!(WhereEqPredicate; span lhs_ty rhs_ty); spanless_eq_struct!(WhereRegionPredicate; span lifetime bounds); spanless_eq_struct!(token::Lit; kind symbol suffix); spanless_eq_enum!(AngleBracketedArg; Arg(0) Constraint(0)); spanless_eq_enum!(AssocItemKind; Const(0 1 2) Fn(0) TyAlias(0) MacCall(0)); spanless_eq_enum!(AssocConstraintKind; Equality(term) Bound(bounds)); spanless_eq_enum!(Async; Yes(span closure_id return_impl_trait_id) No); -spanless_eq_enum!(AttrAnnotatedTokenTree; Token(0) Delimited(0 1 2) Attributes(0)); spanless_eq_enum!(AttrStyle; Outer Inner); +spanless_eq_enum!(AttrTokenTree; Token(0 1) Delimited(0 1 2) Attributes(0)); spanless_eq_enum!(BinOpKind; Add Sub Mul Div Rem And Or BitXor BitAnd BitOr Shl Shr Eq Lt Le Ne Ge Gt); -spanless_eq_enum!(BindingMode; ByRef(0) ByValue(0)); spanless_eq_enum!(BlockCheckMode; Default Unsafe(0)); spanless_eq_enum!(BorrowKind; Ref Raw); +spanless_eq_enum!(ByRef; Yes No); spanless_eq_enum!(CaptureBy; Value Ref); spanless_eq_enum!(ClosureBinder; NotPresent For(span generic_params)); spanless_eq_enum!(Const; Yes(0) No); @@ -502,22 +507,23 @@ spanless_eq_enum!(StructRest; Base(0) Rest(0) None); spanless_eq_enum!(Term; Ty(0) Const(0)); spanless_eq_enum!(TokenTree; Token(0 1) Delimited(0 1 2)); spanless_eq_enum!(TraitBoundModifier; None Maybe MaybeConst MaybeConstMaybe); -spanless_eq_enum!(TraitObjectSyntax; Dyn None); +spanless_eq_enum!(TraitObjectSyntax; Dyn DynStar None); spanless_eq_enum!(UintTy; Usize U8 U16 U32 U64 U128); spanless_eq_enum!(UnOp; Deref Not Neg); spanless_eq_enum!(Unsafe; Yes(0) No); spanless_eq_enum!(UnsafeSource; CompilerGenerated UserProvided); spanless_eq_enum!(UseTreeKind; Simple(0 1 2) Nested(0) Glob); spanless_eq_enum!(VariantData; Struct(0 1) Tuple(0 1) Unit(0)); -spanless_eq_enum!(VisibilityKind; Public Restricted(path id) Inherited); +spanless_eq_enum!(VisibilityKind; Public Restricted(path id shorthand) Inherited); spanless_eq_enum!(WherePredicate; BoundPredicate(0) RegionPredicate(0) EqPredicate(0)); spanless_eq_enum!(ExprKind; Box(0) Array(0) ConstBlock(0) Call(0 1) - MethodCall(0 1 2) Tup(0) Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) Type(0 1) - Let(0 1 2) If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) Match(0 1) - Closure(0 1 2 3 4 5 6) 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) Underscore Range(0 1 2) - Path(0 1) AddrOf(0 1 2) Break(0 1) Continue(0) Ret(0) InlineAsm(0) - MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) Yeet(0) Err); + MethodCall(0 1 2 3) Tup(0) Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) + Type(0 1) Let(0 1 2) If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1) + Match(0 1) Closure(0 1 2 3 4 5 6) 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) Underscore + Range(0 1 2) Path(0 1) AddrOf(0 1 2) Break(0 1) Continue(0) Ret(0) + InlineAsm(0) MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) + Yeet(0) Err); spanless_eq_enum!(InlineAsmOperand; In(reg expr) Out(reg late expr) InOut(reg late expr) SplitInOut(reg late in_expr out_expr) Const(anon_const) Sym(sym)); @@ -525,7 +531,7 @@ spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0 1 2) Const(0 1 2) Fn(0) Mod(0 1) ForeignMod(0) GlobalAsm(0) TyAlias(0) Enum(0 1) Struct(0 1) Union(0 1) Trait(0) TraitAlias(0 1) Impl(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)); + Float(0 1) Bool(0) Err); spanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2 3) TupleStruct(0 1 2) Or(0) Path(0 1) Tuple(0) Box(0) Ref(0 1) Lit(0) Range(0 1 2) Slice(0) Rest Paren(0) MacCall(0)); @@ -691,7 +697,7 @@ fn is_escaped_literal_token(token: &Token, unescaped: Symbol) -> bool { Token { kind: TokenKind::Literal(lit), span: _, - } => match Lit::from_lit_token(*lit, DUMMY_SP) { + } => match Lit::from_token_lit(*lit, DUMMY_SP) { Ok(lit) => is_escaped_literal(&lit, unescaped), Err(_) => false, }, @@ -722,7 +728,7 @@ fn is_escaped_literal_macro_arg(arg: &MacArgsEq, unescaped: Symbol) -> bool { fn is_escaped_literal(lit: &Lit, unescaped: Symbol) -> bool { match lit { Lit { - token: + token_lit: token::Lit { kind: token::LitKind::Str, symbol: _, @@ -735,10 +741,10 @@ fn is_escaped_literal(lit: &Lit, unescaped: Symbol) -> bool { } } -impl SpanlessEq for LazyTokenStream { +impl SpanlessEq for LazyAttrTokenStream { fn eq(&self, other: &Self) -> bool { - let this = self.create_token_stream(); - let other = other.create_token_stream(); + let this = self.to_attr_token_stream(); + let other = other.to_attr_token_stream(); SpanlessEq::eq(&this, &other) } } @@ -746,26 +752,26 @@ impl SpanlessEq for LazyTokenStream { impl SpanlessEq for AttrKind { fn eq(&self, other: &Self) -> bool { match (self, other) { - (AttrKind::Normal(item, tokens), AttrKind::Normal(item2, tokens2)) => { - SpanlessEq::eq(item, item2) && SpanlessEq::eq(tokens, tokens2) + (AttrKind::Normal(normal), AttrKind::Normal(normal2)) => { + SpanlessEq::eq(normal, normal2) } (AttrKind::DocComment(kind, symbol), AttrKind::DocComment(kind2, symbol2)) => { SpanlessEq::eq(kind, kind2) && SpanlessEq::eq(symbol, symbol2) } - (AttrKind::DocComment(kind, unescaped), AttrKind::Normal(item2, _tokens)) => { + (AttrKind::DocComment(kind, unescaped), AttrKind::Normal(normal2)) => { match kind { CommentKind::Line | CommentKind::Block => {} } let path = Path::from_ident(Ident::with_dummy_span(sym::doc)); - SpanlessEq::eq(&path, &item2.path) - && match &item2.args { + SpanlessEq::eq(&path, &normal2.item.path) + && match &normal2.item.args { MacArgs::Empty | MacArgs::Delimited(..) => false, MacArgs::Eq(_span, token) => { is_escaped_literal_macro_arg(token, *unescaped) } } } - (AttrKind::Normal(..), AttrKind::DocComment(..)) => SpanlessEq::eq(other, self), + (AttrKind::Normal(_), AttrKind::DocComment(..)) => SpanlessEq::eq(other, self), } } } diff --git a/vendor/syn/tests/debug/gen.rs b/vendor/syn/tests/debug/gen.rs index a49ee6c92..cfd63d117 100644 --- a/vendor/syn/tests/debug/gen.rs +++ b/vendor/syn/tests/debug/gen.rs @@ -2215,22 +2215,22 @@ impl Debug for Lite<syn::GenericArgument> { formatter.write_str(")")?; Ok(()) } - syn::GenericArgument::Binding(_val) => { - formatter.write_str("Binding")?; + syn::GenericArgument::Const(_val) => { + formatter.write_str("Const")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::GenericArgument::Constraint(_val) => { - formatter.write_str("Constraint")?; + syn::GenericArgument::Binding(_val) => { + formatter.write_str("Binding")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; Ok(()) } - syn::GenericArgument::Const(_val) => { - formatter.write_str("Const")?; + syn::GenericArgument::Constraint(_val) => { + formatter.write_str("Constraint")?; formatter.write_str("(")?; Debug::fmt(Lite(_val), formatter)?; formatter.write_str(")")?; diff --git a/vendor/syn/tests/regression/issue1108.rs b/vendor/syn/tests/regression/issue1108.rs index 11a82adaa..4fd30c0c7 100644 --- a/vendor/syn/tests/regression/issue1108.rs +++ b/vendor/syn/tests/regression/issue1108.rs @@ -1,5 +1,5 @@ #[test] fn issue1108() { let data = "impl<x<>>::x for"; - let _ = syn::parse_file(data); + _ = syn::parse_file(data); } diff --git a/vendor/syn/tests/repo/mod.rs b/vendor/syn/tests/repo/mod.rs index 0bafe6714..4c7be853b 100644 --- a/vendor/syn/tests/repo/mod.rs +++ b/vendor/syn/tests/repo/mod.rs @@ -10,10 +10,10 @@ use std::path::Path; use tar::Archive; use walkdir::DirEntry; -const REVISION: &str = "ee160f2f5e73b6f5954bc33f059c316d9e8582c4"; +const REVISION: &str = "98ad6a5519651af36e246c0335c964dd52c554ba"; #[rustfmt::skip] -static EXCLUDE: &[&str] = &[ +static EXCLUDE_FILES: &[&str] = &[ // TODO: impl ~const T {} // https://github.com/dtolnay/syn/issues/1051 "src/test/ui/rfc-2632-const-trait-impl/syntax.rs", @@ -33,6 +33,21 @@ static EXCLUDE: &[&str] = &[ "src/tools/rustfmt/tests/source/trait.rs", "src/tools/rustfmt/tests/target/trait.rs", + // Various extensions to Rust syntax made up by rust-analyzer + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0012_type_item_where_clause.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0040_crate_keyword_vis.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0131_existential_type.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0179_use_tree_abs_star.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0188_const_param_default_path.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0015_use_tree.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0029_range_forms.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0051_parameter_attrs.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0055_dot_dot_dot.rs", + "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0068_item_modifiers.rs", + "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0031_block_inner_attrs.rs", + "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs", + "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs", + // Placeholder syntax for "throw expressions" "src/test/pretty/yeet-expr.rs", "src/test/ui/try-trait/yeet-for-option.rs", @@ -41,7 +56,9 @@ static EXCLUDE: &[&str] = &[ // Excessive nesting "src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs", - // Testing rustfmt on invalid syntax + // Testing tools on invalid syntax + "src/test/run-make/translation/test.rs", + "src/test/ui/generics/issue-94432-garbage-ice.rs", "src/tools/rustfmt/tests/coverage/target/comments.rs", "src/tools/rustfmt/tests/parser/issue-4126/invalid.rs", "src/tools/rustfmt/tests/parser/issue_4418.rs", @@ -54,8 +71,8 @@ static EXCLUDE: &[&str] = &[ "src/tools/rustfmt/tests/target/configs/spaces_around_ranges/true.rs", "src/tools/rustfmt/tests/target/type.rs", - // Testing compiler diagnostic localization on invalid syntax - "src/test/run-make/translation/basic-translation.rs", + // Generated file containing a top-level expression, used with `include!` + "compiler/rustc_codegen_gcc/src/intrinsic/archs.rs", // Clippy lint lists represented as expressions "src/tools/clippy/clippy_lints/src/lib.deprecated.rs", @@ -73,9 +90,6 @@ static EXCLUDE: &[&str] = &[ "src/tools/clippy/clippy_lints/src/lib.register_suspicious.rs", // Not actually test cases - "src/test/rustdoc-ui/test-compile-fail2.rs", - "src/test/rustdoc-ui/test-compile-fail3.rs", - "src/test/ui/json-bom-plus-crlf-multifile-aux.rs", "src/test/ui/lint/expansion-time-include.rs", "src/test/ui/macros/auxiliary/macro-comma-support.rs", "src/test/ui/macros/auxiliary/macro-include-items-expr.rs", @@ -84,38 +98,52 @@ static EXCLUDE: &[&str] = &[ "src/test/ui/parser/issues/auxiliary/issue-21146-inc.rs", ]; +#[rustfmt::skip] +static EXCLUDE_DIRS: &[&str] = &[ + // Inputs that intentionally do not parse + "src/tools/rust-analyzer/crates/parser/test_data/parser/err", + "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/err", + + // Inputs that lex but do not necessarily parse + "src/tools/rust-analyzer/crates/parser/test_data/lexer", + + // Inputs that used to crash rust-analyzer, but aren't necessarily supposed to parse + "src/tools/rust-analyzer/crates/syntax/test_data/parser/fuzz-failures", + "src/tools/rust-analyzer/crates/syntax/test_data/reparse/fuzz-failures", +]; + pub fn base_dir_filter(entry: &DirEntry) -> bool { let path = entry.path(); - if path.is_dir() { - return true; // otherwise walkdir does not visit the files - } - if path.extension().map_or(true, |e| e != "rs") { - return false; - } let mut path_string = path.to_string_lossy(); if cfg!(windows) { path_string = path_string.replace('\\', "/").into(); } - let path = if let Some(path) = path_string.strip_prefix("tests/rust/") { + let path_string = if path_string == "tests/rust" { + return true; + } else if let Some(path) = path_string.strip_prefix("tests/rust/") { path } else { panic!("unexpected path in Rust dist: {}", path_string); }; - if path.starts_with("src/test/compile-fail") || path.starts_with("src/test/rustfix") { + if path.is_dir() { + return !EXCLUDE_DIRS.contains(&path_string); + } + + if path.extension().map_or(true, |e| e != "rs") { return false; } - if path.starts_with("src/test/ui") { - let stderr_path = entry.path().with_extension("stderr"); + if path_string.starts_with("src/test/ui") || path_string.starts_with("src/test/rustdoc-ui") { + let stderr_path = path.with_extension("stderr"); if stderr_path.exists() { // Expected to fail in some way return false; } } - !EXCLUDE.contains(&path) + !EXCLUDE_FILES.contains(&path_string) } #[allow(dead_code)] @@ -137,10 +165,17 @@ pub fn clone_rust() { } let mut missing = String::new(); let test_src = Path::new("tests/rust"); - for exclude in EXCLUDE { - if !test_src.join(exclude).exists() { + for exclude in EXCLUDE_FILES { + if !test_src.join(exclude).is_file() { + missing += "\ntests/rust/"; + missing += exclude; + } + } + for exclude in EXCLUDE_DIRS { + if !test_src.join(exclude).is_dir() { missing += "\ntests/rust/"; missing += exclude; + missing += "/"; } } if !missing.is_empty() { diff --git a/vendor/syn/tests/test_parse_stream.rs b/vendor/syn/tests/test_parse_stream.rs index 76bd06577..cc14fa032 100644 --- a/vendor/syn/tests/test_parse_stream.rs +++ b/vendor/syn/tests/test_parse_stream.rs @@ -4,9 +4,9 @@ use syn::{Ident, Token}; #[test] fn test_peek() { - let _ = |input: ParseStream| { - let _ = input.peek(Ident); - let _ = input.peek(Ident::peek_any); - let _ = input.peek(Token![::]); + _ = |input: ParseStream| { + _ = input.peek(Ident); + _ = input.peek(Ident::peek_any); + _ = input.peek(Token![::]); }; } diff --git a/vendor/syn/tests/test_precedence.rs b/vendor/syn/tests/test_precedence.rs index bd273a565..dbcd74f16 100644 --- a/vendor/syn/tests/test_precedence.rs +++ b/vendor/syn/tests/test_precedence.rs @@ -24,6 +24,7 @@ extern crate rustc_ast; extern crate rustc_data_structures; extern crate rustc_span; +extern crate thin_vec; use crate::common::eq::SpanlessEq; use crate::common::parse; @@ -207,10 +208,10 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> { }; use rustc_ast::mut_visit::{noop_visit_generic_arg, noop_visit_local, MutVisitor}; use rustc_data_structures::map_in_place::MapInPlace; - use rustc_data_structures::thin_vec::ThinVec; use rustc_span::DUMMY_SP; use std::mem; use std::ops::DerefMut; + use thin_vec::ThinVec; struct BracketsVisitor { failed: bool, @@ -243,7 +244,7 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> { } fn noop_visit_expr<T: MutVisitor>(e: &mut Expr, vis: &mut T) { - use rustc_ast::mut_visit::{noop_visit_expr, visit_thin_attrs}; + use rustc_ast::mut_visit::{noop_visit_expr, visit_attrs}; match &mut e.kind { ExprKind::AddrOf(BorrowKind::Raw, ..) => {} ExprKind::Struct(expr) => { @@ -261,7 +262,7 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> { } vis.visit_id(&mut e.id); vis.visit_span(&mut e.span); - visit_thin_attrs(&mut e.attrs, vis); + visit_attrs(&mut e.attrs, vis); } _ => noop_visit_expr(e, vis), } @@ -322,15 +323,15 @@ fn librustc_brackets(mut librustc_expr: P<ast::Expr>) -> Option<P<ast::Expr>> { // types yet. We'll look into comparing those in the future. For now // focus on expressions appearing in other places. fn visit_pat(&mut self, pat: &mut P<Pat>) { - let _ = pat; + _ = pat; } fn visit_ty(&mut self, ty: &mut P<Ty>) { - let _ = ty; + _ = ty; } fn visit_attribute(&mut self, attr: &mut Attribute) { - let _ = attr; + _ = attr; } } @@ -426,7 +427,7 @@ fn syn_brackets(syn_expr: syn::Expr) -> syn::Expr { fn collect_exprs(file: syn::File) -> Vec<syn::Expr> { use syn::fold::Fold; use syn::punctuated::Punctuated; - use syn::{token, Expr, ExprTuple, Path}; + use syn::{token, ConstParam, Expr, ExprTuple, Path}; struct CollectExprs(Vec<Expr>); impl Fold for CollectExprs { @@ -447,6 +448,10 @@ fn collect_exprs(file: syn::File) -> Vec<syn::Expr> { // Skip traversing into const generic path arguments path } + + fn fold_const_param(&mut self, const_param: ConstParam) -> ConstParam { + const_param + } } let mut folder = CollectExprs(vec![]); diff --git a/vendor/syn/tests/test_size.rs b/vendor/syn/tests/test_size.rs index e172df2bc..02b0700f0 100644 --- a/vendor/syn/tests/test_size.rs +++ b/vendor/syn/tests/test_size.rs @@ -5,17 +5,17 @@ use syn::{Expr, Item, Lit, Pat, Type}; #[test] fn test_expr_size() { - assert_eq!(mem::size_of::<Expr>(), 280); + assert_eq!(mem::size_of::<Expr>(), 264); } #[test] fn test_item_size() { - assert_eq!(mem::size_of::<Item>(), 344); + assert_eq!(mem::size_of::<Item>(), 320); } #[test] fn test_type_size() { - assert_eq!(mem::size_of::<Type>(), 304); + assert_eq!(mem::size_of::<Type>(), 280); } #[test] @@ -25,5 +25,5 @@ fn test_pat_size() { #[test] fn test_lit_size() { - assert_eq!(mem::size_of::<Lit>(), 40); + assert_eq!(mem::size_of::<Lit>(), 32); } |