Skip to content

Commit

Permalink
Update test suite to nightly-2023-05-30
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 30, 2023
1 parent 4cae0a2 commit d1bf43a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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())
})
}

Expand Down

0 comments on commit d1bf43a

Please sign in to comment.