Rename DiagnosticBuilder
as Diag
.
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
This commit is contained in:
parent
4e1f9bd528
commit
899cb40809
153 changed files with 1136 additions and 1367 deletions
|
@ -9,7 +9,7 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
|
|||
use rustc_data_structures::sorted_map::SortedMap;
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::{
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -371,7 +371,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
// FIXME(fmease): Heavily adapted from `rustc_hir_typeck::method::suggest`. Deduplicate.
|
||||
fn note_ambiguous_inherent_assoc_type(
|
||||
&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
candidates: Vec<DefId>,
|
||||
span: Span,
|
||||
) {
|
||||
|
@ -429,7 +429,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
let tcx = self.tcx();
|
||||
|
||||
let adt_did = self_ty.ty_adt_def().map(|def| def.did());
|
||||
let add_def_label = |err: &mut DiagnosticBuilder<'_>| {
|
||||
let add_def_label = |err: &mut Diag<'_>| {
|
||||
if let Some(did) = adt_did {
|
||||
err.span_label(
|
||||
tcx.def_span(did),
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::astconv::{
|
|||
use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
|
||||
use rustc_ast::ast::ParamKindOrd;
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, MultiSpan,
|
||||
codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
|
@ -47,7 +47,7 @@ fn generic_arg_mismatch_err(
|
|||
}
|
||||
}
|
||||
|
||||
let add_braces_suggestion = |arg: &GenericArg<'_>, err: &mut DiagnosticBuilder<'_>| {
|
||||
let add_braces_suggestion = |arg: &GenericArg<'_>, err: &mut Diag<'_>| {
|
||||
let suggestions = vec![
|
||||
(arg.span().shrink_to_lo(), String::from("{ ")),
|
||||
(arg.span().shrink_to_hi(), String::from(" }")),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use rustc_ast::TraitObjectSyntax;
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, EmissionGuarantee, StashKey};
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee, StashKey};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_lint_defs::{builtin::BARE_TRAIT_OBJECTS, Applicability};
|
||||
|
@ -13,7 +13,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
pub(super) fn maybe_lint_blanket_trait_impl<G: EmissionGuarantee>(
|
||||
&self,
|
||||
self_ty: &hir::Ty<'_>,
|
||||
diag: &mut DiagnosticBuilder<'_, G>,
|
||||
diag: &mut Diag<'_, G>,
|
||||
) {
|
||||
let tcx = self.tcx();
|
||||
let parent_id = tcx.hir().get_parent_item(self_ty.hir_id).def_id;
|
||||
|
@ -75,11 +75,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
}
|
||||
|
||||
/// Make sure that we are in the condition to suggest `impl Trait`.
|
||||
fn maybe_lint_impl_trait(
|
||||
&self,
|
||||
self_ty: &hir::Ty<'_>,
|
||||
diag: &mut DiagnosticBuilder<'_>,
|
||||
) -> bool {
|
||||
fn maybe_lint_impl_trait(&self, self_ty: &hir::Ty<'_>, diag: &mut Diag<'_>) -> bool {
|
||||
let tcx = self.tcx();
|
||||
let parent_id = tcx.hir().get_parent_item(self_ty.hir_id).def_id;
|
||||
let (sig, generics, owner) = match tcx.hir_node_by_def_id(parent_id) {
|
||||
|
|
|
@ -18,8 +18,7 @@ use crate::require_c_abi_if_c_variadic;
|
|||
use rustc_ast::TraitObjectSyntax;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_errors::{
|
||||
codes::*, struct_span_code_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError,
|
||||
MultiSpan,
|
||||
codes::*, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, FatalError, MultiSpan,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
|
||||
|
@ -1723,7 +1722,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
pub fn prohibit_generics<'a>(
|
||||
&self,
|
||||
segments: impl Iterator<Item = &'a hir::PathSegment<'a>> + Clone,
|
||||
extend: impl Fn(&mut DiagnosticBuilder<'_>),
|
||||
extend: impl Fn(&mut Diag<'_>),
|
||||
) -> bool {
|
||||
let args = segments.clone().flat_map(|segment| segment.args().args);
|
||||
|
||||
|
@ -2739,7 +2738,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
&self,
|
||||
constrained_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
referenced_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
generate_err: impl Fn(&str) -> DiagnosticBuilder<'tcx>,
|
||||
generate_err: impl Fn(&str) -> Diag<'tcx>,
|
||||
) {
|
||||
for br in referenced_regions.difference(&constrained_regions) {
|
||||
let br_name = match *br {
|
||||
|
|
|
@ -1236,7 +1236,7 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
|||
fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) {
|
||||
// Helper closure to reduce duplicate code. This gets called everytime we detect a duplicate.
|
||||
// Here `idx` refers to the order of which the discriminant appears, and its index in `vs`
|
||||
let report = |dis: Discr<'tcx>, idx, err: &mut DiagnosticBuilder<'_>| {
|
||||
let report = |dis: Discr<'tcx>, idx, err: &mut Diag<'_>| {
|
||||
let var = adt.variant(idx); // HIR for the duplicate discriminant
|
||||
let (span, display_discr) = match var.discr {
|
||||
ty::VariantDiscr::Explicit(discr_def_id) => {
|
||||
|
@ -1296,7 +1296,7 @@ fn detect_discriminant_duplicate<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
|
|||
let mut i = 0;
|
||||
while i < discrs.len() {
|
||||
let var_i_idx = discrs[i].0;
|
||||
let mut error: Option<DiagnosticBuilder<'_, _>> = None;
|
||||
let mut error: Option<Diag<'_, _>> = None;
|
||||
|
||||
let mut o = i + 1;
|
||||
while o < discrs.len() {
|
||||
|
|
|
@ -78,7 +78,7 @@ use std::num::NonZero;
|
|||
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_errors::{pluralize, struct_span_code_err, DiagnosticBuilder};
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Diag};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, StashKey};
|
||||
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, StashKey};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
|
||||
|
@ -186,7 +186,7 @@ pub(crate) fn placeholder_type_error_diag<'tcx>(
|
|||
suggest: bool,
|
||||
hir_ty: Option<&hir::Ty<'_>>,
|
||||
kind: &'static str,
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
) -> Diag<'tcx> {
|
||||
if placeholder_types.is_empty() {
|
||||
return bad_placeholder(tcx, additional_spans, kind);
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ fn bad_placeholder<'tcx>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
mut spans: Vec<Span>,
|
||||
kind: &'static str,
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
) -> Diag<'tcx> {
|
||||
let kind = if kind.ends_with('s') { format!("{kind}es") } else { format!("{kind}s") };
|
||||
|
||||
spans.sort();
|
||||
|
|
|
@ -1181,13 +1181,12 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
&& !self.tcx.asyncness(lifetime_ref.hir_id.owner.def_id).is_async()
|
||||
&& !self.tcx.features().anonymous_lifetime_in_impl_trait
|
||||
{
|
||||
let mut diag: rustc_errors::DiagnosticBuilder<'_> =
|
||||
rustc_session::parse::feature_err(
|
||||
&self.tcx.sess,
|
||||
sym::anonymous_lifetime_in_impl_trait,
|
||||
lifetime_ref.ident.span,
|
||||
"anonymous lifetimes in `impl Trait` are unstable",
|
||||
);
|
||||
let mut diag: rustc_errors::Diag<'_> = rustc_session::parse::feature_err(
|
||||
&self.tcx.sess,
|
||||
sym::anonymous_lifetime_in_impl_trait,
|
||||
lifetime_ref.ident.span,
|
||||
"anonymous lifetimes in `impl Trait` are unstable",
|
||||
);
|
||||
|
||||
if let Some(generics) =
|
||||
self.tcx.hir().get_generics(lifetime_ref.hir_id.owner.def_id)
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{
|
||||
codes::*, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
MultiSpan,
|
||||
codes::*, Applicability, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::Ty;
|
||||
|
@ -359,8 +358,8 @@ pub struct MissingTypeParams {
|
|||
// Manual implementation of `IntoDiagnostic` to be able to call `span_to_snippet`.
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for MissingTypeParams {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
let mut err = DiagnosticBuilder::new(dcx, level, fluent::hir_analysis_missing_type_params);
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
let mut err = Diag::new(dcx, level, fluent::hir_analysis_missing_type_params);
|
||||
err.span(self.span);
|
||||
err.code(E0393);
|
||||
err.arg("parameterCount", self.missing_type_params.len());
|
||||
|
|
|
@ -6,7 +6,7 @@ pub use self::{
|
|||
missing_cast_for_variadic_arg::*, sized_unsized_cast::*, wrong_number_of_generic_args::*,
|
||||
};
|
||||
|
||||
use rustc_errors::{DiagnosticBuilder, ErrCode};
|
||||
use rustc_errors::{Diag, ErrCode};
|
||||
use rustc_session::Session;
|
||||
|
||||
pub trait StructuredDiagnostic<'tcx> {
|
||||
|
@ -14,7 +14,7 @@ pub trait StructuredDiagnostic<'tcx> {
|
|||
|
||||
fn code(&self) -> ErrCode;
|
||||
|
||||
fn diagnostic(&self) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic(&self) -> Diag<'tcx> {
|
||||
let err = self.diagnostic_common();
|
||||
|
||||
if self.session().teach(self.code()) {
|
||||
|
@ -24,13 +24,13 @@ pub trait StructuredDiagnostic<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx>;
|
||||
fn diagnostic_common(&self) -> Diag<'tcx>;
|
||||
|
||||
fn diagnostic_regular(&self, err: DiagnosticBuilder<'tcx>) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_regular(&self, err: Diag<'tcx>) -> Diag<'tcx> {
|
||||
err
|
||||
}
|
||||
|
||||
fn diagnostic_extended(&self, err: DiagnosticBuilder<'tcx>) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_extended(&self, err: Diag<'tcx>) -> Diag<'tcx> {
|
||||
err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{errors, structured_errors::StructuredDiagnostic};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, Diag};
|
||||
use rustc_middle::ty::{Ty, TypeVisitableExt};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
|
@ -20,7 +20,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> {
|
|||
E0617
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_common(&self) -> Diag<'tcx> {
|
||||
let (sugg_span, replace, help) =
|
||||
if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.span) {
|
||||
(Some(self.span), format!("{} as {}", snippet, self.cast_ty), None)
|
||||
|
@ -44,7 +44,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> {
|
|||
err
|
||||
}
|
||||
|
||||
fn diagnostic_extended(&self, mut err: DiagnosticBuilder<'tcx>) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_extended(&self, mut err: Diag<'tcx>) -> Diag<'tcx> {
|
||||
err.note(format!(
|
||||
"certain types, like `{}`, must be casted before passing them to a \
|
||||
variadic function, because of arcane ABI rules dictated by the C \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{errors, structured_errors::StructuredDiagnostic};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder};
|
||||
use rustc_errors::{codes::*, Diag};
|
||||
use rustc_middle::ty::{Ty, TypeVisitableExt};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
|
@ -20,7 +20,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
|
|||
E0607
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_common(&self) -> Diag<'tcx> {
|
||||
let mut err = self.sess.dcx().create_err(errors::CastThinPointerToFatPointer {
|
||||
span: self.span,
|
||||
expr_ty: self.expr_ty,
|
||||
|
@ -34,7 +34,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
|
|||
err
|
||||
}
|
||||
|
||||
fn diagnostic_extended(&self, mut err: DiagnosticBuilder<'tcx>) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_extended(&self, mut err: Diag<'tcx>) -> Diag<'tcx> {
|
||||
err.help(
|
||||
"Thin pointers are \"simple\" pointers: they are purely a reference to a
|
||||
memory address.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::structured_errors::StructuredDiagnostic;
|
||||
use rustc_errors::{codes::*, pluralize, Applicability, DiagnosticBuilder, MultiSpan};
|
||||
use rustc_errors::{codes::*, pluralize, Applicability, Diag, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt};
|
||||
use rustc_session::Session;
|
||||
|
@ -518,14 +518,14 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx> {
|
||||
fn start_diagnostics(&self) -> Diag<'tcx> {
|
||||
let span = self.path_segment.ident.span;
|
||||
let msg = self.create_error_message();
|
||||
self.tcx.dcx().struct_span_err(span, msg).with_code(self.code())
|
||||
}
|
||||
|
||||
/// Builds the `expected 1 type argument / supplied 2 type arguments` message.
|
||||
fn notify(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn notify(&self, err: &mut Diag<'_>) {
|
||||
let (quantifier, bound) = self.get_quantifier_and_bound();
|
||||
let provided_args = self.num_provided_args();
|
||||
|
||||
|
@ -577,7 +577,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn suggest(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest(&self, err: &mut Diag<'_>) {
|
||||
debug!(
|
||||
"suggest(self.provided {:?}, self.gen_args.span(): {:?})",
|
||||
self.num_provided_args(),
|
||||
|
@ -605,7 +605,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
/// ```text
|
||||
/// type Map = HashMap<String>;
|
||||
/// ```
|
||||
fn suggest_adding_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_adding_args(&self, err: &mut Diag<'_>) {
|
||||
if self.gen_args.parenthesized != hir::GenericArgsParentheses::No {
|
||||
return;
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn suggest_adding_lifetime_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_adding_lifetime_args(&self, err: &mut Diag<'_>) {
|
||||
debug!("suggest_adding_lifetime_args(path_segment: {:?})", self.path_segment);
|
||||
let num_missing_args = self.num_missing_lifetime_args();
|
||||
let num_params_to_take = num_missing_args;
|
||||
|
@ -678,7 +678,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn suggest_adding_type_and_const_args(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_adding_type_and_const_args(&self, err: &mut Diag<'_>) {
|
||||
let num_missing_args = self.num_missing_type_or_const_args();
|
||||
let msg = format!("add missing {} argument{}", self.kind(), pluralize!(num_missing_args));
|
||||
|
||||
|
@ -738,7 +738,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
/// ```compile_fail
|
||||
/// Into::into::<Option<_>>(42) // suggests considering `Into::<Option<_>>::into(42)`
|
||||
/// ```
|
||||
fn suggest_moving_args_from_assoc_fn_to_trait(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_moving_args_from_assoc_fn_to_trait(&self, err: &mut Diag<'_>) {
|
||||
let trait_ = match self.tcx.trait_of_item(self.def_id) {
|
||||
Some(def_id) => def_id,
|
||||
None => return,
|
||||
|
@ -794,7 +794,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
|
||||
fn suggest_moving_args_from_assoc_fn_to_trait_for_qualified_path(
|
||||
&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
qpath: &'tcx hir::QPath<'tcx>,
|
||||
msg: String,
|
||||
num_assoc_fn_excess_args: usize,
|
||||
|
@ -827,7 +827,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
|
||||
fn suggest_moving_args_from_assoc_fn_to_trait_for_method_call(
|
||||
&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
trait_def_id: DefId,
|
||||
expr: &'tcx hir::Expr<'tcx>,
|
||||
msg: String,
|
||||
|
@ -881,7 +881,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
/// ```text
|
||||
/// type Map = HashMap<String, String, String, String>;
|
||||
/// ```
|
||||
fn suggest_removing_args_or_generics(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn suggest_removing_args_or_generics(&self, err: &mut Diag<'_>) {
|
||||
let num_provided_lt_args = self.num_provided_lifetime_args();
|
||||
let num_provided_type_const_args = self.num_provided_type_or_const_args();
|
||||
let unbound_types = self.get_unbound_associated_types();
|
||||
|
@ -899,7 +899,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
let provided_args_matches_unbound_traits =
|
||||
unbound_types.len() == num_redundant_type_or_const_args;
|
||||
|
||||
let remove_lifetime_args = |err: &mut DiagnosticBuilder<'_>| {
|
||||
let remove_lifetime_args = |err: &mut Diag<'_>| {
|
||||
let mut lt_arg_spans = Vec::new();
|
||||
let mut found_redundant = false;
|
||||
for arg in self.gen_args.args {
|
||||
|
@ -940,7 +940,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
);
|
||||
};
|
||||
|
||||
let remove_type_or_const_args = |err: &mut DiagnosticBuilder<'_>| {
|
||||
let remove_type_or_const_args = |err: &mut Diag<'_>| {
|
||||
let mut gen_arg_spans = Vec::new();
|
||||
let mut found_redundant = false;
|
||||
for arg in self.gen_args.args {
|
||||
|
@ -1037,7 +1037,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// Builds the `type defined here` message.
|
||||
fn show_definition(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn show_definition(&self, err: &mut Diag<'_>) {
|
||||
let mut spans: MultiSpan = if let Some(def_span) = self.tcx.def_ident_span(self.def_id) {
|
||||
if self.tcx.sess.source_map().is_span_accessible(def_span) {
|
||||
def_span.into()
|
||||
|
@ -1088,7 +1088,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// Add note if `impl Trait` is explicitly specified.
|
||||
fn note_synth_provided(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn note_synth_provided(&self, err: &mut Diag<'_>) {
|
||||
if !self.is_synth_provided() {
|
||||
return;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx> {
|
|||
E0107
|
||||
}
|
||||
|
||||
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx> {
|
||||
fn diagnostic_common(&self) -> Diag<'tcx> {
|
||||
let mut err = self.start_diagnostics();
|
||||
|
||||
self.notify(&mut err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue