diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/syn/tests/test_round_trip.rs | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/syn/tests/test_round_trip.rs')
-rw-r--r-- | vendor/syn/tests/test_round_trip.rs | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/vendor/syn/tests/test_round_trip.rs b/vendor/syn/tests/test_round_trip.rs index 9a5801d44..853f45eae 100644 --- a/vendor/syn/tests/test_round_trip.rs +++ b/vendor/syn/tests/test_round_trip.rs @@ -2,10 +2,17 @@ #![cfg(not(miri))] #![recursion_limit = "1024"] #![feature(rustc_private)] -#![allow(clippy::manual_assert)] +#![allow( + clippy::manual_assert, + clippy::manual_let_else, + clippy::match_like_matches_macro, + clippy::uninlined_format_args +)] extern crate rustc_ast; +extern crate rustc_ast_pretty; extern crate rustc_data_structures; +extern crate rustc_driver; extern crate rustc_error_messages; extern crate rustc_errors; extern crate rustc_expand; @@ -21,6 +28,7 @@ use rustc_ast::ast::{ WhereClause, }; 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_session::parse::ParseSess; @@ -93,7 +101,9 @@ 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 sess = ParseSess::new(FilePathMapping::empty()); + 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 before = match librustc_parse(content, &sess) { Ok(before) => before, Err(diagnostic) => { @@ -133,10 +143,10 @@ fn test(path: &Path, failed: &AtomicUsize, abort_after: usize) { true } else { errorf!( - "=== {}: FAIL\nbefore: {:#?}\nafter: {:#?}\n", + "=== {}: FAIL\n{}\n!=\n{}\n", path.display(), - before, - after, + pprust::crate_to_string_for_macros(&before), + pprust::crate_to_string_for_macros(&after), ); false } @@ -161,9 +171,9 @@ fn librustc_parse(content: String, sess: &ParseSess) -> PResult<Crate> { fn translate_message(diagnostic: &Diagnostic) -> String { thread_local! { static FLUENT_BUNDLE: LazyFallbackBundle = { - let resources = rustc_error_messages::DEFAULT_LOCALE_RESOURCES; + let locale_resources = rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(); let with_directionality_markers = false; - rustc_error_messages::fallback_fluent_bundle(resources, with_directionality_markers) + rustc_error_messages::fallback_fluent_bundle(locale_resources, with_directionality_markers) }; } |