summaryrefslogtreecommitdiffstats
path: root/vendor/syn/tests/test_round_trip.rs
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/test_round_trip.rs
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/test_round_trip.rs')
-rw-r--r--vendor/syn/tests/test_round_trip.rs5
1 files changed, 3 insertions, 2 deletions
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())
})
}