summaryrefslogtreecommitdiffstats
path: root/vendor/syn/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/syn/tests
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/syn/tests')
-rw-r--r--vendor/syn/tests/common/eq.rs6
-rw-r--r--vendor/syn/tests/macros/mod.rs15
-rw-r--r--vendor/syn/tests/repo/mod.rs26
-rw-r--r--vendor/syn/tests/test_expr.rs2
-rw-r--r--vendor/syn/tests/test_round_trip.rs5
5 files changed, 36 insertions, 18 deletions
diff --git a/vendor/syn/tests/common/eq.rs b/vendor/syn/tests/common/eq.rs
index 8ca04b6a2..7fe75d49b 100644
--- a/vendor/syn/tests/common/eq.rs
+++ b/vendor/syn/tests/common/eq.rs
@@ -457,7 +457,7 @@ 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!(Closure; binder capture_clause constness asyncness movability fn_decl body !fn_decl_span !fn_arg_span);
-spanless_eq_struct!(ConstItem; defaultness ty expr);
+spanless_eq_struct!(ConstItem; defaultness generics ty expr);
spanless_eq_struct!(Crate; attrs items spans id is_placeholder);
spanless_eq_struct!(DelimArgs; dspan delim tokens);
spanless_eq_struct!(EnumDef; variants);
@@ -586,8 +586,8 @@ spanless_eq_enum!(ExprKind; Array(0) ConstBlock(0) Call(0 1) MethodCall(0)
Block(0 1) Async(0 1) Await(0 1) 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) OffsetOf(0 1) MacCall(0)
- Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) Yeet(0) IncludedBytes(0)
- FormatArgs(0) Err);
+ Struct(0) Repeat(0 1) Paren(0) Try(0) Yield(0) Yeet(0) Become(0)
+ IncludedBytes(0) FormatArgs(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));
diff --git a/vendor/syn/tests/macros/mod.rs b/vendor/syn/tests/macros/mod.rs
index 5ca88b083..3bfbe0389 100644
--- a/vendor/syn/tests/macros/mod.rs
+++ b/vendor/syn/tests/macros/mod.rs
@@ -38,14 +38,20 @@ macro_rules! snapshot_impl {
let $expr = crate::macros::Tokens::parse::<$t>($expr).unwrap();
let debug = crate::macros::debug::Lite(&$expr);
if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ #[allow(clippy::needless_raw_string_hashes)] // https://github.com/mitsuhiko/insta/issues/389
+ {
+ insta::assert_debug_snapshot!(debug, @$snapshot);
+ }
}
};
(($($expr:tt)*) as $t:ty, @$snapshot:literal) => {{
let syntax_tree = crate::macros::Tokens::parse::<$t>($($expr)*).unwrap();
let debug = crate::macros::debug::Lite(&syntax_tree);
if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ #[allow(clippy::needless_raw_string_hashes)]
+ {
+ insta::assert_debug_snapshot!(debug, @$snapshot);
+ }
}
syntax_tree
}};
@@ -53,7 +59,10 @@ macro_rules! snapshot_impl {
let syntax_tree = $($expr)*;
let debug = crate::macros::debug::Lite(&syntax_tree);
if !cfg!(miri) {
- insta::assert_debug_snapshot!(debug, @$snapshot);
+ #[allow(clippy::needless_raw_string_hashes)]
+ {
+ insta::assert_debug_snapshot!(debug, @$snapshot);
+ }
}
syntax_tree
}};
diff --git a/vendor/syn/tests/repo/mod.rs b/vendor/syn/tests/repo/mod.rs
index cec42a6c6..780ad823b 100644
--- a/vendor/syn/tests/repo/mod.rs
+++ b/vendor/syn/tests/repo/mod.rs
@@ -13,10 +13,17 @@ use std::path::{Path, PathBuf};
use tar::Archive;
use walkdir::{DirEntry, WalkDir};
-const REVISION: &str = "5e1d3299a290026b85787bc9c7e72bcc53ac283f";
+const REVISION: &str = "85bf07972a1041b9e25393b803d0e006bec3eaaf";
#[rustfmt::skip]
static EXCLUDE_FILES: &[&str] = &[
+ // CStr literals (c"…") are not yet supported by rustc's lexer
+ // https://github.com/rust-lang/rust/issues/113333
+ "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",
+ "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs",
+ "tests/ui/explicit-tail-calls/return-lifetime-sub.rs",
+
// TODO: non-lifetime binders: `where for<'a, T> &'a Struct<T>: Trait`
// https://github.com/dtolnay/syn/issues/1435
"tests/rustdoc-json/non_lifetime_binders.rs",
@@ -24,6 +31,7 @@ static EXCLUDE_FILES: &[&str] = &[
// TODO: return type notation: `where T: Trait<method(): Send>`
// https://github.com/dtolnay/syn/issues/1434
+ "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0208_associated_return_type_bounds.rs",
"tests/ui/associated-type-bounds/return-type-notation/basic.rs",
"tests/ui/feature-gates/feature-gate-return_type_notation.rs",
@@ -37,11 +45,14 @@ static EXCLUDE_FILES: &[&str] = &[
// Need at least one trait in impl Trait, no such type as impl 'static
"tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs",
+ // Negative polarity trait bound: `where T: !Copy`
+ "src/tools/rustfmt/tests/target/negative-bounds.rs",
+
// Lifetime bound inside for<>: `T: ~const ?for<'a: 'b> Trait<'a>`
- "tests/ui/rfc-2632-const-trait-impl/tilde-const-syntax.rs",
+ "tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-syntax.rs",
// Const impl that is not a trait impl: `impl ~const T {}`
- "tests/ui/rfc-2632-const-trait-impl/syntax.rs",
+ "tests/ui/rfcs/rfc-2632-const-trait-impl/syntax.rs",
// Deprecated anonymous parameter syntax in traits
"src/tools/rustfmt/tests/source/trait.rs",
@@ -63,6 +74,7 @@ static EXCLUDE_FILES: &[&str] = &[
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rs",
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0104_path_fn_trait_args.rs",
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0202_typepathfn_with_coloncolon.rs",
+ "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0209_bare_dyn_types_with_paren_as_generic_args.rs",
"src/tools/rustfmt/tests/source/attrib.rs",
"src/tools/rustfmt/tests/source/closure.rs",
"src/tools/rustfmt/tests/source/existential_type.rs",
@@ -85,8 +97,8 @@ static EXCLUDE_FILES: &[&str] = &[
"tests/codegen-units/item-collection/non-generic-closures.rs",
"tests/debuginfo/recursive-enum.rs",
"tests/pretty/closure-reform-pretty.rs",
- "tests/run-make-fulldeps/reproducible-build-2/reproducible-build.rs",
- "tests/run-make-fulldeps/reproducible-build/reproducible-build.rs",
+ "tests/run-make/reproducible-build-2/reproducible-build.rs",
+ "tests/run-make/reproducible-build/reproducible-build.rs",
"tests/ui/auxiliary/typeid-intrinsic-aux1.rs",
"tests/ui/auxiliary/typeid-intrinsic-aux2.rs",
"tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs",
@@ -95,10 +107,6 @@ static EXCLUDE_FILES: &[&str] = &[
"tests/ui/lifetimes/bare-trait-object.rs",
"tests/ui/parser/bounds-obj-parens.rs",
- // Old type ascription expression syntax
- "src/tools/rustfmt/tests/source/type-ascription.rs",
- "src/tools/rustfmt/tests/target/type-ascription.rs",
-
// Obsolete box syntax
"src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0132_box_expr.rs",
diff --git a/vendor/syn/tests/test_expr.rs b/vendor/syn/tests/test_expr.rs
index c7230c6dc..5d529bf14 100644
--- a/vendor/syn/tests/test_expr.rs
+++ b/vendor/syn/tests/test_expr.rs
@@ -85,7 +85,7 @@ fn test_tuple_multi_index() {
assert_eq!(expected, syn::parse_str(input).unwrap());
}
- for tokens in vec![
+ for tokens in [
quote!(tuple.0.0),
quote!(tuple .0.0),
quote!(tuple. 0.0),
diff --git a/vendor/syn/tests/test_round_trip.rs b/vendor/syn/tests/test_round_trip.rs
index 0ef47b20f..c0af30d29 100644
--- a/vendor/syn/tests/test_round_trip.rs
+++ b/vendor/syn/tests/test_round_trip.rs
@@ -33,6 +33,7 @@ use rustc_errors::{translation, Diagnostic, PResult};
use rustc_session::parse::ParseSess;
use rustc_span::source_map::FilePathMapping;
use rustc_span::FileName;
+use std::borrow::Cow;
use std::fs;
use std::panic;
use std::path::Path;
@@ -154,7 +155,7 @@ fn librustc_parse(content: String, sess: &ParseSess) -> PResult<Crate> {
parse::parse_crate_from_source_str(name, content, sess)
}
-fn translate_message(diagnostic: &Diagnostic) -> String {
+fn translate_message(diagnostic: &Diagnostic) -> Cow<'static, str> {
thread_local! {
static FLUENT_BUNDLE: LazyFallbackBundle = {
let locale_resources = rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec();
@@ -186,7 +187,7 @@ fn translate_message(diagnostic: &Diagnostic) -> String {
let mut err = Vec::new();
let translated = fluent_bundle.format_pattern(value, Some(&args), &mut err);
assert!(err.is_empty());
- translated.into_owned()
+ Cow::Owned(translated.into_owned())
})
}