summaryrefslogtreecommitdiffstats
path: root/vendor/syn/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/syn/tests')
-rw-r--r--vendor/syn/tests/common/eq.rs4
-rw-r--r--vendor/syn/tests/repo/mod.rs25
-rw-r--r--vendor/syn/tests/test_expr.rs33
3 files changed, 55 insertions, 7 deletions
diff --git a/vendor/syn/tests/common/eq.rs b/vendor/syn/tests/common/eq.rs
index 3c2b1c124..8e334c330 100644
--- a/vendor/syn/tests/common/eq.rs
+++ b/vendor/syn/tests/common/eq.rs
@@ -65,6 +65,7 @@ use rustc_ast::ast::FormatOptions;
use rustc_ast::ast::FormatPlaceholder;
use rustc_ast::ast::FormatSign;
use rustc_ast::ast::FormatTrait;
+use rustc_ast::ast::GenBlockKind;
use rustc_ast::ast::GenericArg;
use rustc_ast::ast::GenericArgs;
use rustc_ast::ast::GenericBound;
@@ -545,6 +546,7 @@ spanless_eq_enum!(FormatCount; Literal(0) Argument(0));
spanless_eq_enum!(FormatDebugHex; Lower Upper);
spanless_eq_enum!(FormatSign; Plus Minus);
spanless_eq_enum!(FormatTrait; Display Debug LowerExp UpperExp Octal Pointer Binary LowerHex UpperHex);
+spanless_eq_enum!(GenBlockKind; Async Gen);
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));
@@ -582,7 +584,7 @@ spanless_eq_enum!(WherePredicate; BoundPredicate(0) RegionPredicate(0) EqPredica
spanless_eq_enum!(ExprKind; Array(0) ConstBlock(0) Call(0 1) MethodCall(0)
Tup(0) Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) Type(0 1) Let(0 1 2 3)
If(0 1 2) While(0 1 2) ForLoop(0 1 2 3) Loop(0 1 2) Match(0 1) Closure(0)
- Block(0 1) Async(0 1) Await(0 1) TryBlock(0) Assign(0 1 2) AssignOp(0 1 2)
+ Block(0 1) Gen(0 1 2) Await(0 1) TryBlock(0) Assign(0 1 2) AssignOp(0 1 2)
Field(0 1) Index(0 1 2) Underscore Range(0 1 2) Path(0 1) AddrOf(0 1 2)
Break(0 1) Continue(0) Ret(0) InlineAsm(0) OffsetOf(0 1) MacCall(0)
Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) Yeet(0) Become(0)
diff --git a/vendor/syn/tests/repo/mod.rs b/vendor/syn/tests/repo/mod.rs
index 61d5ff35f..9d5dfa2f7 100644
--- a/vendor/syn/tests/repo/mod.rs
+++ b/vendor/syn/tests/repo/mod.rs
@@ -13,12 +13,14 @@ use std::path::{Path, PathBuf};
use tar::Archive;
use walkdir::{DirEntry, WalkDir};
-const REVISION: &str = "9f5fc1bd443f59583e7af0d94d289f95fe1e20c4";
+const REVISION: &str = "a2f5f9691b6ce64c1703feaf9363710dfd7a56cf";
#[rustfmt::skip]
static EXCLUDE_FILES: &[&str] = &[
// TODO: CStr literals: c"…", cr"…"
// https://github.com/dtolnay/syn/issues/1502
+ "src/tools/clippy/tests/ui/needless_raw_string.rs",
+ "src/tools/clippy/tests/ui/needless_raw_string_hashes.rs",
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs",
// TODO: explicit tail calls: `become _g()`
@@ -27,7 +29,12 @@ static EXCLUDE_FILES: &[&str] = &[
// TODO: non-lifetime binders: `where for<'a, T> &'a Struct<T>: Trait`
// https://github.com/dtolnay/syn/issues/1435
+ "src/tools/rustfmt/tests/source/issue_5721.rs",
+ "src/tools/rustfmt/tests/source/non-lifetime-binders.rs",
+ "src/tools/rustfmt/tests/target/issue_5721.rs",
+ "src/tools/rustfmt/tests/target/non-lifetime-binders.rs",
"tests/rustdoc-json/non_lifetime_binders.rs",
+ "tests/rustdoc/inline_cross/auxiliary/non_lifetime_binders.rs",
"tests/rustdoc/non_lifetime_binders.rs",
// TODO: return type notation: `where T: Trait<method(): Send>`
@@ -36,6 +43,19 @@ static EXCLUDE_FILES: &[&str] = &[
"tests/ui/associated-type-bounds/return-type-notation/basic.rs",
"tests/ui/feature-gates/feature-gate-return_type_notation.rs",
+ // TODO: lazy type alias syntax with where-clause in trailing position
+ // https://github.com/dtolnay/syn/issues/1525
+ "tests/rustdoc/typedef-inner-variants-lazy_type_alias.rs",
+
+ // TODO: gen blocks and functions
+ // https://github.com/dtolnay/syn/issues/1526
+ "tests/ui/coroutine/gen_block_is_iter.rs",
+ "tests/ui/coroutine/gen_block_iterate.rs",
+
+ // TODO: struct literal in match guard
+ // https://github.com/dtolnay/syn/issues/1527
+ "tests/ui/parser/struct-literal-in-match-guard.rs",
+
// Compile-fail expr parameter in const generic position: f::<1 + 2>()
"tests/ui/const-generics/early/closing-args-token.rs",
"tests/ui/const-generics/early/const-expression-parameter.rs",
@@ -108,9 +128,6 @@ static EXCLUDE_FILES: &[&str] = &[
"tests/ui/lifetimes/bare-trait-object.rs",
"tests/ui/parser/bounds-obj-parens.rs",
- // Obsolete box syntax
- "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0132_box_expr.rs",
-
// Invalid unparenthesized range pattern inside slice pattern: `[1..]`
"tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs",
diff --git a/vendor/syn/tests/test_expr.rs b/vendor/syn/tests/test_expr.rs
index 5d529bf14..2574ea548 100644
--- a/vendor/syn/tests/test_expr.rs
+++ b/vendor/syn/tests/test_expr.rs
@@ -1,11 +1,11 @@
-#![allow(clippy::uninlined_format_args)]
+#![allow(clippy::single_element_loop, clippy::uninlined_format_args)]
#[macro_use]
mod macros;
use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
use quote::quote;
-use syn::{Expr, ExprRange};
+use syn::{Expr, ExprRange, Stmt};
#[test]
fn test_expr_parse() {
@@ -310,3 +310,32 @@ fn test_ranges() {
syn::parse_str::<Expr>("lo...").unwrap_err();
syn::parse_str::<Expr>("lo...hi").unwrap_err();
}
+
+#[test]
+fn test_ambiguous_label() {
+ for stmt in [
+ quote! {
+ return 'label: loop { break 'label 42; };
+ },
+ quote! {
+ break ('label: loop { break 'label 42; });
+ },
+ quote! {
+ break 1 + 'label: loop { break 'label 42; };
+ },
+ quote! {
+ break 'outer 'inner: loop { break 'inner 42; };
+ },
+ ] {
+ syn::parse2::<Stmt>(stmt).unwrap();
+ }
+
+ for stmt in [
+ // Parentheses required. See https://github.com/rust-lang/rust/pull/87026.
+ quote! {
+ break 'label: loop { break 'label 42; };
+ },
+ ] {
+ syn::parse2::<Stmt>(stmt).unwrap_err();
+ }
+}