diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /compiler/rustc_error_messages/src | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_error_messages/src')
-rw-r--r-- | compiler/rustc_error_messages/src/lib.rs | 52 |
1 files changed, 35 insertions, 17 deletions
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<FluentResource, IntlLangMemoizer>; +pub type FluentBundle = + IntoDynSyncSend<fluent_bundle::bundle::FluentBundle<FluentResource, IntlLangMemoizer>>; -#[cfg(parallel_compiler)] +#[cfg(not(parallel_compiler))] fn new_bundle(locales: Vec<LanguageIdentifier>) -> FluentBundle { - FluentBundle::new_concurrent(locales) + IntoDynSyncSend(fluent_bundle::bundle::FluentBundle::new(locales)) } -#[cfg(not(parallel_compiler))] +#[cfg(parallel_compiler)] fn new_bundle(locales: Vec<LanguageIdentifier>) -> 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<SubdiagnosticMessage>` to continue to work as before. -impl<S: Into<String>> From<S> for SubdiagnosticMessage { - fn from(s: S) -> Self { - SubdiagnosticMessage::Str(s.into()) +impl From<String> 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<Cow<'static, str>> 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<DiagnosticMessage>` to continue to work as before. -impl<S: Into<String>> From<S> for DiagnosticMessage { - fn from(s: S) -> Self { - DiagnosticMessage::Str(s.into()) +impl From<String> 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<Cow<'static, str>> for DiagnosticMessage { + fn from(s: Cow<'static, str>) -> Self { + DiagnosticMessage::Str(s.to_string()) } } |