rename ErrorReported -> ErrorGuaranteed

This commit is contained in:
mark 2022-01-23 12:34:26 -06:00
parent c42d846add
commit e489a94dee
112 changed files with 580 additions and 559 deletions

View file

@ -6,7 +6,7 @@ use crate::astconv::{
use crate::errors::AssocTypeBindingNotAllowed;
use crate::structured_errors::{GenericArgsInfo, StructuredDiagnostic, WrongNumberOfGenericArgs};
use rustc_ast::ast::ParamKindOrd;
use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorReported};
use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::DefId;
@ -602,7 +602,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
correct: if lifetimes_correct && args_correct {
Ok(())
} else {
Err(GenericArgCountMismatch { reported: Some(ErrorReported), invalid_args })
Err(GenericArgCountMismatch { reported: Some(ErrorGuaranteed), invalid_args })
},
}
}

View file

@ -15,7 +15,9 @@ use crate::middle::resolve_lifetime as rl;
use crate::require_c_abi_if_c_variadic;
use rustc_ast::TraitObjectSyntax;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported, FatalError};
use rustc_errors::{
struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError,
};
use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
use rustc_hir::def_id::{DefId, LocalDefId};
@ -162,7 +164,7 @@ pub(crate) enum GenericArgPosition {
#[derive(Clone, Default)]
pub struct GenericArgCountMismatch {
/// Indicates whether a fatal error was reported (`Some`), or just a lint (`None`).
pub reported: Option<ErrorReported>,
pub reported: Option<ErrorGuaranteed>,
/// A list of spans of arguments provided that were not valid.
pub invalid_args: Vec<Span>,
}
@ -733,7 +735,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let mut dup_bindings = FxHashMap::default();
for binding in &assoc_bindings {
// Specify type to assert that error was already reported in `Err` case.
let _: Result<_, ErrorReported> = self.add_predicates_for_ast_type_binding(
let _: Result<_, ErrorGuaranteed> = self.add_predicates_for_ast_type_binding(
hir_id,
poly_trait_ref,
binding,
@ -742,7 +744,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
&mut dup_bindings,
binding_span.unwrap_or(binding.span),
);
// Okay to ignore `Err` because of `ErrorReported` (see above).
// Okay to ignore `Err` because of `ErrorGuaranteed` (see above).
}
arg_count
@ -1096,7 +1098,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
speculative: bool,
dup_bindings: &mut FxHashMap<DefId, Span>,
path_span: Span,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
// Given something like `U: SomeTrait<T = X>`, we want to produce a
// predicate like `<U as SomeTrait>::T = X`. This is somewhat
// subtle in the event that `T` is defined in a supertrait of
@ -1604,7 +1606,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
ty_param_def_id: LocalDefId,
assoc_name: Ident,
span: Span,
) -> Result<ty::PolyTraitRef<'tcx>, ErrorReported> {
) -> Result<ty::PolyTraitRef<'tcx>, ErrorGuaranteed> {
let tcx = self.tcx();
debug!(
@ -1646,7 +1648,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
assoc_name: Ident,
span: Span,
is_equality: impl Fn() -> Option<String>,
) -> Result<ty::PolyTraitRef<'tcx>, ErrorReported>
) -> Result<ty::PolyTraitRef<'tcx>, ErrorGuaranteed>
where
I: Iterator<Item = ty::PolyTraitRef<'tcx>>,
{
@ -1665,7 +1667,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
assoc_name,
span,
);
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
};
debug!("one_bound_for_assoc_type: bound = {:?}", bound);
@ -1752,7 +1754,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
}
err.emit();
if !where_bounds.is_empty() {
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
}
@ -1775,7 +1777,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
qself_res: Res,
assoc_segment: &hir::PathSegment<'_>,
permit_variants: bool,
) -> Result<(Ty<'tcx>, DefKind, DefId), ErrorReported> {
) -> Result<(Ty<'tcx>, DefKind, DefId), ErrorGuaranteed> {
let tcx = self.tcx();
let assoc_ident = assoc_segment.ident;
@ -1809,7 +1811,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// trait reference.
let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) else {
// A cycle error occurred, most likely.
return Err(ErrorReported);
return Err(ErrorGuaranteed);
};
self.one_bound_for_assoc_type(
@ -1878,7 +1880,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
assoc_ident.name,
);
}
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
};
@ -1897,7 +1899,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let Some(item) = item else {
let msg = format!("found associated const `{assoc_ident}` when type was expected");
tcx.sess.struct_span_err(span, &msg).emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
};
let ty = self.projected_ty_from_poly_trait_ref(span, item.def_id, assoc_segment, bound);
@ -2617,7 +2619,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, ErrorReported>,
generate_err: impl Fn(&str) -> DiagnosticBuilder<'tcx, ErrorGuaranteed>,
) {
for br in referenced_regions.difference(&constrained_regions) {
let br_name = match *br {

View file

@ -32,7 +32,7 @@ use super::FnCtxt;
use crate::hir::def_id::DefId;
use crate::type_error_struct;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::lang_items::LangItem;
use rustc_middle::mir::Mutability;
@ -86,13 +86,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&self,
t: Ty<'tcx>,
span: Span,
) -> Result<Option<PointerKind<'tcx>>, ErrorReported> {
) -> Result<Option<PointerKind<'tcx>>, ErrorGuaranteed> {
debug!("pointer_kind({:?}, {:?})", t, span);
let t = self.resolve_vars_if_possible(t);
if t.references_error() {
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
if self.type_is_known_to_be_sized_modulo_regions(t, span) {
@ -142,7 +142,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.tcx
.sess
.delay_span_bug(span, &format!("`{:?}` should be sized but is not?", t));
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
})
}
@ -150,7 +150,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
#[derive(Copy, Clone)]
pub enum CastError {
ErrorReported,
ErrorGuaranteed,
CastToBool,
CastToChar,
@ -167,9 +167,9 @@ pub enum CastError {
UnknownCastPtrKind,
}
impl From<ErrorReported> for CastError {
fn from(ErrorReported: ErrorReported) -> Self {
CastError::ErrorReported
impl From<ErrorGuaranteed> for CastError {
fn from(ErrorGuaranteed: ErrorGuaranteed) -> Self {
CastError::ErrorGuaranteed
}
}
@ -179,7 +179,7 @@ fn make_invalid_casting_error<'a, 'tcx>(
expr_ty: Ty<'tcx>,
cast_ty: Ty<'tcx>,
fcx: &FnCtxt<'a, 'tcx>,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
type_error_struct!(
sess,
span,
@ -199,7 +199,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
cast_ty: Ty<'tcx>,
cast_span: Span,
span: Span,
) -> Result<CastCheck<'tcx>, ErrorReported> {
) -> Result<CastCheck<'tcx>, ErrorGuaranteed> {
let check = CastCheck { expr, expr_ty, cast_ty, cast_span, span };
// For better error messages, check for some obviously unsized
@ -208,7 +208,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
match cast_ty.kind() {
ty::Dynamic(..) | ty::Slice(..) => {
check.report_cast_to_unsized_type(fcx);
Err(ErrorReported)
Err(ErrorGuaranteed)
}
_ => Ok(check),
}
@ -216,7 +216,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
fn report_cast_error(&self, fcx: &FnCtxt<'a, 'tcx>, e: CastError) {
match e {
CastError::ErrorReported => {
CastError::ErrorGuaranteed => {
// an error has already been reported
}
CastError::NeedDeref => {

View file

@ -4,7 +4,7 @@ use super::compare_method::{compare_const_impl, compare_impl_method, compare_ty_
use super::*;
use rustc_attr as attr;
use rustc_errors::{Applicability, ErrorReported};
use rustc_errors::{Applicability, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::Visitor;
@ -623,13 +623,13 @@ pub(super) fn check_opaque_for_cycles<'tcx>(
substs: SubstsRef<'tcx>,
span: Span,
origin: &hir::OpaqueTyOrigin,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
if tcx.try_expand_impl_trait_type(def_id.to_def_id(), substs).is_err() {
match origin {
hir::OpaqueTyOrigin::AsyncFn(..) => async_opaque_type_cycle_error(tcx, span),
_ => opaque_type_cycle_error(tcx, def_id, span),
}
Err(ErrorReported)
Err(ErrorGuaranteed)
} else {
Ok(())
}
@ -760,7 +760,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item<'tcx>) {
let assoc_item = tcx.associated_item(item.def_id);
let trait_substs =
InternalSubsts::identity_for_item(tcx, it.def_id.to_def_id());
let _: Result<_, rustc_errors::ErrorReported> = check_type_bounds(
let _: Result<_, rustc_errors::ErrorGuaranteed> = check_type_bounds(
tcx,
assoc_item,
assoc_item,

View file

@ -37,7 +37,9 @@
use crate::astconv::AstConv;
use crate::check::FnCtxt;
use rustc_errors::{struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorReported};
use rustc_errors::{
struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
@ -1520,7 +1522,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
fcx: &FnCtxt<'a, 'tcx>,
id: hir::HirId,
expression: Option<(&'tcx hir::Expr<'tcx>, hir::HirId)>,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut err = fcx.report_mismatched_types(cause, expected, found, ty_err);
let mut pointing_at_return_type = false;

View file

@ -1,6 +1,6 @@
use crate::errors::LifetimesOrBoundsMismatchOnTrait;
use rustc_data_structures::stable_set::FxHashSet;
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, ErrorReported};
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_hir::intravisit;
@ -41,34 +41,35 @@ crate fn compare_impl_method<'tcx>(
let impl_m_span = tcx.sess.source_map().guess_head_span(impl_m_span);
if let Err(ErrorReported) = compare_self_type(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref)
if let Err(ErrorGuaranteed) =
compare_self_type(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref)
{
return;
}
if let Err(ErrorReported) =
if let Err(ErrorGuaranteed) =
compare_number_of_generics(tcx, impl_m, impl_m_span, trait_m, trait_item_span)
{
return;
}
if let Err(ErrorReported) =
if let Err(ErrorGuaranteed) =
compare_number_of_method_arguments(tcx, impl_m, impl_m_span, trait_m, trait_item_span)
{
return;
}
if let Err(ErrorReported) = compare_synthetic_generics(tcx, impl_m, trait_m) {
if let Err(ErrorGuaranteed) = compare_synthetic_generics(tcx, impl_m, trait_m) {
return;
}
if let Err(ErrorReported) =
if let Err(ErrorGuaranteed) =
compare_predicate_entailment(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref)
{
return;
}
if let Err(ErrorReported) = compare_const_param_types(tcx, impl_m, trait_m, trait_item_span) {
if let Err(ErrorGuaranteed) = compare_const_param_types(tcx, impl_m, trait_m, trait_item_span) {
return;
}
}
@ -79,7 +80,7 @@ fn compare_predicate_entailment<'tcx>(
impl_m_span: Span,
trait_m: &ty::AssocItem,
impl_trait_ref: ty::TraitRef<'tcx>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let trait_to_impl_substs = impl_trait_ref.substs;
// This node-id should be used for the `body_id` field on each
@ -385,7 +386,7 @@ fn compare_predicate_entailment<'tcx>(
false,
);
diag.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
// Check that all obligations are satisfied by the implementation's
@ -393,7 +394,7 @@ fn compare_predicate_entailment<'tcx>(
let errors = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx);
if !errors.is_empty() {
infcx.report_fulfillment_errors(&errors, None, false);
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
// Finally, resolve all regions. This catches wily misuses of
@ -412,7 +413,7 @@ fn check_region_bounds_on_impl_item<'tcx>(
trait_m: &ty::AssocItem,
trait_generics: &ty::Generics,
impl_generics: &ty::Generics,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let trait_params = trait_generics.own_counts().lifetimes;
let impl_params = impl_generics.own_counts().lifetimes;
@ -455,7 +456,7 @@ fn check_region_bounds_on_impl_item<'tcx>(
ident: impl_m.ident(tcx),
generics_span,
});
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
Ok(())
@ -501,7 +502,7 @@ fn compare_self_type<'tcx>(
impl_m_span: Span,
trait_m: &ty::AssocItem,
impl_trait_ref: ty::TraitRef<'tcx>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
// Try to give more informative error messages about self typing
// mismatches. Note that any mismatch will also be detected
// below, where we construct a canonical function type that
@ -550,7 +551,7 @@ fn compare_self_type<'tcx>(
err.note_trait_signature(trait_m.name.to_string(), trait_m.signature(tcx));
}
err.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
(true, false) => {
@ -570,7 +571,7 @@ fn compare_self_type<'tcx>(
err.note_trait_signature(trait_m.name.to_string(), trait_m.signature(tcx));
}
err.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
}
@ -583,7 +584,7 @@ fn compare_number_of_generics<'tcx>(
_impl_span: Span,
trait_: &ty::AssocItem,
trait_span: Option<Span>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let trait_own_counts = tcx.generics_of(trait_.def_id).own_counts();
let impl_own_counts = tcx.generics_of(impl_.def_id).own_counts();
@ -693,7 +694,7 @@ fn compare_number_of_generics<'tcx>(
}
}
if err_occurred { Err(ErrorReported) } else { Ok(()) }
if err_occurred { Err(ErrorGuaranteed) } else { Ok(()) }
}
fn compare_number_of_method_arguments<'tcx>(
@ -702,7 +703,7 @@ fn compare_number_of_method_arguments<'tcx>(
impl_m_span: Span,
trait_m: &ty::AssocItem,
trait_item_span: Option<Span>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let impl_m_fty = tcx.fn_sig(impl_m.def_id);
let trait_m_fty = tcx.fn_sig(trait_m.def_id);
let trait_number_args = trait_m_fty.inputs().skip_binder().len();
@ -772,7 +773,7 @@ fn compare_number_of_method_arguments<'tcx>(
),
);
err.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
Ok(())
@ -782,7 +783,7 @@ fn compare_synthetic_generics<'tcx>(
tcx: TyCtxt<'tcx>,
impl_m: &ty::AssocItem,
trait_m: &ty::AssocItem,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
// FIXME(chrisvittal) Clean up this function, list of FIXME items:
// 1. Better messages for the span labels
// 2. Explanation as to what is going on
@ -921,7 +922,7 @@ fn compare_synthetic_generics<'tcx>(
error_found = true;
}
}
if error_found { Err(ErrorReported) } else { Ok(()) }
if error_found { Err(ErrorGuaranteed) } else { Ok(()) }
}
fn compare_const_param_types<'tcx>(
@ -929,7 +930,7 @@ fn compare_const_param_types<'tcx>(
impl_m: &ty::AssocItem,
trait_m: &ty::AssocItem,
trait_item_span: Option<Span>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let const_params_of = |def_id| {
tcx.generics_of(def_id).params.iter().filter_map(|param| match param.kind {
GenericParamDefKind::Const { .. } => Some(param.def_id),
@ -979,7 +980,7 @@ fn compare_const_param_types<'tcx>(
),
);
err.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
}
@ -1101,7 +1102,7 @@ crate fn compare_ty_impl<'tcx>(
) {
debug!("compare_impl_type(impl_trait_ref={:?})", impl_trait_ref);
let _: Result<(), ErrorReported> = (|| {
let _: Result<(), ErrorGuaranteed> = (|| {
compare_number_of_generics(tcx, impl_ty, impl_ty_span, trait_ty, trait_item_span)?;
let sp = tcx.def_span(impl_ty.def_id);
@ -1119,7 +1120,7 @@ fn compare_type_predicate_entailment<'tcx>(
impl_ty_span: Span,
trait_ty: &ty::AssocItem,
impl_trait_ref: ty::TraitRef<'tcx>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let impl_substs = InternalSubsts::identity_for_item(tcx, impl_ty.def_id);
let trait_to_impl_substs =
impl_substs.rebase_onto(tcx, impl_ty.container.id(), impl_trait_ref.substs);
@ -1203,7 +1204,7 @@ fn compare_type_predicate_entailment<'tcx>(
let errors = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx);
if !errors.is_empty() {
infcx.report_fulfillment_errors(&errors, None, false);
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
// Finally, resolve all regions. This catches wily misuses of
@ -1235,7 +1236,7 @@ pub fn check_type_bounds<'tcx>(
impl_ty: &ty::AssocItem,
impl_ty_span: Span,
impl_trait_ref: ty::TraitRef<'tcx>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
// Given
//
// impl<A, B> Foo<u32> for (A, B) {
@ -1427,7 +1428,7 @@ pub fn check_type_bounds<'tcx>(
let errors = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx);
if !errors.is_empty() {
infcx.report_fulfillment_errors(&errors, None, false);
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
// Finally, resolve all regions. This catches wily misuses of

View file

@ -4,7 +4,7 @@ use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::ObligationCause;
use rustc_ast::util::parser::PREC_POSTFIX;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorReported};
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::lang_items::LangItem;
use rustc_hir::{is_range_literal, Node};
@ -57,7 +57,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
self.demand_suptype_with_origin(&self.misc(sp), expected, actual)
}
@ -67,7 +67,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
match self.at(cause, self.param_env).sup(expected, actual) {
Ok(InferOk { obligations, value: () }) => {
self.register_predicates(obligations);
@ -88,7 +88,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
sp: Span,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
self.demand_eqtype_with_origin(&self.misc(sp), expected, actual)
}
@ -97,7 +97,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
cause: &ObligationCause<'tcx>,
expected: Ty<'tcx>,
actual: Ty<'tcx>,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
match self.at(cause, self.param_env).eq(expected, actual) {
Ok(InferOk { obligations, value: () }) => {
self.register_predicates(obligations);
@ -134,7 +134,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected: Ty<'tcx>,
expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>,
allow_two_phase: AllowTwoPhase,
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx, ErrorReported>>) {
) -> (Ty<'tcx>, Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>>) {
let expected = self.resolve_vars_with_obligations(expected);
let e = match self.try_coerce(expr, checked_ty, expected, allow_two_phase, None) {

View file

@ -1,7 +1,7 @@
use crate::check::regionck::RegionCtxt;
use crate::hir;
use crate::hir::def_id::{DefId, LocalDefId};
use rustc_errors::{struct_span_err, ErrorReported};
use rustc_errors::{struct_span_err, ErrorGuaranteed};
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
use rustc_infer::infer::{InferOk, RegionckMode, TyCtxtInferExt};
use rustc_infer::traits::TraitEngineExt as _;
@ -31,7 +31,7 @@ use rustc_trait_selection::traits::{ObligationCause, TraitEngine, TraitEngineExt
/// struct/enum definition for the nominal type itself (i.e.
/// cannot do `struct S<T>; impl<T:Clone> Drop for S<T> { ... }`).
///
pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), ErrorReported> {
pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), ErrorGuaranteed> {
let dtor_self_type = tcx.type_of(drop_impl_did);
let dtor_predicates = tcx.predicates_of(drop_impl_did);
match dtor_self_type.kind() {
@ -59,7 +59,7 @@ pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), Erro
span,
&format!("should have been rejected by coherence check: {}", dtor_self_type),
);
Err(ErrorReported)
Err(ErrorGuaranteed)
}
}
}
@ -69,7 +69,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
drop_impl_did: LocalDefId,
drop_impl_ty: Ty<'tcx>,
self_type_did: DefId,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let drop_impl_hir_id = tcx.hir().local_def_id_to_hir_id(drop_impl_did);
// check that the impl type can be made to match the trait type.
@ -109,7 +109,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
),
)
.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
}
@ -117,7 +117,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
if !errors.is_empty() {
// this could be reached when we get lazy normalization
infcx.report_fulfillment_errors(&errors, None, false);
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
// NB. It seems a bit... suspicious to use an empty param-env
@ -146,7 +146,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
dtor_predicates: ty::GenericPredicates<'tcx>,
self_type_did: LocalDefId,
self_to_impl_substs: SubstsRef<'tcx>,
) -> Result<(), ErrorReported> {
) -> Result<(), ErrorGuaranteed> {
let mut result = Ok(());
// Here is an example, analogous to that from
@ -268,7 +268,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
)
.span_note(item_span, "the implementor must specify the same requirement")
.emit();
result = Err(ErrorReported);
result = Err(ErrorGuaranteed);
}
}

