1
Fork 0

Replace &mut DiagnosticBuilder, in signatures, with &mut Diagnostic.

This commit is contained in:
Eduard-Mihai Burtescu 2022-01-23 20:41:46 +00:00
parent f24ff1815f
commit 02ff9e0aef
65 changed files with 369 additions and 466 deletions

View file

@ -2,7 +2,7 @@ use std::cmp;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_errors::{DiagnosticBuilder, DiagnosticId};
use rustc_errors::{Diagnostic, DiagnosticBuilder, DiagnosticId};
use rustc_hir::HirId;
use rustc_index::vec::IndexVec;
use rustc_query_system::ich::StableHashingContext;
@ -202,12 +202,12 @@ impl<'a> LintDiagnosticBuilder<'a> {
}
}
pub fn explain_lint_level_source<'s>(
sess: &'s Session,
pub fn explain_lint_level_source(
sess: &Session,
lint: &'static Lint,
level: Level,
src: LintLevelSource,
err: &mut DiagnosticBuilder<'s>,
err: &mut Diagnostic,
) {
let name = lint.name_lower();
match src {

View file

@ -7,7 +7,7 @@ use crate::ty::{self, DefIdTree, TyCtxt};
use rustc_ast::NodeId;
use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_errors::{Applicability, Diagnostic};
use rustc_feature::GateIssue;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
@ -167,7 +167,7 @@ pub fn deprecation_in_effect(depr: &Deprecation) -> bool {
}
pub fn deprecation_suggestion(
diag: &mut DiagnosticBuilder<'_>,
diag: &mut Diagnostic,
kind: &str,
suggestion: Option<Symbol>,
span: Span,

View file

@ -15,7 +15,7 @@ use crate::ty::subst::SubstsRef;
use crate::ty::{self, AdtKind, Ty, TyCtxt};
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_errors::{Applicability, Diagnostic};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_span::symbol::Symbol;
@ -841,7 +841,7 @@ impl ObjectSafetyViolation {
}
}
pub fn solution(&self, err: &mut DiagnosticBuilder<'_>) {
pub fn solution(&self, err: &mut Diagnostic) {
match *self {
ObjectSafetyViolation::SizedSelf(_) | ObjectSafetyViolation::SupertraitSelf(_) => {}
ObjectSafetyViolation::Method(

View file

@ -7,7 +7,7 @@ use crate::ty::{
ProjectionTy, Term, Ty, TyCtxt, TypeAndMut,
};
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_errors::{Applicability, Diagnostic};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{QPath, TyKind, WhereBoundPredicate, WherePredicate};
@ -129,7 +129,7 @@ impl<'tcx> Ty<'tcx> {
pub fn suggest_arbitrary_trait_bound(
generics: &hir::Generics<'_>,
err: &mut DiagnosticBuilder<'_>,
err: &mut Diagnostic,
param_name: &str,
constraint: &str,
) -> bool {
@ -159,7 +159,7 @@ pub fn suggest_arbitrary_trait_bound(
fn suggest_removing_unsized_bound(
generics: &hir::Generics<'_>,
err: &mut DiagnosticBuilder<'_>,
err: &mut Diagnostic,
param_name: &str,
param: &hir::GenericParam<'_>,
def_id: Option<DefId>,
@ -266,7 +266,7 @@ fn suggest_removing_unsized_bound(
pub fn suggest_constraining_type_param(
tcx: TyCtxt<'_>,
generics: &hir::Generics<'_>,
err: &mut DiagnosticBuilder<'_>,
err: &mut Diagnostic,
param_name: &str,
constraint: &str,
def_id: Option<DefId>,

View file

@ -3,7 +3,7 @@ use crate::ty::diagnostics::suggest_constraining_type_param;
use crate::ty::print::{FmtPrinter, Printer};
use crate::ty::{self, BoundRegionKind, Region, Ty, TyCtxt};
use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
use rustc_errors::{pluralize, DiagnosticBuilder};
use rustc_errors::{pluralize, Diagnostic};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_span::symbol::{sym, Symbol};
@ -347,7 +347,8 @@ impl<'tcx> Ty<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn note_and_explain_type_err(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
err: &TypeError<'tcx>,
cause: &ObligationCause<'tcx>,
sp: Span,
@ -584,7 +585,8 @@ impl<T> Trait<T> for X {
fn suggest_constraint(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
msg: &str,
body_owner_def_id: DefId,
proj_ty: &ty::ProjectionTy<'tcx>,
@ -671,7 +673,8 @@ impl<T> Trait<T> for X {
/// fn that returns the type.
fn expected_projection(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
proj_ty: &ty::ProjectionTy<'tcx>,
values: &ExpectedFound<Ty<'tcx>>,
body_owner_def_id: DefId,
@ -766,7 +769,8 @@ fn foo(&self) -> Self::T { String::new() }
/// a return type. This can occur when dealing with `TryStream` (#71035).
fn suggest_constraining_opaque_associated_type(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
msg: &str,
proj_ty: &ty::ProjectionTy<'tcx>,
ty: Ty<'tcx>,
@ -802,7 +806,8 @@ fn foo(&self) -> Self::T { String::new() }
fn point_at_methods_that_satisfy_associated_type(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
assoc_container_id: DefId,
current_method_ident: Option<Symbol>,
proj_ty_item_def_id: DefId,
@ -857,7 +862,8 @@ fn foo(&self) -> Self::T { String::new() }
fn point_at_associated_type(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
body_owner_def_id: DefId,
found: Ty<'tcx>,
) -> bool {
@ -921,7 +927,8 @@ fn foo(&self) -> Self::T { String::new() }
/// type is defined on a supertrait of the one present in the bounds.
fn constrain_generic_bound_associated_type_structured_suggestion(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
trait_ref: &ty::TraitRef<'tcx>,
bounds: hir::GenericBounds<'_>,
assoc: &ty::AssocItem,
@ -958,7 +965,8 @@ fn foo(&self) -> Self::T { String::new() }
/// associated type to a given type `ty`.
fn constrain_associated_type_structured_suggestion(
self,
db: &mut DiagnosticBuilder<'_>,
// FIXME(eddyb) rename this since it's no longer a `DiagnosticBuilder`.
db: &mut Diagnostic,
span: Span,
assoc: &ty::AssocItem,
assoc_substs: &[ty::GenericArg<'tcx>],