diff options
| author | bors <bors@rust-lang.org> | 2022-11-04 19:43:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-04 19:43:36 +0000 |
| commit | 09508489efc223287731fe8abbd2a81bbf7adf8e (patch) | |
| tree | 6ab0b4cf00da631b7510ff05449647bf2b43a5fe /compiler/rustc_passes/src/errors.rs | |
| parent | c2a5c3a50fc3fb6d16cd140f55f7db61cbf08a01 (diff) | |
| parent | 347c478d886acc7e1b94af83f7fa882f73e809b7 (diff) | |
Auto merge of #103978 - matthiaskrgr:rollup-iym9kmg, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #103367 (Remove std's transitive dependency on cfg-if 0.1) - #103397 (Port `dead_code` lints to be translatable.) - #103681 (libtest: run all tests in their own thread, if supported by the host) - #103792 (Migrate `codegen_ssa` to diagnostics structs - [Part 2]) - #103897 (asm: Work around LLVM bug on AArch64) - #103937 (minor changes to make method lookup diagnostic code easier to read) - #103958 (Test tidy should not count untracked paths towards entries limit) - #103964 (Give a specific lint for unsafety not being inherited) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_passes/src/errors.rs')
| -rw-r--r-- | compiler/rustc_passes/src/errors.rs | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index fb883ae2ed0..d8bed700f52 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -4,7 +4,9 @@ use std::{ }; 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}; @@ -1446,3 +1448,59 @@ pub struct MissingConstErr { #[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>, +} |
