From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_mir_build/src/errors.rs | 51 ++++++++++++---------------------- 1 file changed, 18 insertions(+), 33 deletions(-) (limited to 'compiler/rustc_mir_build/src/errors.rs') diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index dc4d2276e..43e787db4 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -6,11 +6,11 @@ use rustc_errors::{ error_code, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic, MultiSpan, SubdiagnosticMessage, }; -use rustc_hir::def::Res; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_middle::thir::Pat; use rustc_middle::ty::{self, Ty}; -use rustc_span::{symbol::Ident, Span}; +use rustc_span::symbol::Symbol; +use rustc_span::Span; #[derive(LintDiagnostic)] #[diag(mir_build_unconditional_recursion)] @@ -534,18 +534,10 @@ pub struct TrailingIrrefutableLetPatterns { #[derive(LintDiagnostic)] #[diag(mir_build_bindings_with_variant_name, code = "E0170")] pub struct BindingsWithVariantName { - #[suggestion(code = "{ty_path}::{ident}", applicability = "machine-applicable")] + #[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")] pub suggestion: Option, pub ty_path: String, - pub ident: Ident, -} - -#[derive(LintDiagnostic)] -#[diag(mir_build_irrefutable_let_patterns_generic_let)] -#[note] -#[help] -pub struct IrrefutableLetPatternsGenericLet { - pub count: usize, + pub name: Symbol, } #[derive(LintDiagnostic)] @@ -584,13 +576,12 @@ pub struct IrrefutableLetPatternsWhileLet { #[diag(mir_build_borrow_of_moved_value)] pub struct BorrowOfMovedValue<'tcx> { #[primary_span] - pub span: Span, #[label] #[label(mir_build_occurs_because_label)] pub binding_span: Span, #[label(mir_build_value_borrowed_label)] pub conflicts_ref: Vec, - pub name: Ident, + pub name: Symbol, pub ty: Ty<'tcx>, #[suggestion(code = "ref ", applicability = "machine-applicable")] pub suggest_borrowing: Option, @@ -602,7 +593,7 @@ pub struct MultipleMutBorrows { #[primary_span] pub span: Span, #[subdiagnostic] - pub occurences: Vec, + pub occurrences: Vec, } #[derive(Diagnostic)] @@ -611,7 +602,7 @@ pub struct AlreadyBorrowed { #[primary_span] pub span: Span, #[subdiagnostic] - pub occurences: Vec, + pub occurrences: Vec, } #[derive(Diagnostic)] @@ -620,7 +611,7 @@ pub struct AlreadyMutBorrowed { #[primary_span] pub span: Span, #[subdiagnostic] - pub occurences: Vec, + pub occurrences: Vec, } #[derive(Diagnostic)] @@ -629,7 +620,7 @@ pub struct MovedWhileBorrowed { #[primary_span] pub span: Span, #[subdiagnostic] - pub occurences: Vec, + pub occurrences: Vec, } #[derive(Subdiagnostic)] @@ -638,19 +629,19 @@ pub enum Conflict { Mut { #[primary_span] span: Span, - name: Ident, + name: Symbol, }, #[label(mir_build_borrow)] Ref { #[primary_span] span: Span, - name: Ident, + name: Symbol, }, #[label(mir_build_moved)] Moved { #[primary_span] span: Span, - name: Ident, + name: Symbol, }, } @@ -663,6 +654,8 @@ pub struct UnionPattern { #[derive(Diagnostic)] #[diag(mir_build_type_not_structural)] +#[note(mir_build_type_not_structural_tip)] +#[note(mir_build_type_not_structural_more_info)] pub struct TypeNotStructural<'tcx> { #[primary_span] pub span: Span, @@ -695,12 +688,16 @@ pub struct PointerPattern; #[derive(LintDiagnostic)] #[diag(mir_build_indirect_structural_match)] +#[note(mir_build_type_not_structural_tip)] +#[note(mir_build_type_not_structural_more_info)] pub struct IndirectStructuralMatch<'tcx> { pub non_sm_ty: Ty<'tcx>, } #[derive(LintDiagnostic)] #[diag(mir_build_nontrivial_structural_match)] +#[note(mir_build_type_not_structural_tip)] +#[note(mir_build_type_not_structural_more_info)] pub struct NontrivialStructuralMatch<'tcx> { pub non_sm_ty: Ty<'tcx>, } @@ -796,8 +793,6 @@ pub(crate) struct PatternNotCovered<'s, 'tcx> { pub let_suggestion: Option, #[subdiagnostic] pub misc_suggestion: Option, - #[subdiagnostic] - pub res_defined_here: Option, } #[derive(Subdiagnostic)] @@ -831,14 +826,6 @@ impl<'tcx> AddToDiagnostic for AdtDefinedHere<'tcx> { } } -#[derive(Subdiagnostic)] -#[label(mir_build_res_defined_here)] -pub struct ResDefinedHere { - #[primary_span] - pub def_span: Span, - pub res: Res, -} - #[derive(Subdiagnostic)] #[suggestion( mir_build_interpreted_as_const, @@ -849,9 +836,7 @@ pub struct ResDefinedHere { pub struct InterpretedAsConst { #[primary_span] pub span: Span, - pub article: &'static str, pub variable: String, - pub res: Res, } #[derive(Subdiagnostic)] -- cgit v1.2.3