From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_error_messages/Cargo.toml | 7 +++-- compiler/rustc_error_messages/src/lib.rs | 52 +++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 20 deletions(-) (limited to 'compiler/rustc_error_messages') diff --git a/compiler/rustc_error_messages/Cargo.toml b/compiler/rustc_error_messages/Cargo.toml index 27783d60b..4df5a8d48 100644 --- a/compiler/rustc_error_messages/Cargo.toml +++ b/compiler/rustc_error_messages/Cargo.toml @@ -11,14 +11,15 @@ fluent-syntax = "0.11" intl-memoizer = "0.5.1" rustc_baked_icu_data = { path = "../rustc_baked_icu_data" } rustc_data_structures = { path = "../rustc_data_structures" } +rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_serialize = { path = "../rustc_serialize" } rustc_span = { path = "../rustc_span" } rustc_macros = { path = "../rustc_macros" } tracing = "0.1" unic-langid = { version = "0.9.0", features = ["macros"] } -icu_list = "1.1.0" -icu_locid = "1.1.0" -icu_provider_adapters = "1.1.0" +icu_list = "1.2" +icu_locid = "1.2" +icu_provider_adapters = "1.2" [features] rustc_use_parallel_compiler = ['rustc_baked_icu_data/rustc_use_parallel_compiler'] diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 6f319b96f..0accb4ab9 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -11,8 +11,9 @@ extern crate tracing; use fluent_bundle::FluentResource; use fluent_syntax::parser::ParserError; use icu_provider_adapters::fallback::{LocaleFallbackProvider, LocaleFallbacker}; -use rustc_data_structures::sync::Lrc; -use rustc_macros::{fluent_messages, Decodable, Encodable}; +use rustc_data_structures::sync::{IntoDynSyncSend, Lrc}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::{Decodable, Encodable}; use rustc_span::Span; use std::borrow::Cow; use std::error::Error; @@ -36,16 +37,17 @@ pub use unic_langid::{langid, LanguageIdentifier}; fluent_messages! { "../messages.ftl" } -pub type FluentBundle = fluent_bundle::bundle::FluentBundle; +pub type FluentBundle = + IntoDynSyncSend>; -#[cfg(parallel_compiler)] +#[cfg(not(parallel_compiler))] fn new_bundle(locales: Vec) -> FluentBundle { - FluentBundle::new_concurrent(locales) + IntoDynSyncSend(fluent_bundle::bundle::FluentBundle::new(locales)) } -#[cfg(not(parallel_compiler))] +#[cfg(parallel_compiler)] fn new_bundle(locales: Vec) -> FluentBundle { - FluentBundle::new(locales) + IntoDynSyncSend(fluent_bundle::bundle::FluentBundle::new_concurrent(locales)) } #[derive(Debug)] @@ -286,11 +288,19 @@ pub enum SubdiagnosticMessage { FluentAttr(FluentId), } -/// `From` impl that enables existing diagnostic calls to functions which now take -/// `impl Into` to continue to work as before. -impl> From for SubdiagnosticMessage { - fn from(s: S) -> Self { - SubdiagnosticMessage::Str(s.into()) +impl From for SubdiagnosticMessage { + fn from(s: String) -> Self { + SubdiagnosticMessage::Str(s) + } +} +impl<'a> From<&'a str> for SubdiagnosticMessage { + fn from(s: &'a str) -> Self { + SubdiagnosticMessage::Str(s.to_string()) + } +} +impl From> for SubdiagnosticMessage { + fn from(s: Cow<'static, str>) -> Self { + SubdiagnosticMessage::Str(s.to_string()) } } @@ -351,11 +361,19 @@ impl DiagnosticMessage { } } -/// `From` impl that enables existing diagnostic calls to functions which now take -/// `impl Into` to continue to work as before. -impl> From for DiagnosticMessage { - fn from(s: S) -> Self { - DiagnosticMessage::Str(s.into()) +impl From for DiagnosticMessage { + fn from(s: String) -> Self { + DiagnosticMessage::Str(s) + } +} +impl<'a> From<&'a str> for DiagnosticMessage { + fn from(s: &'a str) -> Self { + DiagnosticMessage::Str(s.to_string()) + } +} +impl From> for DiagnosticMessage { + fn from(s: Cow<'static, str>) -> Self { + DiagnosticMessage::Str(s.to_string()) } } -- cgit v1.2.3