From 57fdd196aeda1e0fa5829248bd4afb8e6f06d7e5 Mon Sep 17 00:00:00 2001 From: Nikita Tomashevich Date: Thu, 22 Sep 2022 17:29:21 +0300 Subject: [PATCH] Rebase and fix --- compiler/rustc_infer/src/errors/mod.rs | 26 +++++++++---------- .../nice_region_error/static_impl_trait.rs | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs index dc79c725951..55df63075d2 100644 --- a/compiler/rustc_infer/src/errors/mod.rs +++ b/compiler/rustc_infer/src/errors/mod.rs @@ -4,9 +4,9 @@ MultiSpan, SubdiagnosticMessage, }; use rustc_hir as hir; -use rustc_hir::{FnRetTy, Ty}; +use rustc_hir::FnRetTy; use rustc_macros::{Diagnostic, Subdiagnostic}; -use rustc_middle::ty::{Region, TyCtxt}; +use rustc_middle::ty::{Region, Ty, TyCtxt}; use rustc_span::symbol::kw; use rustc_span::Symbol; use rustc_span::{symbol::Ident, BytePos, Span}; @@ -522,7 +522,7 @@ pub struct MismatchedStaticLifetime<'a> { pub implicit_static_lifetimes: Vec, } -#[derive(SessionDiagnostic)] +#[derive(Diagnostic)] #[diag(infer::explicit_lifetime_required, code = "E0621")] pub struct ExplicitLifetimeRequired<'a> { #[primary_span] @@ -542,7 +542,7 @@ pub struct ExplicitLifetimeRequired<'a> { pub new_ty: Ty<'a>, } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] pub enum ActualImplExplNotes { // Field names have to be different across all variants #[note(infer::actual_impl_expl_1)] @@ -565,7 +565,7 @@ pub enum ActualImplExplNotes { }, } -#[derive(SessionDiagnostic)] +#[derive(Diagnostic)] #[diag(infer::trait_placeholder_mismatch)] pub struct TraitPlaceholderMismatch { #[primary_span] @@ -587,7 +587,7 @@ pub struct ConsiderBorrowingParamHelp { pub spans: Vec, } -impl AddSubdiagnostic for ConsiderBorrowingParamHelp { +impl AddToDiagnostic for ConsiderBorrowingParamHelp { fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { let mut type_param_span: MultiSpan = self.spans.clone().into(); for &span in &self.spans { @@ -597,11 +597,11 @@ fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { } } -#[derive(SessionSubdiagnostic)] +#[derive(Subdiagnostic)] #[help(infer::tid_rel_help)] pub struct RelationshipHelp; -#[derive(SessionDiagnostic)] +#[derive(Diagnostic)] #[diag(infer::trait_impl_diff)] pub struct TraitImplDiff { #[primary_span] @@ -626,7 +626,7 @@ pub struct DynTraitConstraintSuggestion { pub ident: Ident, } -impl AddSubdiagnostic for DynTraitConstraintSuggestion { +impl AddToDiagnostic for DynTraitConstraintSuggestion { fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { let mut multi_span: MultiSpan = vec![self.span].into(); multi_span.push_span_label(self.span, fluent::infer::dtcs_has_lifetime_req_label); @@ -641,7 +641,7 @@ fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { } } -#[derive(SessionDiagnostic)] +#[derive(Diagnostic)] #[diag(infer::but_calling_introduces, code = "E0772")] pub struct ButCallingIntroduces { #[label(infer::label1)] @@ -667,7 +667,7 @@ pub struct ReqIntroducedLocations { pub add_label: bool, } -impl AddSubdiagnostic for ReqIntroducedLocations { +impl AddToDiagnostic for ReqIntroducedLocations { fn add_to_diagnostic(mut self, diag: &mut rustc_errors::Diagnostic) { for sp in self.spans { self.span.push_span_label(sp, fluent::infer::ril_introduced_here); @@ -685,7 +685,7 @@ pub struct MoreTargeted { pub ident: Symbol, } -impl AddSubdiagnostic for MoreTargeted { +impl AddToDiagnostic for MoreTargeted { fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { diag.code(rustc_errors::error_code!(E0772)); diag.set_primary_message(fluent::infer::more_targeted); @@ -693,7 +693,7 @@ fn add_to_diagnostic(self, diag: &mut rustc_errors::Diagnostic) { } } -#[derive(SessionDiagnostic)] +#[derive(Diagnostic)] #[diag(infer::but_needs_to_satisfy, code = "E0759")] pub struct ButNeedsToSatisfy { #[primary_span] diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index b76f7e7689f..fbc71bd7e01 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -9,7 +9,7 @@ use crate::infer::{SubregionOrigin, TypeTrace}; use crate::traits::{ObligationCauseCode, UnifyReceiverContext}; use rustc_data_structures::fx::FxHashSet; -use rustc_errors::{AddSubdiagnostic, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan}; +use rustc_errors::{AddToDiagnostic, Applicability, Diagnostic, ErrorGuaranteed, MultiSpan}; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::{walk_ty, Visitor}; use rustc_hir::{self as hir, GenericBound, Item, ItemKind, Lifetime, LifetimeName, Node, TyKind};