};
use rustc_ast::Label;
-use rustc_errors::{error_code, Applicability, ErrorGuaranteed, IntoDiagnostic, MultiSpan};
+use rustc_errors::{
+ error_code, Applicability, DiagnosticSymbolList, ErrorGuaranteed, IntoDiagnostic, MultiSpan,
+};
use rustc_hir::{self as hir, ExprKind, Target};
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_middle::ty::{MainDefinition, Ty};
pub attr_span: Span,
#[label]
pub defn_span: Span,
+ pub on_crate: bool,
}
#[derive(Diagnostic)]
pub attr_span: Span,
#[label]
pub defn_span: Span,
+ pub on_crate: bool,
}
#[derive(Diagnostic)]
#[note(no_op_note)]
pub struct DocTestUnknownSpotlight {
pub path: String,
- #[suggestion_short(applicability = "machine-applicable", code = "notable_trait")]
+ #[suggestion(style = "short", applicability = "machine-applicable", code = "notable_trait")]
pub span: Span,
}
pub struct Cold {
#[label]
pub span: Span,
+ pub on_crate: bool,
}
#[derive(LintDiagnostic)]
#[diag(passes_missing_panic_handler)]
pub struct MissingPanicHandler;
-#[derive(Diagnostic)]
-#[diag(passes_alloc_func_required)]
-pub struct AllocFuncRequired;
-
-#[derive(Diagnostic)]
-#[diag(passes_missing_alloc_error_handler)]
-pub struct MissingAllocErrorHandler;
-
#[derive(Diagnostic)]
#[diag(passes_missing_lang_item)]
#[note]
}
impl IntoDiagnostic<'_> for InvalidAttrAtCrateLevel {
+ #[track_caller]
fn into_diagnostic(
self,
handler: &'_ rustc_errors::Handler,
}
impl<'a> IntoDiagnostic<'_> for BreakNonLoop<'a> {
+ #[track_caller]
fn into_diagnostic(
self,
handler: &rustc_errors::Handler,
#[label]
pub span: Span,
pub name: &'a str,
+ pub is_break: bool,
}
#[derive(Diagnostic)]
}
impl IntoDiagnostic<'_> for NakedFunctionsAsmBlock {
+ #[track_caller]
fn into_diagnostic(
self,
handler: &rustc_errors::Handler,
}
impl<'a> IntoDiagnostic<'a> for NoMainErr {
+ #[track_caller]
fn into_diagnostic(
self,
handler: &'a rustc_errors::Handler,
}
impl IntoDiagnostic<'_> for DuplicateLangItem {
+ #[track_caller]
fn into_diagnostic(
self,
handler: &rustc_errors::Handler,
#[label]
pub const_span: Span,
}
+
+#[derive(LintDiagnostic)]
+pub enum MultipleDeadCodes<'tcx> {
+ #[diag(passes_dead_codes)]
+ DeadCodes {
+ multiple: bool,
+ num: usize,
+ descr: &'tcx str,
+ participle: &'tcx str,
+ name_list: DiagnosticSymbolList,
+ #[subdiagnostic]
+ parent_info: Option<ParentInfo<'tcx>>,
+ #[subdiagnostic]
+ ignored_derived_impls: Option<IgnoredDerivedImpls>,
+ },
+ #[diag(passes_dead_codes)]
+ UnusedTupleStructFields {
+ multiple: bool,
+ num: usize,
+ descr: &'tcx str,
+ participle: &'tcx str,
+ name_list: DiagnosticSymbolList,
+ #[subdiagnostic]
+ change_fields_suggestion: ChangeFieldsToBeOfUnitType,
+ #[subdiagnostic]
+ parent_info: Option<ParentInfo<'tcx>>,
+ #[subdiagnostic]
+ ignored_derived_impls: Option<IgnoredDerivedImpls>,
+ },
+}
+
+#[derive(Subdiagnostic)]
+#[label(passes_parent_info)]
+pub struct ParentInfo<'tcx> {
+ pub num: usize,
+ pub descr: &'tcx str,
+ pub parent_descr: &'tcx str,
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(Subdiagnostic)]
+#[note(passes_ignored_derived_impls)]
+pub struct IgnoredDerivedImpls {
+ pub name: Symbol,
+ pub trait_list: DiagnosticSymbolList,
+ pub trait_list_len: usize,
+}
+
+#[derive(Subdiagnostic)]
+#[multipart_suggestion(passes_change_fields_to_be_of_unit_type, applicability = "has-placeholders")]
+pub struct ChangeFieldsToBeOfUnitType {
+ pub num: usize,
+ #[suggestion_part(code = "()")]
+ pub spans: Vec<Span>,
+}