Add rustc_fluent_macro to decouple fluent from rustc_macros

Fluent, with all the icu4x it brings in, takes quite some time to
compile. `fluent_messages!` is only needed in further downstream rustc
crates, but is blocking more upstream crates like `rustc_index`. By
splitting it out, we allow `rustc_macros` to be compiled earlier, which
speeds up `x check compiler` by about 5 seconds (and even more after the
needless dependency on `serde_json` is removed from
`rustc_data_structures`).
This commit is contained in:
Nilstrieb 2023-04-16 14:33:00 +02:00
parent de96f3d873
commit b5d3d970fa
81 changed files with 398 additions and 293 deletions

View File

@ -2941,6 +2941,7 @@ dependencies = [
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -2964,6 +2965,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_macros",
"rustc_parse",
"rustc_session",
@ -2991,6 +2993,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_lexer",
"rustc_macros",
"rustc_serialize",
@ -3018,6 +3021,7 @@ dependencies = [
"polonius-engine",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
@ -3047,6 +3051,7 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_lexer",
"rustc_lint_defs",
"rustc_macros",
@ -3075,6 +3080,7 @@ dependencies = [
"rustc_codegen_ssa",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_index",
@ -3112,6 +3118,7 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_incremental",
@ -3144,6 +3151,7 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -3217,6 +3225,7 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_hir_analysis",
"rustc_hir_pretty",
@ -3265,6 +3274,7 @@ dependencies = [
"intl-memoizer",
"rustc_baked_icu_data",
"rustc_data_structures",
"rustc_fluent_macro",
"rustc_macros",
"rustc_serialize",
"rustc_span",
@ -3281,6 +3291,7 @@ dependencies = [
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_error_messages",
"rustc_fluent_macro",
"rustc_hir",
"rustc_lint_defs",
"rustc_macros",
@ -3309,6 +3320,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_lexer",
"rustc_lint_defs",
"rustc_macros",
@ -3329,6 +3341,20 @@ dependencies = [
"rustc_span",
]
[[package]]
name = "rustc_fluent_macro"
version = "0.1.0"
dependencies = [
"annotate-snippets",
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.8",
"synstructure 0.13.0",
"unic-langid",
]
[[package]]
name = "rustc_fs_util"
version = "0.0.0"
@ -3365,6 +3391,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -3399,6 +3426,7 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_hir_analysis",
@ -3426,6 +3454,7 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_graphviz",
"rustc_hir",
@ -3454,6 +3483,7 @@ version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -3484,6 +3514,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_expand",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_hir_analysis",
@ -3533,6 +3564,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -3586,14 +3618,10 @@ dependencies = [
name = "rustc_macros"
version = "0.1.0"
dependencies = [
"annotate-snippets",
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
"quote",
"syn 2.0.8",
"synstructure 0.13.0",
"unic-langid",
]
[[package]]
@ -3609,6 +3637,7 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_hir_pretty",
@ -3646,6 +3675,7 @@ dependencies = [
"rustc_error_messages",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
@ -3671,6 +3701,7 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -3694,6 +3725,7 @@ dependencies = [
"rustc_ast",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_graphviz",
"rustc_hir",
"rustc_index",
@ -3737,6 +3769,7 @@ version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -3760,6 +3793,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_lexer",
"rustc_macros",
"rustc_session",
@ -3790,6 +3824,7 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_lexer",
@ -3810,6 +3845,7 @@ dependencies = [
"libloading",
"rustc_ast",
"rustc_errors",
"rustc_fluent_macro",
"rustc_lint",
"rustc_macros",
"rustc_metadata",
@ -3825,6 +3861,7 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_hir_analysis",
"rustc_macros",
@ -3866,6 +3903,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -3893,6 +3931,7 @@ dependencies = [
"rustc_errors",
"rustc_expand",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_macros",
@ -3926,6 +3965,7 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_fs_util",
"rustc_hir",
"rustc_index",
@ -3977,6 +4017,7 @@ dependencies = [
"rustc-demangle",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_macros",
"rustc_middle",
@ -4019,6 +4060,7 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
@ -4076,6 +4118,7 @@ version = "0.0.0"
dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",

View File

@ -12,6 +12,7 @@ rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_middle = { path = "../rustc_middle" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -55,13 +55,13 @@ use rustc_data_structures::sync::Lrc;
use rustc_errors::{
DiagnosticArgFromDisplay, DiagnosticMessage, Handler, StashKey, SubdiagnosticMessage,
};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
use rustc_hir::definitions::DefPathData;
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
use rustc_index::vec::{Idx, IndexSlice, IndexVec};
use rustc_macros::fluent_messages;
use rustc_middle::{
span_bug,
ty::{ResolverAstLowering, TyCtxt},

View File

@ -12,6 +12,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_macros = { path = "../rustc_macros" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_parse = { path = "../rustc_parse" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }

View File

@ -13,7 +13,7 @@
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
pub mod ast_validation;
mod errors;

View File

@ -9,6 +9,7 @@ edition = "2021"
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_span = { path = "../rustc_span" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_feature = { path = "../rustc_feature" }

View File

@ -12,7 +12,7 @@
extern crate rustc_macros;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
mod builtin;
mod session_diagnostics;

View File

@ -15,6 +15,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_lexer = { path = "../rustc_lexer" }

View File

@ -20,6 +20,7 @@ extern crate tracing;
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::graph::dominators::Dominators;
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_index::bit_set::ChunkedBitSet;
@ -27,7 +28,6 @@ use rustc_index::vec::{IndexSlice, IndexVec};
use rustc_infer::infer::{
DefiningAnchor, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin, TyCtxtInferExt,
};
use rustc_macros::fluent_messages;
use rustc_middle::mir::{
traversal, Body, ClearCrossCrate, Local, Location, Mutability, NonDivergingIntrinsic, Operand,
Place, PlaceElem, PlaceRef, VarDebugInfoContents,

View File

@ -17,6 +17,7 @@ rustc_feature = { path = "../rustc_feature" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_parse_format = { path = "../rustc_parse_format" }
rustc_parse = { path = "../rustc_parse" }
rustc_session = { path = "../rustc_session" }

View File

@ -24,7 +24,7 @@ use crate::deriving::*;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtensionKind};
use rustc_expand::proc_macro::BangProcMacro;
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_span::symbol::sym;
mod alloc_error_handler;

View File

@ -27,6 +27,7 @@ extern crate rustc_attr;
extern crate rustc_codegen_ssa;
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_fluent_macro;
extern crate rustc_hir;
extern crate rustc_macros;
extern crate rustc_metadata;
@ -76,7 +77,7 @@ use rustc_codegen_ssa::target_features::supported_target_features;
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, ModuleBufferMethods, ThinBufferMethods, WriteBackendMethods};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::ty::TyCtxt;

View File

@ -22,6 +22,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }

View File

@ -34,7 +34,7 @@ use rustc_codegen_ssa::ModuleCodegen;
use rustc_codegen_ssa::{CodegenResults, CompiledModule};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, FatalError, Handler, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::ty::query::Providers;

View File

@ -29,6 +29,7 @@ rustc_span = { path = "../rustc_span" }
rustc_middle = { path = "../rustc_middle" }
rustc_type_ir = { path = "../rustc_type_ir" }
rustc_attr = { path = "../rustc_attr" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }

View File

@ -25,8 +25,8 @@ use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sync::Lrc;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir::def_id::CrateNum;
use rustc_macros::fluent_messages;
use rustc_middle::dep_graph::WorkProduct;
use rustc_middle::middle::dependency_format::Dependencies;
use rustc_middle::middle::exported_symbols::SymbolExportKind;

View File

@ -14,6 +14,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -34,7 +34,7 @@ pub mod transform;
pub mod util;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_middle::ty;
use rustc_middle::ty::query::Providers;

View File

@ -18,6 +18,7 @@ rustc_const_eval = { path = "../rustc_const_eval" }
rustc_error_messages = { path = "../rustc_error_messages" }
rustc_expand = { path = "../rustc_expand" }
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_incremental = { path = "../rustc_incremental" }
rustc_infer = { path = "../rustc_infer" }
rustc_mir_build = { path = "../rustc_mir_build" }

View File

@ -28,10 +28,10 @@ use rustc_errors::{
DiagnosticMessage, ErrorGuaranteed, PResult, SubdiagnosticMessage, TerminalUrl,
};
use rustc_feature::find_gated_cfg;
use rustc_fluent_macro::fluent_messages;
use rustc_interface::util::{self, collect_crate_types, get_codegen_backend};
use rustc_interface::{interface, Queries};
use rustc_lint::LintStore;
use rustc_macros::fluent_messages;
use rustc_metadata::locator;
use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest, TrimmedDefPaths};

View File

@ -11,6 +11,7 @@ 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" }

View File

@ -12,7 +12,8 @@ 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_fluent_macro::fluent_messages;
use rustc_macros::{Decodable, Encodable};
use rustc_span::Span;
use std::borrow::Cow;
use std::error::Error;

View File

@ -10,6 +10,7 @@ tracing = "0.1"
rustc_ast = { path = "../rustc_ast" }
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_error_messages = { path = "../rustc_error_messages" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -38,8 +38,8 @@ pub use rustc_error_messages::{
fallback_fluent_bundle, fluent_bundle, DelayDm, DiagnosticMessage, FluentBundle,
LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagnosticMessage,
};
use rustc_fluent_macro::fluent_messages;
pub use rustc_lint_defs::{pluralize, Applicability};
use rustc_macros::fluent_messages;
use rustc_span::source_map::SourceMap;
pub use rustc_span::ErrorGuaranteed;
use rustc_span::{Loc, Span};

View File

@ -16,6 +16,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_lint_defs = { path = "../rustc_lint_defs" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -21,7 +21,7 @@ extern crate tracing;
extern crate proc_macro as pm;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
mod placeholders;
mod proc_macro_server;

View File

@ -0,0 +1,17 @@
[package]
name = "rustc_fluent_macro"
version = "0.1.0"
edition = "2021"
[lib]
proc-macro = true
[dependencies]
annotate-snippets = "0.9"
fluent-bundle = "0.15.2"
fluent-syntax = "0.11"
synstructure = "0.13.0"
syn = { version = "2", features = ["full"] }
proc-macro2 = "1"
quote = "1"
unic-langid = { version = "0.9.0", features = ["macros"] }

View File

@ -68,7 +68,7 @@ fn failed(crate_name: &Ident) -> proc_macro::TokenStream {
.into()
}
/// See [rustc_macros::fluent_messages].
/// See [rustc_fluent_macro::fluent_messages].
pub(crate) fn fluent_messages(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let crate_name = std::env::var("CARGO_PKG_NAME")
// If `CARGO_PKG_NAME` is missing, then we're probably running in a test, so use

View File

@ -0,0 +1,64 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_span)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::default_hash_types)]
use proc_macro::TokenStream;
mod fluent;
/// Implements the `fluent_messages` macro, which performs compile-time validation of the
/// compiler's Fluent resources (i.e. that the resources parse and don't multiply define the same
/// messages) and generates constants that make using those messages in diagnostics more ergonomic.
///
/// For example, given the following invocation of the macro..
///
/// ```ignore (rust)
/// fluent_messages! { "./typeck.ftl" }
/// ```
/// ..where `typeck.ftl` has the following contents..
///
/// ```fluent
/// typeck_field_multiply_specified_in_initializer =
/// field `{$ident}` specified more than once
/// .label = used more than once
/// .label_previous_use = first use of `{$ident}`
/// ```
/// ...then the macro parse the Fluent resource, emitting a diagnostic if it fails to do so, and
/// will generate the following code:
///
/// ```ignore (rust)
/// pub static DEFAULT_LOCALE_RESOURCE: &'static [&'static str] = include_str!("./typeck.ftl");
///
/// mod fluent_generated {
/// mod typeck {
/// pub const field_multiply_specified_in_initializer: DiagnosticMessage =
/// DiagnosticMessage::fluent("typeck_field_multiply_specified_in_initializer");
/// pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage =
/// DiagnosticMessage::fluent_attr(
/// "typeck_field_multiply_specified_in_initializer",
/// "previous_use_label"
/// );
/// }
/// }
/// ```
/// When emitting a diagnostic, the generated constants can be used as follows:
///
/// ```ignore (rust)
/// let mut err = sess.struct_span_err(
/// span,
/// fluent::typeck::field_multiply_specified_in_initializer
/// );
/// err.span_default_label(span);
/// err.span_label(
/// previous_use_span,
/// fluent::typeck::field_multiply_specified_in_initializer_label_previous_use
/// );
/// err.emit();
/// ```
#[proc_macro]
pub fn fluent_messages(input: TokenStream) -> TokenStream {
fluent::fluent_messages(input)
}

View File

@ -15,6 +15,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_target = { path = "../rustc_target" }
rustc_session = { path = "../rustc_session" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }

View File

@ -99,10 +99,10 @@ mod variance;
use rustc_errors::ErrorGuaranteed;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::Node;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_macros::fluent_messages;
use rustc_middle::middle;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, Ty, TyCtxt};

View File

@ -12,6 +12,7 @@ rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_hir = { path = "../rustc_hir" }

View File

@ -59,6 +59,7 @@ use rustc_errors::{
struct_span_err, DiagnosticId, DiagnosticMessage, ErrorGuaranteed, MultiSpan,
SubdiagnosticMessage,
};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit::Visitor;
@ -66,7 +67,6 @@ use rustc_hir::{HirIdMap, Node};
use rustc_hir_analysis::astconv::AstConv;
use rustc_hir_analysis::check::check_abi;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_macros::fluent_messages;
use rustc_middle::traits;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, Ty, TyCtxt};

View File

@ -11,6 +11,7 @@ rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -33,6 +33,6 @@ pub use persist::LoadResult;
pub use persist::{build_dep_graph, load_dep_graph, DepGraphFuture};
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
fluent_messages! { "../messages.ftl" }

View File

@ -12,6 +12,7 @@ rustc_middle = { path = "../rustc_middle" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }

View File

@ -35,7 +35,7 @@ extern crate tracing;
extern crate rustc_middle;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
mod errors;
pub mod infer;

View File

@ -16,6 +16,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_borrowck = { path = "../rustc_borrowck" }
rustc_builtin_macros = { path = "../rustc_builtin_macros" }
rustc_expand = { path = "../rustc_expand" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_macros = { path = "../rustc_macros" }
rustc_parse = { path = "../rustc_parse" }

View File

@ -13,7 +13,7 @@
extern crate tracing;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
mod callbacks;
mod errors;

View File

@ -11,6 +11,7 @@ rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_attr = { path = "../rustc_attr" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_target = { path = "../rustc_target" }
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }

View File

@ -82,9 +82,9 @@ pub use array_into_iter::ARRAY_INTO_ITER;
use rustc_ast as ast;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_macros::fluent_messages;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::{

View File

@ -7,11 +7,7 @@ edition = "2021"
proc-macro = true
[dependencies]
annotate-snippets = "0.9"
fluent-bundle = "0.15.2"
fluent-syntax = "0.11"
synstructure = "0.13.0"
syn = { version = "2", features = ["full"] }
proc-macro2 = "1"
quote = "1"
unic-langid = { version = "0.9.0", features = ["macros"] }

View File

@ -1,12 +1,10 @@
mod diagnostic;
mod diagnostic_builder;
mod error;
mod fluent;
mod subdiagnostic;
mod utils;
use diagnostic::{DiagnosticDerive, LintDiagnosticDerive};
pub(crate) use fluent::fluent_messages;
use proc_macro2::TokenStream;
use quote::format_ident;
use subdiagnostic::SubdiagnosticDeriveBuilder;

View File

@ -54,60 +54,6 @@ pub fn newtype_index(input: TokenStream) -> TokenStream {
newtype::newtype(input)
}
/// Implements the `fluent_messages` macro, which performs compile-time validation of the
/// compiler's Fluent resources (i.e. that the resources parse and don't multiply define the same
/// messages) and generates constants that make using those messages in diagnostics more ergonomic.
///
/// For example, given the following invocation of the macro..
///
/// ```ignore (rust)
/// fluent_messages! { "./typeck.ftl" }
/// ```
/// ..where `typeck.ftl` has the following contents..
///
/// ```fluent
/// typeck_field_multiply_specified_in_initializer =
/// field `{$ident}` specified more than once
/// .label = used more than once
/// .label_previous_use = first use of `{$ident}`
/// ```
/// ...then the macro parse the Fluent resource, emitting a diagnostic if it fails to do so, and
/// will generate the following code:
///
/// ```ignore (rust)
/// pub static DEFAULT_LOCALE_RESOURCE: &'static [&'static str] = include_str!("./typeck.ftl");
///
/// mod fluent_generated {
/// mod typeck {
/// pub const field_multiply_specified_in_initializer: DiagnosticMessage =
/// DiagnosticMessage::fluent("typeck_field_multiply_specified_in_initializer");
/// pub const field_multiply_specified_in_initializer_label_previous_use: DiagnosticMessage =
/// DiagnosticMessage::fluent_attr(
/// "typeck_field_multiply_specified_in_initializer",
/// "previous_use_label"
/// );
/// }
/// }
/// ```
/// When emitting a diagnostic, the generated constants can be used as follows:
///
/// ```ignore (rust)
/// let mut err = sess.struct_span_err(
/// span,
/// fluent::typeck::field_multiply_specified_in_initializer
/// );
/// err.span_default_label(span);
/// err.span_label(
/// previous_use_span,
/// fluent::typeck::field_multiply_specified_in_initializer_label_previous_use
/// );
/// err.emit();
/// ```
#[proc_macro]
pub fn fluent_messages(input: TokenStream) -> TokenStream {
diagnostics::fluent_messages(input)
}
decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive);
decl_derive!(
[HashStable_Generic, attributes(stable_hasher)] =>

View File

@ -18,6 +18,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_hir = { path = "../rustc_hir" }
rustc_hir_pretty = { path = "../rustc_hir_pretty" }

View File

@ -28,7 +28,7 @@ extern crate tracing;
pub use rmeta::{provide, provide_extern};
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
mod dependency_format;
mod foreign_modules;

View File

@ -21,6 +21,7 @@ rustc_errors = { path = "../rustc_errors" }
# Used for intra-doc links
rustc_error_messages = { path = "../rustc_error_messages" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }

View File

@ -75,7 +75,7 @@ extern crate tracing;
extern crate smallvec;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
#[cfg(test)]
mod tests;

View File

@ -14,6 +14,7 @@ rustc_apfloat = { path = "../rustc_apfloat" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_index = { path = "../rustc_index" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_infer = { path = "../rustc_infer" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -25,7 +25,7 @@ pub mod thir;
use rustc_middle::ty::query::Providers;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
fluent_messages! { "../messages.ftl" }

View File

@ -13,6 +13,7 @@ tracing = "0.1"
rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_graphviz = { path = "../rustc_graphviz" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }

View File

@ -16,8 +16,8 @@ extern crate rustc_middle;
use rustc_ast::MetaItem;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir::def_id::DefId;
use rustc_macros::fluent_messages;
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::symbol::{sym, Symbol};

View File

@ -13,6 +13,7 @@ tracing = "0.1"
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" }

View File

@ -10,8 +10,8 @@ extern crate tracing;
extern crate rustc_middle;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir::lang_items::LangItem;
use rustc_macros::fluent_messages;
use rustc_middle::traits;
use rustc_middle::ty::adjustment::CustomCoerceUnsized;
use rustc_middle::ty::query::{Providers, TyCtxtAt};

View File

@ -12,6 +12,7 @@ rustc_ast_pretty = { path = "../rustc_ast_pretty" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_lexer = { path = "../rustc_lexer" }
rustc_macros = { path = "../rustc_macros" }
rustc_session = { path = "../rustc_session" }

View File

@ -20,7 +20,7 @@ use rustc_ast_pretty::pprust;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Applicability, Diagnostic, FatalError, Level, PResult};
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_session::parse::ParseSess;
use rustc_span::{FileName, SourceFile, Span};

View File

@ -12,6 +12,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_session = { path = "../rustc_session" }
rustc_target = { path = "../rustc_target" }

View File

@ -19,7 +19,7 @@ extern crate rustc_middle;
extern crate tracing;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_middle::ty::query::Providers;
mod check_attr;

View File

@ -12,6 +12,7 @@ rustc_errors = { path = "../rustc_errors" }
rustc_lint = { path = "../rustc_lint" }
rustc_macros = { path = "../rustc_macros" }
rustc_metadata = { path = "../rustc_metadata" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_ast = { path = "../rustc_ast" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }

View File

@ -12,8 +12,8 @@
#![deny(rustc::diagnostic_outside_of_impl)]
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_lint::LintStore;
use rustc_macros::fluent_messages;
mod errors;
pub mod load;

View File

@ -9,6 +9,7 @@ rustc_attr = { path = "../rustc_attr" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" }
rustc_session = { path = "../rustc_session" }

View File

@ -17,12 +17,12 @@ use rustc_attr as attr;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::intern::Interned;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{AssocItemKind, HirIdSet, ItemId, Node, PatKind};
use rustc_macros::fluent_messages;
use rustc_middle::bug;
use rustc_middle::hir::nested_filter;
use rustc_middle::middle::privacy::{EffectiveVisibilities, Level};

View File

@ -12,6 +12,7 @@ rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -16,7 +16,7 @@ extern crate rustc_data_structures;
extern crate rustc_macros;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
pub mod cache;
pub mod dep_graph;

View File

@ -16,6 +16,7 @@ rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_expand = { path = "../rustc_expand" }
rustc_feature = { path = "../rustc_feature" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -33,6 +33,7 @@ use rustc_errors::{
Applicability, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, SubdiagnosticMessage,
};
use rustc_expand::base::{DeriveResolutions, SyntaxExtension, SyntaxExtensionKind};
use rustc_fluent_macro::fluent_messages;
use rustc_hir::def::Namespace::{self, *};
use rustc_hir::def::{self, CtorOf, DefKind, DocLinkResMap, LifetimeRes, PartialRes, PerNS};
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LocalDefIdSet};
@ -40,7 +41,6 @@ use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
use rustc_hir::definitions::DefPathData;
use rustc_hir::TraitCandidate;
use rustc_index::vec::IndexVec;
use rustc_macros::fluent_messages;
use rustc_metadata::creader::{CStore, CrateLoader};
use rustc_middle::metadata::ModChild;
use rustc_middle::middle::privacy::EffectiveVisibilities;

View File

@ -10,6 +10,7 @@ tracing = "0.1"
rustc_errors = { path = "../rustc_errors" }
rustc_feature = { path = "../rustc_feature" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_target = { path = "../rustc_target" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_data_structures = { path = "../rustc_data_structures" }

View File

@ -19,7 +19,7 @@ pub mod errors;
extern crate tracing;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
pub mod cgu_reuse_tracker;
pub mod utils;

View File

@ -15,6 +15,7 @@ twox-hash = "1.6.3"
rustc_span = { path = "../rustc_span" }
rustc_middle = { path = "../rustc_middle" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_target = { path = "../rustc_target" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_session = { path = "../rustc_session" }

View File

@ -101,9 +101,9 @@ extern crate rustc_middle;
extern crate tracing;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_fluent_macro::fluent_messages;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_macros::fluent_messages;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::mir::mono::{InstantiationMode, MonoItem};

View File

@ -14,6 +14,7 @@ rustc_ast = { path = "../rustc_ast" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_index = { path = "../rustc_index" }
rustc_infer = { path = "../rustc_infer" }
rustc_macros = { path = "../rustc_macros" }

View File

@ -37,7 +37,7 @@ extern crate rustc_middle;
extern crate smallvec;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
pub mod errors;
pub mod infer;

View File

@ -9,6 +9,7 @@ rustc_middle = { path = "../rustc_middle" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_hir = { path = "../rustc_hir" }
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
rustc_infer = { path = "../rustc_infer" }
rustc_macros = { path = "../rustc_macros" }
rustc_span = { path = "../rustc_span" }

View File

@ -19,7 +19,7 @@ extern crate rustc_middle;
extern crate tracing;
use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_fluent_macro::fluent_messages;
use rustc_middle::ty::query::Providers;
mod abi;

View File

@ -3,8 +3,8 @@
#![feature(rustc_private)]
#![crate_type = "lib"]
extern crate rustc_macros;
use rustc_macros::fluent_messages;
extern crate rustc_fluent_macro;
use rustc_fluent_macro::fluent_messages;
/// Copy of the relevant `DiagnosticMessage` variant constructed by `fluent_messages` as it
/// expects `crate::DiagnosticMessage` to exist.

View File

@ -7,15 +7,17 @@
#![deny(rustc::diagnostic_outside_of_impl)]
extern crate rustc_errors;
extern crate rustc_fluent_macro;
extern crate rustc_macros;
extern crate rustc_session;
extern crate rustc_span;
use rustc_errors::{
AddToDiagnostic, IntoDiagnostic, Diagnostic, DiagnosticBuilder,
ErrorGuaranteed, Handler, DiagnosticMessage, SubdiagnosticMessage,
AddToDiagnostic, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, Handler,
IntoDiagnostic, SubdiagnosticMessage,
};
use rustc_macros::{fluent_messages, Diagnostic, Subdiagnostic};
use rustc_fluent_macro::fluent_messages;
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::Span;
fluent_messages! { "./diagnostics.ftl" }

View File

@ -1,5 +1,5 @@
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:41:17
--> $DIR/diagnostics.rs:43:17
|
LL | handler.struct_err("untranslatable diagnostic")
| ^^^^^^^^^^
@ -11,13 +11,13 @@ LL | #![deny(rustc::untranslatable_diagnostic)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:61:14
--> $DIR/diagnostics.rs:63:14
|
LL | diag.note("untranslatable diagnostic");
| ^^^^
error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
--> $DIR/diagnostics.rs:78:25
--> $DIR/diagnostics.rs:80:25
|
LL | let _diag = handler.struct_err(crate::fluent_generated::no_crate_example);
| ^^^^^^^^^^
@ -29,13 +29,13 @@ LL | #![deny(rustc::diagnostic_outside_of_impl)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostics should only be created in `IntoDiagnostic`/`AddToDiagnostic` impls
--> $DIR/diagnostics.rs:81:25
--> $DIR/diagnostics.rs:83:25
|
LL | let _diag = handler.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^
error: diagnostics should be created using translatable messages
--> $DIR/diagnostics.rs:81:25
--> $DIR/diagnostics.rs:83:25
|
LL | let _diag = handler.struct_err("untranslatable diagnostic");
| ^^^^^^^^^^

View File

@ -17,8 +17,10 @@ extern crate rustc_span;
use rustc_span::symbol::Ident;
use rustc_span::Span;
extern crate rustc_fluent_macro;
extern crate rustc_macros;
use rustc_macros::{fluent_messages, Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_fluent_macro::fluent_messages;
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
extern crate rustc_middle;
use rustc_middle::ty::Ty;

View File

@ -1,11 +1,11 @@
error: unsupported type attribute for diagnostic derive enum
--> $DIR/diagnostic-derive.rs:42:1
--> $DIR/diagnostic-derive.rs:44:1
|
LL | #[diag(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:45:5
--> $DIR/diagnostic-derive.rs:47:5
|
LL | Foo,
| ^^^
@ -13,7 +13,7 @@ LL | Foo,
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:47:5
--> $DIR/diagnostic-derive.rs:49:5
|
LL | Bar,
| ^^^
@ -21,19 +21,19 @@ LL | Bar,
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: expected parentheses: #[diag(...)]
--> $DIR/diagnostic-derive.rs:53:8
--> $DIR/diagnostic-derive.rs:55:8
|
LL | #[diag = "E0123"]
| ^
error: `#[nonsense(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:58:1
--> $DIR/diagnostic-derive.rs:60:1
|
LL | #[nonsense(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:58:1
--> $DIR/diagnostic-derive.rs:60:1
|
LL | / #[nonsense(no_crate_example, code = "E0123")]
LL | |
@ -45,7 +45,7 @@ LL | | struct InvalidStructAttr {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:65:1
--> $DIR/diagnostic-derive.rs:67:1
|
LL | / #[diag("E0123")]
LL | |
@ -55,13 +55,13 @@ LL | | struct InvalidLitNestedAttr {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug must be the first argument
--> $DIR/diagnostic-derive.rs:75:16
--> $DIR/diagnostic-derive.rs:77:16
|
LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
| ^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:75:1
--> $DIR/diagnostic-derive.rs:77:1
|
LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
LL | |
@ -72,7 +72,7 @@ LL | | struct InvalidNestedStructAttr1 {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
--> $DIR/diagnostic-derive.rs:81:8
--> $DIR/diagnostic-derive.rs:83:8
|
LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
| ^^^^^^^^
@ -80,7 +80,7 @@ LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
= note: only the `code` parameter is valid after the slug
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:81:1
--> $DIR/diagnostic-derive.rs:83:1
|
LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")]
LL | |
@ -91,7 +91,7 @@ LL | | struct InvalidNestedStructAttr2 {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
--> $DIR/diagnostic-derive.rs:87:8
--> $DIR/diagnostic-derive.rs:89:8
|
LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
| ^^^^^^^^
@ -99,7 +99,7 @@ LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
= note: only the `code` parameter is valid after the slug
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:87:1
--> $DIR/diagnostic-derive.rs:89:1
|
LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")]
LL | |
@ -110,7 +110,7 @@ LL | | struct InvalidNestedStructAttr3 {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: unknown argument
--> $DIR/diagnostic-derive.rs:93:42
--> $DIR/diagnostic-derive.rs:95:42
|
LL | #[diag(no_crate_example, code = "E0123", slug = "foo")]
| ^^^^
@ -118,55 +118,55 @@ LL | #[diag(no_crate_example, code = "E0123", slug = "foo")]
= note: only the `code` parameter is valid after the slug
error: `#[suggestion = ...]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:100:5
--> $DIR/diagnostic-derive.rs:102:5
|
LL | #[suggestion = "bar"]
| ^^^^^^^^^^^^^^^^^^^^^
error: specified multiple times
--> $DIR/diagnostic-derive.rs:107:8
--> $DIR/diagnostic-derive.rs:109:8
|
LL | #[diag(no_crate_example, code = "E0456")]
| ^^^^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:106:8
--> $DIR/diagnostic-derive.rs:108:8
|
LL | #[diag(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^
error: specified multiple times
--> $DIR/diagnostic-derive.rs:107:26
--> $DIR/diagnostic-derive.rs:109:26
|
LL | #[diag(no_crate_example, code = "E0456")]
| ^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:106:26
--> $DIR/diagnostic-derive.rs:108:26
|
LL | #[diag(no_crate_example, code = "E0123")]
| ^^^^
error: specified multiple times
--> $DIR/diagnostic-derive.rs:113:42
--> $DIR/diagnostic-derive.rs:115:42
|
LL | #[diag(no_crate_example, code = "E0456", code = "E0457")]
| ^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:113:26
--> $DIR/diagnostic-derive.rs:115:26
|
LL | #[diag(no_crate_example, code = "E0456", code = "E0457")]
| ^^^^
error: diagnostic slug must be the first argument
--> $DIR/diagnostic-derive.rs:118:43
--> $DIR/diagnostic-derive.rs:120:43
|
LL | #[diag(no_crate_example, no_crate::example, code = "E0456")]
| ^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:123:1
--> $DIR/diagnostic-derive.rs:125:1
|
LL | struct KindNotProvided {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -174,7 +174,7 @@ LL | struct KindNotProvided {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:126:1
--> $DIR/diagnostic-derive.rs:128:1
|
LL | / #[diag(code = "E0456")]
LL | |
@ -184,31 +184,31 @@ LL | | struct SlugNotProvided {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/diagnostic-derive.rs:137:5
--> $DIR/diagnostic-derive.rs:139:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: `#[nonsense]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:145:5
--> $DIR/diagnostic-derive.rs:147:5
|
LL | #[nonsense]
| ^^^^^^^^^^^
error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/diagnostic-derive.rs:162:5
--> $DIR/diagnostic-derive.rs:164:5
|
LL | #[label(no_crate_label)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: `name` doesn't refer to a field on this type
--> $DIR/diagnostic-derive.rs:170:46
--> $DIR/diagnostic-derive.rs:172:46
|
LL | #[suggestion(no_crate_suggestion, code = "{name}")]
| ^^^^^^^^
error: invalid format string: expected `'}'` but string was terminated
--> $DIR/diagnostic-derive.rs:175:10
--> $DIR/diagnostic-derive.rs:177:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ expected `'}'` in format string
@ -217,7 +217,7 @@ LL | #[derive(Diagnostic)]
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: invalid format string: unmatched `}` found
--> $DIR/diagnostic-derive.rs:185:10
--> $DIR/diagnostic-derive.rs:187:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ unmatched `}` in format string
@ -226,19 +226,19 @@ LL | #[derive(Diagnostic)]
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/diagnostic-derive.rs:205:5
--> $DIR/diagnostic-derive.rs:207:5
|
LL | #[label(no_crate_label)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:224:5
--> $DIR/diagnostic-derive.rs:226:5
|
LL | #[suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: invalid nested attribute
--> $DIR/diagnostic-derive.rs:232:18
--> $DIR/diagnostic-derive.rs:234:18
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^
@ -246,13 +246,13 @@ LL | #[suggestion(nonsense = "bar")]
= help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:232:5
--> $DIR/diagnostic-derive.rs:234:5
|
LL | #[suggestion(nonsense = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: invalid nested attribute
--> $DIR/diagnostic-derive.rs:241:18
--> $DIR/diagnostic-derive.rs:243:18
|
LL | #[suggestion(msg = "bar")]
| ^^^
@ -260,13 +260,13 @@ LL | #[suggestion(msg = "bar")]
= help: only `style`, `code` and `applicability` are valid nested attributes
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:241:5
--> $DIR/diagnostic-derive.rs:243:5
|
LL | #[suggestion(msg = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: wrong field type for suggestion
--> $DIR/diagnostic-derive.rs:264:5
--> $DIR/diagnostic-derive.rs:266:5
|
LL | / #[suggestion(no_crate_suggestion, code = "This is suggested code")]
LL | |
@ -276,79 +276,79 @@ LL | | suggestion: Applicability,
= help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
error: specified multiple times
--> $DIR/diagnostic-derive.rs:280:24
--> $DIR/diagnostic-derive.rs:282:24
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:280:18
--> $DIR/diagnostic-derive.rs:282:18
|
LL | suggestion: (Span, Span, Applicability),
| ^^^^
error: specified multiple times
--> $DIR/diagnostic-derive.rs:288:33
--> $DIR/diagnostic-derive.rs:290:33
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:288:18
--> $DIR/diagnostic-derive.rs:290:18
|
LL | suggestion: (Applicability, Applicability, Span),
| ^^^^^^^^^^^^^
error: `#[label = ...]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:295:5
--> $DIR/diagnostic-derive.rs:297:5
|
LL | #[label = "bar"]
| ^^^^^^^^^^^^^^^^
error: specified multiple times
--> $DIR/diagnostic-derive.rs:446:5
--> $DIR/diagnostic-derive.rs:448:5
|
LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "maybe-incorrect")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:448:24
--> $DIR/diagnostic-derive.rs:450:24
|
LL | suggestion: (Span, Applicability),
| ^^^^^^^^^^^^^
error: invalid applicability
--> $DIR/diagnostic-derive.rs:454:69
--> $DIR/diagnostic-derive.rs:456:69
|
LL | #[suggestion(no_crate_suggestion, code = "...", applicability = "batman")]
| ^^^^^^^^
error: the `#[help(...)]` attribute can only be applied to fields of type `Span`, `MultiSpan`, `bool` or `()`
--> $DIR/diagnostic-derive.rs:521:5
--> $DIR/diagnostic-derive.rs:523:5
|
LL | #[help(no_crate_help)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: a diagnostic slug must be the first argument to the attribute
--> $DIR/diagnostic-derive.rs:530:32
--> $DIR/diagnostic-derive.rs:532:32
|
LL | #[label(no_crate_label, foo)]
| ^
error: invalid nested attribute
--> $DIR/diagnostic-derive.rs:538:29
--> $DIR/diagnostic-derive.rs:540:29
|
LL | #[label(no_crate_label, foo = "...")]
| ^^^
error: invalid nested attribute
--> $DIR/diagnostic-derive.rs:546:29
--> $DIR/diagnostic-derive.rs:548:29
|
LL | #[label(no_crate_label, foo("..."))]
| ^^^
error: `#[primary_span]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:558:5
--> $DIR/diagnostic-derive.rs:560:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@ -356,13 +356,13 @@ LL | #[primary_span]
= help: the `primary_span` field attribute is not valid for lint diagnostics
error: `#[error(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:578:1
--> $DIR/diagnostic-derive.rs:580:1
|
LL | #[error(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:578:1
--> $DIR/diagnostic-derive.rs:580:1
|
LL | / #[error(no_crate_example, code = "E0123")]
LL | |
@ -374,13 +374,13 @@ LL | | struct ErrorAttribute {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[warn_(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:585:1
--> $DIR/diagnostic-derive.rs:587:1
|
LL | #[warn_(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:585:1
--> $DIR/diagnostic-derive.rs:587:1
|
LL | / #[warn_(no_crate_example, code = "E0123")]
LL | |
@ -392,13 +392,13 @@ LL | | struct WarnAttribute {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[lint(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:592:1
--> $DIR/diagnostic-derive.rs:594:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:592:1
--> $DIR/diagnostic-derive.rs:594:1
|
LL | / #[lint(no_crate_example, code = "E0123")]
LL | |
@ -410,19 +410,19 @@ LL | | struct LintAttributeOnSessionDiag {}
= help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(hir_analysis_example_error)]`
error: `#[lint(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:599:1
--> $DIR/diagnostic-derive.rs:601:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[lint(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:599:1
--> $DIR/diagnostic-derive.rs:601:1
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: diagnostic slug not specified
--> $DIR/diagnostic-derive.rs:599:1
--> $DIR/diagnostic-derive.rs:601:1
|
LL | / #[lint(no_crate_example, code = "E0123")]
LL | |
@ -435,19 +435,19 @@ LL | | struct LintAttributeOnLintDiag {}
= help: specify the slug as the first argument to the attribute, such as `#[diag(compiletest_example)]`
error: specified multiple times
--> $DIR/diagnostic-derive.rs:609:53
--> $DIR/diagnostic-derive.rs:611:53
|
LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]
| ^^^^
|
note: previously specified here
--> $DIR/diagnostic-derive.rs:609:39
--> $DIR/diagnostic-derive.rs:611:39
|
LL | #[suggestion(no_crate_suggestion, code = "...", code = ",,,")]
| ^^^^
error: wrong types for suggestion
--> $DIR/diagnostic-derive.rs:618:24
--> $DIR/diagnostic-derive.rs:620:24
|
LL | suggestion: (Span, usize),
| ^^^^^
@ -455,7 +455,7 @@ LL | suggestion: (Span, usize),
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: wrong types for suggestion
--> $DIR/diagnostic-derive.rs:626:17
--> $DIR/diagnostic-derive.rs:628:17
|
LL | suggestion: (Span,),
| ^^^^^^^
@ -463,13 +463,13 @@ LL | suggestion: (Span,),
= help: `#[suggestion(...)]` on a tuple field must be applied to fields of type `(Span, Applicability)`
error: suggestion without `code = "..."`
--> $DIR/diagnostic-derive.rs:633:5
--> $DIR/diagnostic-derive.rs:635:5
|
LL | #[suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[multipart_suggestion(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:640:1
--> $DIR/diagnostic-derive.rs:642:1
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -477,7 +477,7 @@ LL | #[multipart_suggestion(no_crate_suggestion)]
= help: consider creating a `Subdiagnostic` instead
error: `#[multipart_suggestion(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:647:5
--> $DIR/diagnostic-derive.rs:649:5
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -485,13 +485,13 @@ LL | #[multipart_suggestion(no_crate_suggestion)]
= help: consider creating a `Subdiagnostic` instead
error: unexpected end of input, unexpected token in nested attribute, expected ident
--> $DIR/diagnostic-derive.rs:643:24
--> $DIR/diagnostic-derive.rs:645:24
|
LL | #[multipart_suggestion()]
| ^
error: `#[suggestion(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:655:1
--> $DIR/diagnostic-derive.rs:657:1
|
LL | #[suggestion(no_crate_suggestion, code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -499,7 +499,7 @@ LL | #[suggestion(no_crate_suggestion, code = "...")]
= help: `#[label]` and `#[suggestion]` can only be applied to fields
error: `#[label]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:664:1
--> $DIR/diagnostic-derive.rs:666:1
|
LL | #[label]
| ^^^^^^^^
@ -507,31 +507,31 @@ LL | #[label]
= help: `#[label]` and `#[suggestion]` can only be applied to fields
error: `eager` is the only supported nested attribute for `subdiagnostic`
--> $DIR/diagnostic-derive.rs:698:7
--> $DIR/diagnostic-derive.rs:700:7
|
LL | #[subdiagnostic(bad)]
| ^^^^^^^^^^^^^^^^^^
error: `#[subdiagnostic = ...]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:706:5
--> $DIR/diagnostic-derive.rs:708:5
|
LL | #[subdiagnostic = "bad"]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: `eager` is the only supported nested attribute for `subdiagnostic`
--> $DIR/diagnostic-derive.rs:714:7
--> $DIR/diagnostic-derive.rs:716:7
|
LL | #[subdiagnostic(bad, bad)]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: `eager` is the only supported nested attribute for `subdiagnostic`
--> $DIR/diagnostic-derive.rs:722:7
--> $DIR/diagnostic-derive.rs:724:7
|
LL | #[subdiagnostic("bad")]
| ^^^^^^^^^^^^^^^^^^^^
error: `#[subdiagnostic(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:730:5
--> $DIR/diagnostic-derive.rs:732:5
|
LL | #[subdiagnostic(eager)]
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -539,31 +539,31 @@ LL | #[subdiagnostic(eager)]
= help: eager subdiagnostics are not supported on lints
error: expected at least one string literal for `code(...)`
--> $DIR/diagnostic-derive.rs:788:23
--> $DIR/diagnostic-derive.rs:790:23
|
LL | #[suggestion(code())]
| ^
error: `code(...)` must contain only string literals
--> $DIR/diagnostic-derive.rs:796:23
--> $DIR/diagnostic-derive.rs:798:23
|
LL | #[suggestion(code(foo))]
| ^^^
error: unexpected token
--> $DIR/diagnostic-derive.rs:796:23
--> $DIR/diagnostic-derive.rs:798:23
|
LL | #[suggestion(code(foo))]
| ^^^
error: expected string literal
--> $DIR/diagnostic-derive.rs:805:25
--> $DIR/diagnostic-derive.rs:807:25
|
LL | #[suggestion(code = 3)]
| ^
error: `#[suggestion(...)]` is not a valid attribute
--> $DIR/diagnostic-derive.rs:820:5
--> $DIR/diagnostic-derive.rs:822:5
|
LL | #[suggestion(no_crate_suggestion, code = "")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -573,67 +573,67 @@ LL | #[suggestion(no_crate_suggestion, code = "")]
= help: to show a variable set of suggestions, use a `Vec` of `Subdiagnostic`s annotated with `#[suggestion(...)]`
error: cannot find attribute `nonsense` in this scope
--> $DIR/diagnostic-derive.rs:58:3
--> $DIR/diagnostic-derive.rs:60:3
|
LL | #[nonsense(no_crate_example, code = "E0123")]
| ^^^^^^^^
error: cannot find attribute `nonsense` in this scope
--> $DIR/diagnostic-derive.rs:145:7
--> $DIR/diagnostic-derive.rs:147:7
|
LL | #[nonsense]
| ^^^^^^^^
error: cannot find attribute `error` in this scope
--> $DIR/diagnostic-derive.rs:578:3
--> $DIR/diagnostic-derive.rs:580:3
|
LL | #[error(no_crate_example, code = "E0123")]
| ^^^^^
error: cannot find attribute `warn_` in this scope
--> $DIR/diagnostic-derive.rs:585:3
--> $DIR/diagnostic-derive.rs:587:3
|
LL | #[warn_(no_crate_example, code = "E0123")]
| ^^^^^ help: a built-in attribute with a similar name exists: `warn`
error: cannot find attribute `lint` in this scope
--> $DIR/diagnostic-derive.rs:592:3
--> $DIR/diagnostic-derive.rs:594:3
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
error: cannot find attribute `lint` in this scope
--> $DIR/diagnostic-derive.rs:599:3
--> $DIR/diagnostic-derive.rs:601:3
|
LL | #[lint(no_crate_example, code = "E0123")]
| ^^^^ help: a built-in attribute with a similar name exists: `link`
error: cannot find attribute `multipart_suggestion` in this scope
--> $DIR/diagnostic-derive.rs:640:3
--> $DIR/diagnostic-derive.rs:642:3
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^
error: cannot find attribute `multipart_suggestion` in this scope
--> $DIR/diagnostic-derive.rs:643:3
--> $DIR/diagnostic-derive.rs:645:3
|
LL | #[multipart_suggestion()]
| ^^^^^^^^^^^^^^^^^^^^
error: cannot find attribute `multipart_suggestion` in this scope
--> $DIR/diagnostic-derive.rs:647:7
--> $DIR/diagnostic-derive.rs:649:7
|
LL | #[multipart_suggestion(no_crate_suggestion)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0425]: cannot find value `nonsense` in module `crate::fluent_generated`
--> $DIR/diagnostic-derive.rs:70:8
--> $DIR/diagnostic-derive.rs:72:8
|
LL | #[diag(nonsense, code = "E0123")]
| ^^^^^^^^ not found in `crate::fluent_generated`
error[E0425]: cannot find value `__code_34` in this scope
--> $DIR/diagnostic-derive.rs:802:10
--> $DIR/diagnostic-derive.rs:804:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ not found in this scope
@ -641,7 +641,7 @@ LL | #[derive(Diagnostic)]
= note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
--> $DIR/diagnostic-derive.rs:339:10
--> $DIR/diagnostic-derive.rs:341:10
|
LL | #[derive(Diagnostic)]
| ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`

View File

@ -12,12 +12,14 @@
#![crate_type = "lib"]
extern crate rustc_errors;
extern crate rustc_fluent_macro;
extern crate rustc_macros;
extern crate rustc_session;
extern crate rustc_span;
use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::{fluent_messages, Subdiagnostic};
use rustc_fluent_macro::fluent_messages;
use rustc_macros::Subdiagnostic;
use rustc_span::Span;
fluent_messages! { "./example.ftl" }

View File

@ -1,5 +1,5 @@
error: label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:50:1
--> $DIR/subdiagnostic-derive.rs:52:1
|
LL | / #[label(no_crate_example)]
LL | |
@ -9,133 +9,133 @@ LL | | }
| |_^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:57:1
--> $DIR/subdiagnostic-derive.rs:59:1
|
LL | #[label]
| ^^^^^^^^
error: `#[foo]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:66:1
--> $DIR/subdiagnostic-derive.rs:68:1
|
LL | #[foo]
| ^^^^^^
error: `#[label = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:76:1
--> $DIR/subdiagnostic-derive.rs:78:1
|
LL | #[label = "..."]
| ^^^^^^^^^^^^^^^^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:85:9
--> $DIR/subdiagnostic-derive.rs:87:9
|
LL | #[label(bug = "...")]
| ^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:85:1
--> $DIR/subdiagnostic-derive.rs:87:1
|
LL | #[label(bug = "...")]
| ^^^^^^^^^^^^^^^^^^^^^
error: unexpected literal in nested attribute, expected ident
--> $DIR/subdiagnostic-derive.rs:95:9
--> $DIR/subdiagnostic-derive.rs:97:9
|
LL | #[label("...")]
| ^^^^^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:104:9
--> $DIR/subdiagnostic-derive.rs:106:9
|
LL | #[label(slug = 4)]
| ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:104:1
--> $DIR/subdiagnostic-derive.rs:106:1
|
LL | #[label(slug = 4)]
| ^^^^^^^^^^^^^^^^^^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:114:9
--> $DIR/subdiagnostic-derive.rs:116:9
|
LL | #[label(slug("..."))]
| ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:114:1
--> $DIR/subdiagnostic-derive.rs:116:1
|
LL | #[label(slug("..."))]
| ^^^^^^^^^^^^^^^^^^^^^
error: unexpected end of input, unexpected token in nested attribute, expected ident
--> $DIR/subdiagnostic-derive.rs:134:9
--> $DIR/subdiagnostic-derive.rs:136:9
|
LL | #[label()]
| ^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:143:27
--> $DIR/subdiagnostic-derive.rs:145:27
|
LL | #[label(no_crate_example, code = "...")]
| ^^^^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:152:27
--> $DIR/subdiagnostic-derive.rs:154:27
|
LL | #[label(no_crate_example, applicability = "machine-applicable")]
| ^^^^^^^^^^^^^
error: unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive.rs:161:1
--> $DIR/subdiagnostic-derive.rs:163:1
|
LL | #[foo]
| ^^^^^^
error: `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:175:5
--> $DIR/subdiagnostic-derive.rs:177:5
|
LL | #[bar]
| ^^^^^^
error: `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:187:5
--> $DIR/subdiagnostic-derive.rs:189:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:199:5
--> $DIR/subdiagnostic-derive.rs:201:5
|
LL | #[bar = 4]
| ^^^^^^^^^^
error: `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:211:5
--> $DIR/subdiagnostic-derive.rs:213:5
|
LL | #[bar("...")]
| ^^^^^^^^^^^^^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:223:13
--> $DIR/subdiagnostic-derive.rs:225:13
|
LL | #[label(code = "...")]
| ^^^^
error: diagnostic slug must be first argument of a `#[label(...)]` attribute
--> $DIR/subdiagnostic-derive.rs:223:5
--> $DIR/subdiagnostic-derive.rs:225:5
|
LL | #[label(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^
error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:252:5
--> $DIR/subdiagnostic-derive.rs:254:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: label without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:249:1
--> $DIR/subdiagnostic-derive.rs:251:1
|
LL | / #[label(no_crate_example)]
LL | |
@ -147,13 +147,13 @@ LL | | }
| |_^
error: `#[applicability]` is only valid on suggestions
--> $DIR/subdiagnostic-derive.rs:262:5
--> $DIR/subdiagnostic-derive.rs:264:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: `#[bar]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:272:5
--> $DIR/subdiagnostic-derive.rs:274:5
|
LL | #[bar]
| ^^^^^^
@ -161,13 +161,13 @@ LL | #[bar]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: `#[bar = ...]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:283:5
--> $DIR/subdiagnostic-derive.rs:285:5
|
LL | #[bar = "..."]
| ^^^^^^^^^^^^^^
error: `#[bar(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:294:5
--> $DIR/subdiagnostic-derive.rs:296:5
|
LL | #[bar("...")]
| ^^^^^^^^^^^^^
@ -175,7 +175,7 @@ LL | #[bar("...")]
= help: only `primary_span`, `applicability` and `skip_arg` are valid field attributes
error: unexpected unsupported untagged union
--> $DIR/subdiagnostic-derive.rs:310:1
--> $DIR/subdiagnostic-derive.rs:312:1
|
LL | / union AC {
LL | |
@ -185,73 +185,73 @@ LL | | }
| |_^
error: a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive.rs:325:44
--> $DIR/subdiagnostic-derive.rs:327:44
|
LL | #[label(no_crate_example, no_crate::example)]
| ^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:338:5
--> $DIR/subdiagnostic-derive.rs:340:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:335:5
--> $DIR/subdiagnostic-derive.rs:337:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
error: subdiagnostic kind not specified
--> $DIR/subdiagnostic-derive.rs:344:8
--> $DIR/subdiagnostic-derive.rs:346:8
|
LL | struct AG {
| ^^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:381:46
--> $DIR/subdiagnostic-derive.rs:383:46
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:381:32
--> $DIR/subdiagnostic-derive.rs:383:32
|
LL | #[suggestion(no_crate_example, code = "...", code = "...")]
| ^^^^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:399:5
--> $DIR/subdiagnostic-derive.rs:401:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:396:5
--> $DIR/subdiagnostic-derive.rs:398:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: the `#[applicability]` attribute can only be applied to fields of type `Applicability`
--> $DIR/subdiagnostic-derive.rs:409:5
--> $DIR/subdiagnostic-derive.rs:411:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: suggestion without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:422:1
--> $DIR/subdiagnostic-derive.rs:424:1
|
LL | #[suggestion(no_crate_example)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: invalid applicability
--> $DIR/subdiagnostic-derive.rs:432:62
--> $DIR/subdiagnostic-derive.rs:434:62
|
LL | #[suggestion(no_crate_example, code = "...", applicability = "foo")]
| ^^^^^
error: suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:450:1
--> $DIR/subdiagnostic-derive.rs:452:1
|
LL | / #[suggestion(no_crate_example, code = "...")]
LL | |
@ -261,25 +261,25 @@ LL | | }
| |_^
error: unsupported type attribute for subdiagnostic enum
--> $DIR/subdiagnostic-derive.rs:464:1
--> $DIR/subdiagnostic-derive.rs:466:1
|
LL | #[label]
| ^^^^^^^^
error: `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:484:39
--> $DIR/subdiagnostic-derive.rs:486:39
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `var` doesn't refer to a field on this type
--> $DIR/subdiagnostic-derive.rs:503:43
--> $DIR/subdiagnostic-derive.rs:505:43
|
LL | #[suggestion(no_crate_example, code = "{var}", applicability = "machine-applicable")]
| ^^^^^^^
error: `#[suggestion_part]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:526:5
--> $DIR/subdiagnostic-derive.rs:528:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
@ -287,7 +287,7 @@ LL | #[suggestion_part]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions, use `#[primary_span]` instead
error: `#[suggestion_part(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:529:5
--> $DIR/subdiagnostic-derive.rs:531:5
|
LL | #[suggestion_part(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -295,7 +295,7 @@ LL | #[suggestion_part(code = "...")]
= help: `#[suggestion_part(...)]` is only valid in multipart suggestions
error: suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:523:1
--> $DIR/subdiagnostic-derive.rs:525:1
|
LL | / #[suggestion(no_crate_example, code = "...")]
LL | |
@ -307,7 +307,7 @@ LL | | }
| |_^
error: invalid nested attribute
--> $DIR/subdiagnostic-derive.rs:538:42
--> $DIR/subdiagnostic-derive.rs:540:42
|
LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
| ^^^^
@ -315,7 +315,7 @@ LL | #[multipart_suggestion(no_crate_example, code = "...", applicability = "mac
= help: only `style` and `applicability` are valid nested attributes
error: multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:538:1
--> $DIR/subdiagnostic-derive.rs:540:1
|
LL | / #[multipart_suggestion(no_crate_example, code = "...", applicability = "machine-applicable")]
LL | |
@ -326,19 +326,19 @@ LL | | }
| |_^
error: `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:548:5
--> $DIR/subdiagnostic-derive.rs:550:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
error: unexpected end of input, unexpected token in nested attribute, expected ident
--> $DIR/subdiagnostic-derive.rs:556:23
--> $DIR/subdiagnostic-derive.rs:558:23
|
LL | #[suggestion_part()]
| ^
error: `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:565:5
--> $DIR/subdiagnostic-derive.rs:567:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@ -346,7 +346,7 @@ LL | #[primary_span]
= help: multipart suggestions use one or more `#[suggestion_part]`s rather than one `#[primary_span]`
error: multipart suggestion without any `#[suggestion_part(...)]` fields
--> $DIR/subdiagnostic-derive.rs:562:1
--> $DIR/subdiagnostic-derive.rs:564:1
|
LL | / #[multipart_suggestion(no_crate_example)]
LL | |
@ -358,121 +358,121 @@ LL | | }
| |_^
error: `#[suggestion_part(...)]` attribute without `code = "..."`
--> $DIR/subdiagnostic-derive.rs:573:5
--> $DIR/subdiagnostic-derive.rs:575:5
|
LL | #[suggestion_part]
| ^^^^^^^^^^^^^^^^^^
error: `code` is the only valid nested attribute
--> $DIR/subdiagnostic-derive.rs:579:23
--> $DIR/subdiagnostic-derive.rs:581:23
|
LL | #[suggestion_part(foo = "bar")]
| ^^^
error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:583:5
--> $DIR/subdiagnostic-derive.rs:585:5
|
LL | #[suggestion_part(code = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[suggestion_part(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
--> $DIR/subdiagnostic-derive.rs:586:5
--> $DIR/subdiagnostic-derive.rs:588:5
|
LL | #[suggestion_part()]
| ^^^^^^^^^^^^^^^^^^^^
error: unexpected end of input, unexpected token in nested attribute, expected ident
--> $DIR/subdiagnostic-derive.rs:576:23
--> $DIR/subdiagnostic-derive.rs:578:23
|
LL | #[suggestion_part()]
| ^
error: expected `,`
--> $DIR/subdiagnostic-derive.rs:579:27
--> $DIR/subdiagnostic-derive.rs:581:27
|
LL | #[suggestion_part(foo = "bar")]
| ^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:594:37
--> $DIR/subdiagnostic-derive.rs:596:37
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:594:23
--> $DIR/subdiagnostic-derive.rs:596:23
|
LL | #[suggestion_part(code = "...", code = ",,,")]
| ^^^^
error: `#[applicability]` has no effect if all `#[suggestion]`/`#[multipart_suggestion]` attributes have a static `applicability = "..."`
--> $DIR/subdiagnostic-derive.rs:623:5
--> $DIR/subdiagnostic-derive.rs:625:5
|
LL | #[applicability]
| ^^^^^^^^^^^^^^^^
error: expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:671:34
--> $DIR/subdiagnostic-derive.rs:673:34
|
LL | #[suggestion_part(code("foo"))]
| ^
error: unexpected token
--> $DIR/subdiagnostic-derive.rs:671:28
--> $DIR/subdiagnostic-derive.rs:673:28
|
LL | #[suggestion_part(code("foo"))]
| ^^^^^
error: expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:681:41
--> $DIR/subdiagnostic-derive.rs:683:41
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^
error: unexpected token
--> $DIR/subdiagnostic-derive.rs:681:28
--> $DIR/subdiagnostic-derive.rs:683:28
|
LL | #[suggestion_part(code("foo", "bar"))]
| ^^^^^
error: expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:691:30
--> $DIR/subdiagnostic-derive.rs:693:30
|
LL | #[suggestion_part(code(3))]
| ^
error: unexpected token
--> $DIR/subdiagnostic-derive.rs:691:28
--> $DIR/subdiagnostic-derive.rs:693:28
|
LL | #[suggestion_part(code(3))]
| ^
error: expected exactly one string literal for `code = ...`
--> $DIR/subdiagnostic-derive.rs:701:29
--> $DIR/subdiagnostic-derive.rs:703:29
|
LL | #[suggestion_part(code())]
| ^
error: expected string literal
--> $DIR/subdiagnostic-derive.rs:713:30
--> $DIR/subdiagnostic-derive.rs:715:30
|
LL | #[suggestion_part(code = 3)]
| ^
error: specified multiple times
--> $DIR/subdiagnostic-derive.rs:755:1
--> $DIR/subdiagnostic-derive.rs:757:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: previously specified here
--> $DIR/subdiagnostic-derive.rs:755:1
--> $DIR/subdiagnostic-derive.rs:757:1
|
LL | #[suggestion(no_crate_example, code = "", style = "hidden", style = "normal")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:764:1
--> $DIR/subdiagnostic-derive.rs:766:1
|
LL | #[suggestion_hidden(no_crate_example, code = "")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -480,7 +480,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: `#[suggestion_hidden(...)]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:772:1
--> $DIR/subdiagnostic-derive.rs:774:1
|
LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -488,7 +488,7 @@ LL | #[suggestion_hidden(no_crate_example, code = "", style = "normal")]
= help: Use `#[suggestion(..., style = "hidden")]` instead
error: invalid suggestion style
--> $DIR/subdiagnostic-derive.rs:780:51
--> $DIR/subdiagnostic-derive.rs:782:51
|
LL | #[suggestion(no_crate_example, code = "", style = "foo")]
| ^^^^^
@ -496,31 +496,31 @@ LL | #[suggestion(no_crate_example, code = "", style = "foo")]
= help: valid styles are `normal`, `short`, `hidden`, `verbose` and `tool-only`
error: expected `= "xxx"`
--> $DIR/subdiagnostic-derive.rs:788:49
--> $DIR/subdiagnostic-derive.rs:790:49
|
LL | #[suggestion(no_crate_example, code = "", style = 42)]
| ^
error: a diagnostic slug must be the first argument to the attribute
--> $DIR/subdiagnostic-derive.rs:796:48
--> $DIR/subdiagnostic-derive.rs:798:48
|
LL | #[suggestion(no_crate_example, code = "", style)]
| ^
error: expected `= "xxx"`
--> $DIR/subdiagnostic-derive.rs:804:48
--> $DIR/subdiagnostic-derive.rs:806:48
|
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
| ^
error: expected `,`
--> $DIR/subdiagnostic-derive.rs:804:48
--> $DIR/subdiagnostic-derive.rs:806:48
|
LL | #[suggestion(no_crate_example, code = "", style("foo"))]
| ^
error: `#[primary_span]` is not a valid attribute
--> $DIR/subdiagnostic-derive.rs:816:5
--> $DIR/subdiagnostic-derive.rs:818:5
|
LL | #[primary_span]
| ^^^^^^^^^^^^^^^
@ -529,7 +529,7 @@ LL | #[primary_span]
= help: to create a suggestion with multiple spans, use `#[multipart_suggestion]` instead
error: suggestion without `#[primary_span]` field
--> $DIR/subdiagnostic-derive.rs:813:1
--> $DIR/subdiagnostic-derive.rs:815:1
|
LL | / #[suggestion(no_crate_example, code = "")]
LL | |
@ -541,67 +541,67 @@ LL | | }
| |_^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:66:3
--> $DIR/subdiagnostic-derive.rs:68:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `foo` in this scope
--> $DIR/subdiagnostic-derive.rs:161:3
--> $DIR/subdiagnostic-derive.rs:163:3
|
LL | #[foo]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:175:7
--> $DIR/subdiagnostic-derive.rs:177:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:187:7
--> $DIR/subdiagnostic-derive.rs:189:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:199:7
--> $DIR/subdiagnostic-derive.rs:201:7
|
LL | #[bar = 4]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:211:7
--> $DIR/subdiagnostic-derive.rs:213:7
|
LL | #[bar("...")]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:272:7
--> $DIR/subdiagnostic-derive.rs:274:7
|
LL | #[bar]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:283:7
--> $DIR/subdiagnostic-derive.rs:285:7
|
LL | #[bar = "..."]
| ^^^
error: cannot find attribute `bar` in this scope
--> $DIR/subdiagnostic-derive.rs:294:7
--> $DIR/subdiagnostic-derive.rs:296:7
|
LL | #[bar("...")]
| ^^^
error[E0425]: cannot find value `slug` in module `crate::fluent_generated`
--> $DIR/subdiagnostic-derive.rs:124:9
--> $DIR/subdiagnostic-derive.rs:126:9
|
LL | #[label(slug)]
| ^^^^ not found in `crate::fluent_generated`
error[E0425]: cannot find value `__code_29` in this scope
--> $DIR/subdiagnostic-derive.rs:707:10
--> $DIR/subdiagnostic-derive.rs:709:10
|
LL | #[derive(Subdiagnostic)]
| ^^^^^^^^^^^^^ not found in this scope