View file

@ -26,7 +26,7 @@ use rustc_ast as ast;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_errors::Diagnostic;
use rustc_errors::ErrorReported;
use rustc_errors::ErrorGuaranteed;
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, DiagnosticId};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
@ -1188,7 +1188,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
deferred_cast_checks.push(cast_check);
t_cast
}
Err(ErrorReported) => self.tcx.ty_error(),
Err(ErrorGuaranteed) => self.tcx.ty_error(),
}
}
}
@ -2225,7 +2225,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
field: Ident,
expr_t: Ty<'tcx>,
id: HirId,
) -> DiagnosticBuilder<'_, ErrorReported> {
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
let span = field.span;
debug!("no_such_field_err(span: {:?}, field: {:?}, expr_t: {:?})", span, field, expr_t);

View file

@ -8,7 +8,7 @@ use crate::check::{BreakableCtxt, Diverges, Expectation, FnCtxt, LocalTy};
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{Applicability, Diagnostic, ErrorReported};
use rustc_errors::{Applicability, Diagnostic, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Res};
use rustc_hir::def_id::DefId;
@ -158,7 +158,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub(in super::super) fn write_resolution(
&self,
hir_id: hir::HirId,
r: Result<(DefKind, DefId), ErrorReported>,
r: Result<(DefKind, DefId), ErrorGuaranteed>,
) {
self.typeck_results.borrow_mut().type_dependent_defs_mut().insert(hir_id, r);
}
@ -900,7 +900,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.or_else(|error| {
let result = match error {
method::MethodError::PrivateMatch(kind, def_id, _) => Ok((kind, def_id)),
_ => Err(ErrorReported),
_ => Err(ErrorGuaranteed),
};
// If we have a path like `MyTrait::missing_method`, then don't register

View file

@ -4,7 +4,7 @@
use crate::check::FnCtxt;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorReported,
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
@ -93,7 +93,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
source: SelfSource<'tcx>,
error: MethodError<'tcx>,
args: Option<&'tcx [hir::Expr<'tcx>]>,
) -> Option<DiagnosticBuilder<'_, ErrorReported>> {
) -> Option<DiagnosticBuilder<'_, ErrorGuaranteed>> {
// Avoid suggestions when we don't know what's going on.
if rcvr_ty.references_error() {
return None;

View file

@ -3,7 +3,7 @@ use rustc_ast as ast;
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorReported,
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind, Res};
@ -100,7 +100,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
expected: Ty<'tcx>,
actual: Ty<'tcx>,
ti: TopInfo<'tcx>,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
self.demand_eqtype_with_origin(&self.pattern_cause(ti, cause_span), expected, actual)
}
@ -818,7 +818,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
fn emit_bad_pat_path<'b>(
&self,
mut e: DiagnosticBuilder<'_, ErrorReported>,
mut e: DiagnosticBuilder<'_, ErrorGuaranteed>,
pat_span: Span,
res: Res,
pat_res: Res,
@ -1369,7 +1369,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
variant: &VariantDef,
pat: &'_ Pat<'_>,
fields: &[hir::PatField<'_>],
) -> Option<DiagnosticBuilder<'_, ErrorReported>> {
) -> Option<DiagnosticBuilder<'_, ErrorGuaranteed>> {
// if this is a tuple struct, then all field names will be numbers
// so if any fields in a struct pattern use shorthand syntax, they will
// be invalid identifiers (for example, Foo { 0, 1 }).
@ -1442,7 +1442,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
inexistent_fields: &[Ident],
unmentioned_fields: &mut Vec<(&ty::FieldDef, Ident)>,
variant: &ty::VariantDef,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let tcx = self.tcx;
let (field_names, t, plural) = if inexistent_fields.len() == 1 {
(format!("a field named `{}`", inexistent_fields[0]), "this", "")
@ -1538,7 +1538,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pat: &Pat<'_>,
fields: &'tcx [hir::PatField<'tcx>],
variant: &ty::VariantDef,
) -> Option<DiagnosticBuilder<'tcx, ErrorReported>> {
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
if let (CtorKind::Fn, PatKind::Struct(qpath, ..)) = (variant.ctor_kind, &pat.kind) {
let path = rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| {
s.print_qpath(qpath, false)
@ -1620,7 +1620,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
&self,
pat: &Pat<'_>,
fields: &'tcx [hir::PatField<'tcx>],
) -> DiagnosticBuilder<'tcx, ErrorReported> {
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let mut err = self
.tcx
.sess
@ -1712,7 +1712,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
unmentioned_fields: &[(&ty::FieldDef, Ident)],
have_inaccessible_fields: bool,
fields: &'tcx [hir::PatField<'tcx>],
) -> DiagnosticBuilder<'tcx, ErrorReported> {
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let inaccessible = if have_inaccessible_fields { " and inaccessible fields" } else { "" };
let field_names = if unmentioned_fields.len() == 1 {
format!("field `{}`{}", unmentioned_fields[0].1, inaccessible)

View file

@ -4,7 +4,7 @@ use crate::constrained_generic_params::{identify_constrained_generic_params, Par
use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit as hir_visit;
@ -1764,7 +1764,7 @@ fn report_bivariance(
tcx: TyCtxt<'_>,
param: &rustc_hir::GenericParam<'_>,
has_explicit_bounds: bool,
) -> ErrorReported {
) -> ErrorGuaranteed {
let span = param.span;
let param_name = param.name.ident().name;
let mut err = error_392(tcx, span, param_name);
@ -1977,7 +1977,7 @@ fn error_392(
tcx: TyCtxt<'_>,
span: Span,
param_name: Symbol,
) -> DiagnosticBuilder<'_, ErrorReported> {
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
let mut err =
struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name);
err.span_label(span, "unused parameter");

View file

@ -5,7 +5,7 @@
use crate::check::FnCtxt;
use rustc_data_structures::stable_map::FxHashMap;
use rustc_errors::ErrorReported;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{self, Visitor};
@ -80,8 +80,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
mem::take(&mut self.typeck_results.borrow_mut().treat_byte_string_as_slice);
if self.is_tainted_by_errors() {
// FIXME(eddyb) keep track of `ErrorReported` from where the error was emitted.
wbcx.typeck_results.tainted_by_errors = Some(ErrorReported);
// FIXME(eddyb) keep track of `ErrorGuaranteed` from where the error was emitted.
wbcx.typeck_results.tainted_by_errors = Some(ErrorGuaranteed);
}
debug!("writeback: typeck results for {:?} are {:#?}", item_def_id, wbcx.typeck_results);
@ -661,8 +661,8 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
// to mark the `TypeckResults` as tainted in that case, so that downstream
// users of the typeck results don't produce extra errors, or worse, ICEs.
if resolver.replaced_with_error {
// FIXME(eddyb) keep track of `ErrorReported` from where the error was emitted.
self.typeck_results.tainted_by_errors = Some(ErrorReported);
// FIXME(eddyb) keep track of `ErrorGuaranteed` from where the error was emitted.
self.typeck_results.tainted_by_errors = Some(ErrorGuaranteed);
}
x

View file

@ -3,7 +3,7 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::struct_span_err;
use rustc_errors::ErrorReported;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
use rustc_index::bit_set::GrowableBitSet;
use rustc_infer::infer::TyCtxtInferExt;
@ -21,7 +21,7 @@ pub(super) fn orphan_check_crate(tcx: TyCtxt<'_>, (): ()) -> &[LocalDefId] {
for &impl_of_trait in impls_of_trait {
match orphan_check_impl(tcx, impl_of_trait) {
Ok(()) => {}
Err(ErrorReported) => errors.push(impl_of_trait),
Err(ErrorGuaranteed) => errors.push(impl_of_trait),
}
}
@ -33,7 +33,7 @@ pub(super) fn orphan_check_crate(tcx: TyCtxt<'_>, (): ()) -> &[LocalDefId] {
}
#[instrument(skip(tcx), level = "debug")]
fn orphan_check_impl(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorReported> {
fn orphan_check_impl(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
let trait_ref = tcx.impl_trait_ref(def_id).unwrap();
let trait_def_id = trait_ref.def_id;
@ -136,7 +136,7 @@ fn orphan_check_impl(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorRep
if let Some((msg, label)) = msg {
struct_span_err!(tcx.sess, sp, E0321, "{}", msg).span_label(sp, label).emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
}
@ -145,7 +145,7 @@ fn orphan_check_impl(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorRep
.struct_span_err(sp, "cannot implement trait on type alias impl trait")
.span_note(tcx.def_span(def_id), "type alias impl trait defined here")
.emit();
return Err(ErrorReported);
return Err(ErrorGuaranteed);
}
Ok(())
@ -158,7 +158,7 @@ fn emit_orphan_check_error<'tcx>(
self_ty_span: Span,
generics: &hir::Generics<'tcx>,
err: traits::OrphanCheckErr<'tcx>,
) -> Result<!, ErrorReported> {
) -> Result<!, ErrorGuaranteed> {
Err(match err {
traits::OrphanCheckErr::NonLocalInputType(tys) => {
let mut err = struct_span_err!(

View file

@ -26,7 +26,7 @@ use rustc_ast::{MetaItemKind, NestedMetaItem};
use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr};
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
@ -319,7 +319,7 @@ fn bad_placeholder<'tcx>(
tcx: TyCtxt<'tcx>,
mut spans: Vec<Span>,
kind: &'static str,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let kind = if kind.ends_with('s') { format!("{}es", kind) } else { format!("{}s", kind) };
spans.sort();

View file

@ -1,4 +1,4 @@
use rustc_errors::{Applicability, ErrorReported, StashKey};
use rustc_errors::{Applicability, ErrorGuaranteed, StashKey};
use rustc_hir as hir;
use rustc_hir::def::Res;
use rustc_hir::def_id::{DefId, LocalDefId};
@ -366,7 +366,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
owner, def_id,
),
);
if let Some(ErrorReported) =
if let Some(ErrorGuaranteed) =
tcx.typeck(owner).tainted_by_errors
{
// Some error in the

View file

@ -97,7 +97,7 @@ mod outlives;
mod structured_errors;
mod variance;
use rustc_errors::{struct_span_err, ErrorReported};
use rustc_errors::{struct_span_err, ErrorGuaranteed};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{Node, CRATE_HIR_ID};
@ -491,7 +491,7 @@ pub fn provide(providers: &mut Providers) {
hir_wf_check::provide(providers);
}
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
let _prof_timer = tcx.sess.timer("type_check_crate");
// this ensures that later parts of type checking can assume that items
@ -537,7 +537,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
check_unused::check_crate(tcx);
check_for_entry_fn(tcx);
if tcx.sess.err_count() == 0 { Ok(()) } else { Err(ErrorReported) }
if tcx.sess.err_count() == 0 { Ok(()) } else { Err(ErrorGuaranteed) }
}
/// A quasi-deprecated helper used in rustdoc and clippy to get

View file

@ -6,7 +6,7 @@ pub use self::{
missing_cast_for_variadic_arg::*, sized_unsized_cast::*, wrong_number_of_generic_args::*,
};
use rustc_errors::{DiagnosticBuilder, DiagnosticId, ErrorReported};
use rustc_errors::{DiagnosticBuilder, DiagnosticId, ErrorGuaranteed};
use rustc_session::Session;
pub trait StructuredDiagnostic<'tcx> {
@ -14,7 +14,7 @@ pub trait StructuredDiagnostic<'tcx> {
fn code(&self) -> DiagnosticId;
fn diagnostic(&self) -> DiagnosticBuilder<'tcx, ErrorReported> {
fn diagnostic(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let err = self.diagnostic_common();
if self.session().teach(&self.code()) {
@ -24,19 +24,19 @@ pub trait StructuredDiagnostic<'tcx> {
}
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorReported>;
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed>;
fn diagnostic_regular(
&self,
err: DiagnosticBuilder<'tcx, ErrorReported>,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
err: DiagnosticBuilder<'tcx, ErrorGuaranteed>,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
err
}
fn diagnostic_extended(
&self,
err: DiagnosticBuilder<'tcx, ErrorReported>,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
err: DiagnosticBuilder<'tcx, ErrorGuaranteed>,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
err
}
}

View file

@ -1,5 +1,5 @@
use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId, ErrorReported};
use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId, ErrorGuaranteed};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
@ -20,7 +20,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx> {
rustc_errors::error_code!(E0617)
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorReported> {
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let mut err = self.sess.struct_span_fatal_with_code(
self.span,
&format!("can't pass `{}` to variadic function", self.ty),
@ -47,8 +47,8 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx> {
fn diagnostic_extended(
&self,
mut err: DiagnosticBuilder<'tcx, ErrorReported>,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
mut err: DiagnosticBuilder<'tcx, ErrorGuaranteed>,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
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 \

View file

@ -1,5 +1,5 @@
use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{DiagnosticBuilder, DiagnosticId, ErrorReported};
use rustc_errors::{DiagnosticBuilder, DiagnosticId, ErrorGuaranteed};
use rustc_middle::ty::{Ty, TypeFoldable};
use rustc_session::Session;
use rustc_span::Span;
@ -20,7 +20,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
rustc_errors::error_code!(E0607)
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorReported> {
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let mut err = self.sess.struct_span_fatal_with_code(
self.span,
&format!(
@ -39,8 +39,8 @@ impl<'tcx> StructuredDiagnostic<'tcx> for SizedUnsizedCast<'tcx> {
fn diagnostic_extended(
&self,
mut err: DiagnosticBuilder<'tcx, ErrorReported>,
) -> DiagnosticBuilder<'tcx, ErrorReported> {
mut err: DiagnosticBuilder<'tcx, ErrorGuaranteed>,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
err.help(
"Thin pointers are \"simple\" pointers: they are purely a reference to a
memory address.

View file

@ -1,6 +1,6 @@
use crate::structured_errors::StructuredDiagnostic;
use rustc_errors::{
pluralize, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorReported,
pluralize, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticId, ErrorGuaranteed,
};
use rustc_hir as hir;
use rustc_middle::hir::map::fn_sig;
@ -374,7 +374,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
}
}
fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx, ErrorReported> {
fn start_diagnostics(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let span = self.path_segment.ident.span;
let msg = self.create_error_message();
@ -810,7 +810,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for WrongNumberOfGenericArgs<'_, 'tcx> {
rustc_errors::error_code!(E0107)
}
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorReported> {
fn diagnostic_common(&self) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
let mut err = self.start_diagnostics();
self.notify(&mut err);