From 69e5ff0b16d114c281cee52a2fe6d663af7fec18 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 28 Feb 2024 18:23:36 -0800 Subject: [PATCH 01/15] Update test suite to nightly-2024-02-29 --- tests/test_round_trip.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs index a320785436..3c49185124 100644 --- a/tests/test_round_trip.rs +++ b/tests/test_round_trip.rs @@ -30,7 +30,7 @@ use rustc_ast::ast::{ use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast_pretty::pprust; use rustc_error_messages::{DiagnosticMessage, LazyFallbackBundle}; -use rustc_errors::{translation, Diagnostic, PResult}; +use rustc_errors::{translation, Diag, PResult}; use rustc_session::parse::ParseSess; use rustc_span::source_map::FilePathMapping; use rustc_span::FileName; @@ -156,7 +156,7 @@ fn librustc_parse(content: String, sess: &ParseSess) -> PResult { parse::parse_crate_from_source_str(name, content, sess) } -fn translate_message(diagnostic: &Diagnostic) -> Cow<'static, str> { +fn translate_message(diagnostic: &Diag) -> Cow<'static, str> { thread_local! { static FLUENT_BUNDLE: LazyFallbackBundle = { let locale_resources = rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(); From 8f1fb52d9c0353a3f234a617aef1724ada149331 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 28 Feb 2024 19:12:04 -0800 Subject: [PATCH 02/15] Update benchmark to nightly-2024-02-29 --- benches/rust.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benches/rust.rs b/benches/rust.rs index 2f337089ef..47cd76311f 100644 --- a/benches/rust.rs +++ b/benches/rust.rs @@ -54,7 +54,7 @@ mod librustc_parse { use rustc_data_structures::sync::Lrc; use rustc_error_messages::FluentBundle; - use rustc_errors::{emitter::Emitter, translation::Translate, DiagCtxt, Diagnostic}; + use rustc_errors::{emitter::Emitter, translation::Translate, DiagCtxt, DiagInner}; use rustc_session::parse::ParseSess; use rustc_span::source_map::{FilePathMapping, SourceMap}; use rustc_span::{edition::Edition, FileName}; @@ -63,7 +63,7 @@ mod librustc_parse { struct SilentEmitter; impl Emitter for SilentEmitter { - fn emit_diagnostic(&mut self, _diag: Diagnostic) {} + fn emit_diagnostic(&mut self, _diag: DiagInner) {} fn source_map(&self) -> Option<&Lrc> { None } From d5e079bfc2c0d27ae658134cf7f0ed7bfcc5abdc Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 29 Feb 2024 20:10:48 -0800 Subject: [PATCH 03/15] Update benchmark to nightly-2024-03-01 --- benches/rust.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benches/rust.rs b/benches/rust.rs index 47cd76311f..bfa3a17f4a 100644 --- a/benches/rust.rs +++ b/benches/rust.rs @@ -81,7 +81,7 @@ mod librustc_parse { rustc_span::create_session_if_not_set_then(Edition::Edition2018, |_| { let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = Box::new(SilentEmitter); - let handler = DiagCtxt::with_emitter(emitter); + let handler = DiagCtxt::new(emitter); let sess = ParseSess::with_dcx(handler, source_map); if let Err(diagnostic) = rustc_parse::parse_crate_from_source_str( FileName::Custom("bench".to_owned()), From 94e3d765d7c98d3f900c7d5088c1ecb0c8da3b21 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 1 Mar 2024 23:09:36 -0800 Subject: [PATCH 04/15] Update test suite to nightly-2024-03-02 --- tests/common/eq.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/common/eq.rs b/tests/common/eq.rs index e96730d344..147a2fc385 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -137,6 +137,7 @@ use rustc_ast::ast::TraitRef; use rustc_ast::ast::Ty; use rustc_ast::ast::TyAlias; use rustc_ast::ast::TyAliasWhereClause; +use rustc_ast::ast::TyAliasWhereClauses; use rustc_ast::ast::TyKind; use rustc_ast::ast::UintTy; use rustc_ast::ast::UnOp; @@ -520,8 +521,9 @@ spanless_eq_struct!(Trait; unsafety is_auto generics bounds items); spanless_eq_struct!(TraitBoundModifiers; constness asyncness polarity); spanless_eq_struct!(TraitRef; path ref_id); spanless_eq_struct!(Ty; id kind span tokens); -spanless_eq_struct!(TyAlias; defaultness generics where_clauses !where_predicates_split bounds ty); -spanless_eq_struct!(TyAliasWhereClause; !0 1); +spanless_eq_struct!(TyAlias; defaultness generics where_clauses bounds ty); +spanless_eq_struct!(TyAliasWhereClause; !has_where_token span); +spanless_eq_struct!(TyAliasWhereClauses; before after !split); spanless_eq_struct!(UseTree; prefix kind span); spanless_eq_struct!(Variant; attrs id span !vis ident data disr_expr is_placeholder); spanless_eq_struct!(Visibility; kind span tokens); From c35d639fc596b18850d7a2f391cc3d1554fd5570 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 6 Mar 2024 09:23:43 -0800 Subject: [PATCH 05/15] Update test suite to nightly-2024-03-03 --- tests/common/eq.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/eq.rs b/tests/common/eq.rs index 147a2fc385..b27d3c2140 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -496,7 +496,7 @@ spanless_eq_struct!(Item; attrs id span vis ident kind !tokens); spanless_eq_struct!(Label; ident); spanless_eq_struct!(Lifetime; id ident); spanless_eq_struct!(Lit; kind symbol suffix); -spanless_eq_struct!(Local; pat ty kind id span attrs !tokens); +spanless_eq_struct!(Local; id pat ty kind span colon_sp attrs !tokens); spanless_eq_struct!(MacCall; path args); spanless_eq_struct!(MacCallStmt; mac style attrs tokens); spanless_eq_struct!(MacroDef; body macro_rules); From ff6ebfbaa69c6385c7c4484a3ca8a878f008d2b0 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 6 Mar 2024 09:24:49 -0800 Subject: [PATCH 06/15] Update test suite to nightly-2024-03-04 --- tests/common/eq.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/eq.rs b/tests/common/eq.rs index b27d3c2140..2db11d645b 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -550,7 +550,7 @@ spanless_eq_enum!(ClosureBinder; NotPresent For(span generic_params)); spanless_eq_enum!(Const; Yes(0) No); spanless_eq_enum!(Defaultness; Default(0) Final); spanless_eq_enum!(Extern; None Implicit(0) Explicit(0 1)); -spanless_eq_enum!(FloatTy; F32 F64); +spanless_eq_enum!(FloatTy; F16 F32 F64 F128); spanless_eq_enum!(FnRetTy; Default(0) Ty(0)); spanless_eq_enum!(ForLoopKind; For ForAwait); spanless_eq_enum!(ForeignItemKind; Static(0 1 2) Fn(0) TyAlias(0) MacCall(0)); From 556b10bf201264172e4b840f8cf1be38b8d75738 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 6 Mar 2024 09:26:00 -0800 Subject: [PATCH 07/15] Update test suite to nightly-2024-03-06 --- tests/common/parse.rs | 4 +--- tests/test_round_trip.rs | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/common/parse.rs b/tests/common/parse.rs index dce0066251..2d00a62f46 100644 --- a/tests/common/parse.rs +++ b/tests/common/parse.rs @@ -8,15 +8,13 @@ extern crate rustc_span; 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 std::panic; pub fn librustc_expr(input: &str) -> Option> { match panic::catch_unwind(|| { let locale_resources = rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(); - let file_path_mapping = FilePathMapping::empty(); - let sess = ParseSess::new(locale_resources, file_path_mapping); + let sess = ParseSess::new(locale_resources); let e = parse::new_parser_from_source_str( &sess, FileName::Custom("test_precedence".to_string()), diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs index 3c49185124..7619f3bcb2 100644 --- a/tests/test_round_trip.rs +++ b/tests/test_round_trip.rs @@ -29,10 +29,9 @@ use rustc_ast::ast::{ }; use rustc_ast::mut_visit::{self, MutVisitor}; use rustc_ast_pretty::pprust; -use rustc_error_messages::{DiagnosticMessage, LazyFallbackBundle}; +use rustc_error_messages::{DiagMessage, LazyFallbackBundle}; use rustc_errors::{translation, Diag, PResult}; use rustc_session::parse::ParseSess; -use rustc_span::source_map::FilePathMapping; use rustc_span::FileName; use std::borrow::Cow; use std::fs; @@ -90,8 +89,7 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) { rustc_span::create_session_if_not_set_then(edition, |_| { let equal = match panic::catch_unwind(|| { let locale_resources = rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(); - let file_path_mapping = FilePathMapping::empty(); - let sess = ParseSess::new(locale_resources, file_path_mapping); + let sess = ParseSess::new(locale_resources); let before = match librustc_parse(content, &sess) { Ok(before) => before, Err(diagnostic) => { @@ -169,8 +167,8 @@ fn translate_message(diagnostic: &Diag) -> Cow<'static, str> { let args = translation::to_fluent_args(diagnostic.args.iter()); let (identifier, attr) = match message { - DiagnosticMessage::Str(msg) | DiagnosticMessage::Translated(msg) => return msg.clone(), - DiagnosticMessage::FluentIdentifier(identifier, attr) => (identifier, attr), + DiagMessage::Str(msg) | DiagMessage::Translated(msg) => return msg.clone(), + DiagMessage::FluentIdentifier(identifier, attr) => (identifier, attr), }; FLUENT_BUNDLE.with(|fluent_bundle| { From 7aef1edbba28afe1bb6f9ddc0b5095dcd5135849 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 6 Mar 2024 09:30:44 -0800 Subject: [PATCH 08/15] Temporarily disable nightly testing due to libLLVM link issue error: linking with `cc` failed: exit status: 1 | = note: LC_ALL="C" cc -m64 /tmp/rustcPYQ6e2/symbols.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.00.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.01.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.02.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.03.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.04.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.05.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.06.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.07.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.08.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.09.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.10.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.11.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.12.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.13.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.14.rcgu.o target/release/deps/test_precedence-6bd9c16ceacbfa39.test_precedence.516dd8336f7f7b26-cgu.15.rcgu.o -Wl,--as-needed -L target/release/deps -L ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib -Wl,-Bstatic target/release/deps/libreqwest-8f37388bf1e63fc8.rlib target/release/deps/librustls_pemfile-14952b380480d6bc.rlib target/release/deps/libhyper_tls-745fbbf90ab75538.rlib target/release/deps/libbase64-bed3832b4ea762bf.rlib target/release/deps/libipnet-86ea84f9be226c24.rlib target/release/deps/libtokio_native_tls-b768b6ee0a336e6d.rlib target/release/deps/libserde_urlencoded-3126bb0d70af8156.rlib target/release/deps/libryu-d6e6a36d6310bcaf.rlib target/release/deps/libmime-1d8c19b154c86676.rlib target/release/deps/libencoding_rs-f4d0330390db5820.rlib target/release/deps/libserde-770080fa0a5f3c5e.rlib target/release/deps/libnative_tls-52417f9597229180.rlib target/release/deps/libopenssl_probe-f8f2b8f74e81afe3.rlib target/release/deps/libopenssl-4434968f269261a4.rlib target/release/deps/libforeign_types-f0310e3b6d158a3d.rlib target/release/deps/libforeign_types_shared-6699a04f3d5ec3c6.rlib target/release/deps/libopenssl_sys-b3a6e8fa895015c4.rlib target/release/deps/libhyper-e21aafa58595f0fe.rlib target/release/deps/libwant-cf0de057298d16fa.rlib target/release/deps/libtry_lock-cf58c52febbc5084.rlib target/release/deps/libhttparse-f3b0a4fe841a550c.rlib target/release/deps/libh2-a6a1eeb6f47af968.rlib target/release/deps/libindexmap-33b660851ca98df4.rlib target/release/deps/libequivalent-ec054357584dda9d.rlib target/release/deps/libhashbrown-7062db69afd4722a.rlib target/release/deps/libtokio_util-f9a5800eb371f288.rlib target/release/deps/libfutures_sink-0793211ead5d4e6c.rlib target/release/deps/libtower_service-3a732bd16453ae7e.rlib target/release/deps/libtracing-021f8cc214139874.rlib target/release/deps/libtracing_core-c22b65bb5ec1efe9.rlib target/release/deps/libonce_cell-5e26bf523331b8e0.rlib target/release/deps/libfutures_channel-eb95f57d6814292d.rlib target/release/deps/libtokio-ed1061b4d4ac95f7.rlib target/release/deps/libnum_cpus-9eef86d3d5a42d34.rlib target/release/deps/libsocket2-d513d3c3ff81e5d3.rlib target/release/deps/libmio-b27fe499c1b81994.rlib target/release/deps/libsync_wrapper-33f1b3028f0801e2.rlib target/release/deps/libhttp_body-ceda74c453f7fb23.rlib target/release/deps/liblog-f39f6a76a0086a19.rlib target/release/deps/libfutures_util-9eee727b5281dd9b.rlib target/release/deps/libmemchr-128e6ce61c0ff28d.rlib target/release/deps/libfutures_io-08a182ea761140cc.rlib target/release/deps/libslab-0f1db8da5b920238.rlib target/release/deps/libpin_project_lite-1c23ed485efa1b06.rlib target/release/deps/libfutures_task-347d0c9381f7df63.rlib target/release/deps/libpin_utils-6a0d540de9e78030.rlib target/release/deps/libfutures_core-bb8b947a37521c5d.rlib target/release/deps/liburl-34d97ad5cb32b13d.rlib target/release/deps/libidna-95c7d6c417490fb9.rlib target/release/deps/libunicode_normalization-e823af57ae7ac103.rlib target/release/deps/libtinyvec-4197147df1778369.rlib target/release/deps/libtinyvec_macros-3018ee127284fcc5.rlib target/release/deps/libunicode_bidi-f6d5e0c2bba4f214.rlib target/release/deps/libform_urlencoded-5f9d984c143f197b.rlib target/release/deps/libpercent_encoding-946d30e440f29767.rlib target/release/deps/libhttp-62da6d27a134a4f7.rlib target/release/deps/libitoa-528a566125096185.rlib target/release/deps/libbytes-9966e59c6c110266.rlib target/release/deps/libfnv-82d0a40bbfed6e3d.rlib ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-0cd255ee414ee1b7.rlib ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-d94d981cfad2e302.rlib ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-bc5c85135ebc2d28.rlib ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-a783581261810918.rlib target/release/deps/libwalkdir-647cf2784a95b552.rlib target/release/deps/libsame_file-8a8cd61a6dfc5da4.rlib target/release/deps/libtar-05eaddab41c1519f.rlib target/release/deps/libxattr-3d63de4a63cd9eb5.rlib target/release/deps/librustix-78af8e3220ae7e77.rlib target/release/deps/libbitflags-4966c3690f2fe07a.rlib target/release/deps/liblinux_raw_sys-4606830f7af88dcd.rlib target/release/deps/libfiletime-aa12363e0730c517.rlib target/release/deps/liblibc-7e78217b691b030a.rlib target/release/deps/libflate2-729f997fb3ac51e3.rlib target/release/deps/libminiz_oxide-82c0cc6e343495b7.rlib target/release/deps/libadler-2c60a423fd987411.rlib target/release/deps/libcrc32fast-b7499fabf7baf5a4.rlib target/release/deps/libcfg_if-5f3dc791e81498f8.rlib target/release/deps/libanyhow-a3145dca07fb94b0.rlib target/release/deps/librayon-3e4ddcda55c922a3.rlib target/release/deps/librayon_core-b8488ed40d563cd8.rlib target/release/deps/libcrossbeam_deque-297ca0b1b68bf823.rlib target/release/deps/libcrossbeam_epoch-9ba9cfc2f4c9a373.rlib target/release/deps/libcrossbeam_utils-7dd2354cc82d25db.rlib target/release/deps/libeither-65a513fe0680a058.rlib target/release/deps/libsyn-89289939c25e83b8.rlib target/release/deps/libref_cast-35de96323af71460.rlib target/release/deps/libquote-6a37428a9e58049a.rlib target/release/deps/libproc_macro2-5a8ce56bdd6d2d2b.rlib target/release/deps/libunicode_ident-2651529e20c4ca92.rlib -L ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib -Wl,-Bdynamic -lrustc_driver-aa61d155f58600fb -L ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib -lstd-41777efa78699460 -Wl,-Bstatic ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-b7903030bc1640bf.rlib -Wl,-Bdynamic -lssl -lcrypto -lLLVM-18-rust-1.78.0-nightly -ldl -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc -Wl,--eh-frame-hdr -Wl,-z,noexecstack -L ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib -o target/release/deps/test_precedence-6bd9c16ceacbfa39 -Wl,--gc-sections -pie -Wl,-z,relro,-z,now -Wl,-O1 -Wl,--strip-debug -nodefaultlibs = note: /usr/bin/ld: cannot find -lLLVM-18-rust-1.78.0-nightly: No such file or directory collect2: error: ld returned 1 exit status --- build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index f14ce219dd..a74f73bc38 100644 --- a/build.rs +++ b/build.rs @@ -11,7 +11,9 @@ fn main() { // Note: add "/build.rs" to package.include in Cargo.toml if adding any // conditional compilation within the library. - if !unstable() { + if !unstable() || { + true // FIXME: waiting on https://github.com/rust-lang/rust/pull/121967 + } { println!("cargo:rustc-cfg=syn_disable_nightly_tests"); } } From ed545e75d8fdcab5078789ad25fc0efadc14e59b Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 7 Mar 2024 00:06:07 -0800 Subject: [PATCH 09/15] Work around doc_markdown lint in test_precedence warning: item in documentation is missing backticks --> tests/test_precedence.rs:3:40 | 3 | //! 1. Parse the file using syn into a syn::File. | ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown = note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_markdown)]` help: try | 3 | //! 1. Parse the file using syn into a `syn::File`. | ~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:4:22 | 4 | //! 2. Extract every syn::Expr from the file. | ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 4 | //! 2. Extract every `syn::Expr` from the file. | ~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:6:36 | 6 | //! 4. Parse the source code using librustc_parse into a rustc_ast::Expr. | ^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 6 | //! 4. Parse the source code using `librustc_parse` into a rustc_ast::Expr. | ~~~~~~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:6:58 | 6 | //! 4. Parse the source code using librustc_parse into a rustc_ast::Expr. | ^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 6 | //! 4. Parse the source code using librustc_parse into a `rustc_ast::Expr`. | ~~~~~~~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:7:21 | 7 | //! 5. For both the syn::Expr and rustc_ast::Expr, crawl the syntax tree to | ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 7 | //! 5. For both the `syn::Expr` and rustc_ast::Expr, crawl the syntax tree to | ~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:7:35 | 7 | //! 5. For both the syn::Expr and rustc_ast::Expr, crawl the syntax tree to | ^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 7 | //! 5. For both the syn::Expr and `rustc_ast::Expr`, crawl the syntax tree to | ~~~~~~~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:9:42 | 9 | //! 6. Serialize the fully parenthesized syn::Expr to a string of source code. | ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 9 | //! 6. Serialize the fully parenthesized `syn::Expr` to a string of source code. | ~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:10:56 | 10 | //! 7. Parse the fully parenthesized source code using librustc_parse. | ^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 10 | //! 7. Parse the fully parenthesized source code using `librustc_parse`. | ~~~~~~~~~~~~~~~~ warning: item in documentation is missing backticks --> tests/test_precedence.rs:11:20 | 11 | //! 8. Compare the rustc_ast::Expr resulting from parenthesizing using rustc | ^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 11 | //! 8. Compare the `rustc_ast::Expr` resulting from parenthesizing using rustc | ~~~~~~~~~~~~~~~~~ --- tests/test_precedence.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs index 1dc28ad2ac..e8cd940ba8 100644 --- a/tests/test_precedence.rs +++ b/tests/test_precedence.rs @@ -1,17 +1,16 @@ -//! This test does the following for every file in the rust-lang/rust repo: -//! -//! 1. Parse the file using syn into a syn::File. -//! 2. Extract every syn::Expr from the file. -//! 3. Print each expr to a string of source code. -//! 4. Parse the source code using librustc_parse into a rustc_ast::Expr. -//! 5. For both the syn::Expr and rustc_ast::Expr, crawl the syntax tree to -//! insert parentheses surrounding every subexpression. -//! 6. Serialize the fully parenthesized syn::Expr to a string of source code. -//! 7. Parse the fully parenthesized source code using librustc_parse. -//! 8. Compare the rustc_ast::Expr resulting from parenthesizing using rustc -//! data structures vs syn data structures, ignoring spans. If they agree, -//! rustc's parser and syn's parser have identical handling of expression -//! precedence. +// This test does the following for every file in the rust-lang/rust repo: +// +// 1. Parse the file using syn into a syn::File. +// 2. Extract every syn::Expr from the file. +// 3. Print each expr to a string of source code. +// 4. Parse the source code using librustc_parse into a rustc_ast::Expr. +// 5. For both the syn::Expr and rustc_ast::Expr, crawl the syntax tree to +// insert parentheses surrounding every subexpression. +// 6. Serialize the fully parenthesized syn::Expr to a string of source code. +// 7. Parse the fully parenthesized source code using librustc_parse. +// 8. Compare the rustc_ast::Expr resulting from parenthesizing using rustc data +// structures vs syn data structures, ignoring spans. If they agree, rustc's +// parser and syn's parser have identical handling of expression precedence. #![cfg(not(syn_disable_nightly_tests))] #![cfg(not(miri))] From 06166a77b7d465b0e4c45e1a2162f15031d7f722 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 10 Mar 2024 19:28:56 -0700 Subject: [PATCH 10/15] Update test suite to nightly-2024-03-09 --- tests/common/eq.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/eq.rs b/tests/common/eq.rs index 2db11d645b..2841e26846 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -610,7 +610,7 @@ spanless_eq_enum!(ExprKind; Array(0) ConstBlock(0) Call(0 1) MethodCall(0) Yield(0) Yeet(0) Become(0) IncludedBytes(0) FormatArgs(0) Err(0) Dummy); 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)); + Sym(sym) Label(block)); spanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0) Const(0) 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) From bd931069f5adb81168e7e6186ead0663cc605257 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 10 Mar 2024 19:23:04 -0700 Subject: [PATCH 11/15] Revert "Temporarily disable nightly testing due to libLLVM link issue" This reverts commit 7aef1edbba28afe1bb6f9ddc0b5095dcd5135849. --- build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.rs b/build.rs index a74f73bc38..f14ce219dd 100644 --- a/build.rs +++ b/build.rs @@ -11,9 +11,7 @@ fn main() { // Note: add "/build.rs" to package.include in Cargo.toml if adding any // conditional compilation within the library. - if !unstable() || { - true // FIXME: waiting on https://github.com/rust-lang/rust/pull/121967 - } { + if !unstable() { println!("cargo:rustc-cfg=syn_disable_nightly_tests"); } } From 36a412217d5217fab5657ab03ebcf29102d87a64 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 15 Mar 2024 19:53:01 -0700 Subject: [PATCH 12/15] Update test suite to nightly-2024-03-16 --- tests/common/eq.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/eq.rs b/tests/common/eq.rs index 2841e26846..ebd9773da2 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -583,7 +583,7 @@ spanless_eq_enum!(Mutability; Mut Not); spanless_eq_enum!(PatFieldsRest; Rest None); 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) Empty MacCall(0)); +spanless_eq_enum!(StmtKind; Let(0) Item(0) Expr(0) Semi(0) Empty MacCall(0)); spanless_eq_enum!(StrStyle; Cooked Raw(0)); spanless_eq_enum!(StructRest; Base(0) Rest(0) None); spanless_eq_enum!(Term; Ty(0) Const(0)); From 3f37543794e5d43952399847a2ecbc1eb39f609f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 16 Mar 2024 15:43:58 -0700 Subject: [PATCH 13/15] Implement Copy for syn::parse::Nothing --- src/parse.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/parse.rs b/src/parse.rs index 8668e0e1b7..a3b2f18e77 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1354,6 +1354,18 @@ impl Parse for Nothing { } } +#[cfg(feature = "clone-impls")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))] +impl Clone for Nothing { + fn clone(&self) -> Self { + *self + } +} + +#[cfg(feature = "clone-impls")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))] +impl Copy for Nothing {} + #[cfg(feature = "extra-traits")] #[cfg_attr(doc_cfg, doc(cfg(feature = "extra-traits")))] impl Debug for Nothing { From 4f6c0528d63874495ce23d197a898cd63cb04d60 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 16 Mar 2024 15:45:11 -0700 Subject: [PATCH 14/15] Implement ToTokens for syn::parse::Nothing --- src/parse.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/parse.rs b/src/parse.rs index a3b2f18e77..aafc1a9649 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -188,6 +188,8 @@ use crate::lookahead; use crate::punctuated::Punctuated; use crate::token::Token; use proc_macro2::{Delimiter, Group, Literal, Punct, Span, TokenStream, TokenTree}; +#[cfg(feature = "printing")] +use quote::ToTokens; use std::cell::Cell; use std::fmt::{self, Debug, Display}; #[cfg(feature = "extra-traits")] @@ -1354,6 +1356,14 @@ impl Parse for Nothing { } } +#[cfg(feature = "printing")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "printing")))] +impl ToTokens for Nothing { + fn to_tokens(&self, tokens: &mut TokenStream) { + let _ = tokens; + } +} + #[cfg(feature = "clone-impls")] #[cfg_attr(doc_cfg, doc(cfg(feature = "clone-impls")))] impl Clone for Nothing { From 32dcf8df303c7181d95325f159ffbb1870a73e70 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 16 Mar 2024 15:49:22 -0700 Subject: [PATCH 15/15] Release 2.0.53 --- Cargo.toml | 2 +- src/lib.rs | 2 +- syn.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 60d5e6a371..d77f6091f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "syn" -version = "2.0.52" # don't forget to update html_root_url and syn.json +version = "2.0.53" # don't forget to update html_root_url and syn.json authors = ["David Tolnay "] categories = ["development-tools::procedural-macro-helpers", "parser-implementations"] description = "Parser for Rust source code" diff --git a/src/lib.rs b/src/lib.rs index 855751a985..8ef08e7c33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -249,7 +249,7 @@ //! dynamic library libproc_macro from rustc toolchain. // Syn types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/syn/2.0.52")] +#![doc(html_root_url = "https://docs.rs/syn/2.0.53")] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![deny(unsafe_op_in_unsafe_fn)] #![allow(non_camel_case_types)] diff --git a/syn.json b/syn.json index 82eb9dbd53..46b28bb6eb 100644 --- a/syn.json +++ b/syn.json @@ -1,5 +1,5 @@ { - "version": "2.0.52", + "version": "2.0.53", "types": [ { "ident": "Abi",