1 use std::path::PathBuf;
3 use rustc_errors::ErrorGuaranteed;
4 use rustc_errors::IntoDiagnostic;
5 use rustc_macros::{Diagnostic, LintDiagnostic};
9 #[diag(monomorphize_recursion_limit)]
10 pub struct RecursionLimit {
16 pub def_path_str: String,
17 #[note(monomorphize_written_to_path)]
18 pub was_written: Option<()>,
23 #[diag(monomorphize_type_length_limit)]
24 #[help(monomorphize_consider_type_length_limit)]
25 pub struct TypeLengthLimit {
29 #[note(monomorphize_written_to_path)]
30 pub was_written: Option<()>,
32 pub type_length: usize,
35 pub struct UnusedGenericParams {
37 pub param_spans: Vec<Span>,
38 pub param_names: Vec<String>,
41 impl IntoDiagnostic<'_> for UnusedGenericParams {
44 handler: &'_ rustc_errors::Handler,
45 ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
46 let mut diag = handler.struct_err(rustc_errors::fluent::monomorphize_unused_generic_params);
47 diag.set_span(self.span);
48 for (span, name) in self.param_spans.into_iter().zip(self.param_names) {
49 // FIXME: I can figure out how to do a label with a fluent string with a fixed message,
50 // or a label with a dynamic value in a hard-coded string, but I haven't figured out
51 // how to combine the two. 😢
52 diag.span_label(span, format!("generic parameter `{}` is unused", name));
58 #[derive(LintDiagnostic)]
59 #[diag(monomorphize_large_assignments)]
61 pub struct LargeAssignmentsLint {
69 #[diag(monomorphize_unknown_partition_strategy)]
70 pub struct UnknownPartitionStrategy;
73 #[diag(monomorphize_symbol_already_defined)]
74 pub struct SymbolAlreadyDefined {
76 pub span: Option<Span>,