From 9918693037dce8aa4bb6f08741b6812923486c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 11:26:03 +0200 Subject: Merging upstream version 1.76.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_fluent_macro/src/fluent.rs | 33 +++++++++++++------------------ compiler/rustc_fluent_macro/src/lib.rs | 10 +++++++--- 2 files changed, 21 insertions(+), 22 deletions(-) (limited to 'compiler/rustc_fluent_macro/src') diff --git a/compiler/rustc_fluent_macro/src/fluent.rs b/compiler/rustc_fluent_macro/src/fluent.rs index 7479e4ef2..3b1b63455 100644 --- a/compiler/rustc_fluent_macro/src/fluent.rs +++ b/compiler/rustc_fluent_macro/src/fluent.rs @@ -57,20 +57,20 @@ fn finish(body: TokenStream, resource: TokenStream) -> proc_macro::TokenStream { /// identifiers for different subdiagnostic kinds. pub mod _subdiag { /// Default for `#[help]` - pub const help: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("help")); + pub const help: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("help")); /// Default for `#[note]` - pub const note: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("note")); + pub const note: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("note")); /// Default for `#[warn]` - pub const warn: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("warn")); + pub const warn: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("warn")); /// Default for `#[label]` - pub const label: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("label")); + pub const label: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("label")); /// Default for `#[suggestion]` - pub const suggestion: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("suggestion")); + pub const suggestion: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed("suggestion")); } } } @@ -248,11 +248,8 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok format!("Constant referring to Fluent message `{name}` from `{crate_name}`"); constants.extend(quote! { #[doc = #docstr] - pub const #snake_name: crate::DiagnosticMessage = - crate::DiagnosticMessage::FluentIdentifier( - std::borrow::Cow::Borrowed(#name), - None - ); + pub const #snake_name: rustc_errors::DiagnosticMessage = + rustc_errors::DiagnosticMessage::FluentIdentifier(std::borrow::Cow::Borrowed(#name), None); }); for Attribute { id: Identifier { name: attr_name }, .. } in attributes { @@ -279,10 +276,8 @@ pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::Tok ); constants.extend(quote! { #[doc = #msg] - pub const #snake_name: crate::SubdiagnosticMessage = - crate::SubdiagnosticMessage::FluentAttr( - std::borrow::Cow::Borrowed(#attr_name) - ); + pub const #snake_name: rustc_errors::SubdiagnosticMessage = + rustc_errors::SubdiagnosticMessage::FluentAttr(std::borrow::Cow::Borrowed(#attr_name)); }); } diff --git a/compiler/rustc_fluent_macro/src/lib.rs b/compiler/rustc_fluent_macro/src/lib.rs index 191fb787f..fc65d1eb8 100644 --- a/compiler/rustc_fluent_macro/src/lib.rs +++ b/compiler/rustc_fluent_macro/src/lib.rs @@ -1,7 +1,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] -#![cfg_attr(not(bootstrap), doc(rust_logo))] -#![cfg_attr(not(bootstrap), allow(internal_features))] -#![cfg_attr(not(bootstrap), feature(rustdoc_internals))] +#![doc(rust_logo)] +#![allow(internal_features)] +#![feature(rustdoc_internals)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_span)] #![deny(rustc::untranslatable_diagnostic)] @@ -61,6 +61,10 @@ mod fluent; /// ); /// err.emit(); /// ``` +/// +/// Note: any crate using this macro must also have a dependency on +/// `rustc_errors`, because the generated code refers to things from that +/// crate. #[proc_macro] pub fn fluent_messages(input: TokenStream) -> TokenStream { fluent::fluent_messages(input) -- cgit v1.2.3