mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_misc
This commit is contained in:
parent
1e7ef03b40
commit
298ae8c721
@ -156,7 +156,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
infcx.tcx,
|
||||
)
|
||||
});
|
||||
prev.ty = infcx.tcx.ty_error_with_guaranteed(guar);
|
||||
prev.ty = infcx.tcx.ty_error(guar);
|
||||
}
|
||||
// Pick a better span if there is one.
|
||||
// FIXME(oli-obk): collect multiple spans for better diagnostics down the road.
|
||||
@ -248,7 +248,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
origin: OpaqueTyOrigin,
|
||||
) -> Ty<'tcx> {
|
||||
if let Some(e) = self.tainted_by_errors() {
|
||||
return self.tcx.ty_error_with_guaranteed(e);
|
||||
return self.tcx.ty_error(e);
|
||||
}
|
||||
|
||||
let definition_ty = instantiated_ty
|
||||
@ -261,7 +261,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
origin,
|
||||
instantiated_ty.span,
|
||||
) {
|
||||
return self.tcx.ty_error_with_guaranteed(guar);
|
||||
return self.tcx.ty_error(guar);
|
||||
}
|
||||
|
||||
// Only check this for TAIT. RPIT already supports `tests/ui/impl-trait/nested-return-type2.rs`
|
||||
@ -326,7 +326,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
definition_ty
|
||||
} else {
|
||||
let reported = infcx.err_ctxt().report_fulfillment_errors(&errors, None);
|
||||
self.tcx.ty_error_with_guaranteed(reported)
|
||||
self.tcx.ty_error(reported)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
||||
.sess
|
||||
.delay_span_bug(span, &format!("failed to normalize {:?}", ty));
|
||||
TypeOpOutput {
|
||||
output: self.infcx.tcx.ty_error_with_guaranteed(guar),
|
||||
output: self.infcx.tcx.ty_error(guar),
|
||||
constraints: None,
|
||||
error_info: None,
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
|
||||
decl.hidden_type.span,
|
||||
&format!("could not resolve {:#?}", hidden_type.ty.kind()),
|
||||
);
|
||||
hidden_type.ty = infcx.tcx.ty_error_with_guaranteed(reported);
|
||||
hidden_type.ty = infcx.tcx.ty_error(reported);
|
||||
}
|
||||
|
||||
(opaque_type_key, (hidden_type, decl.origin))
|
||||
@ -531,7 +531,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
if place_ty.variant_index.is_none() {
|
||||
if let Err(guar) = place_ty.ty.error_reported() {
|
||||
assert!(self.errors_reported);
|
||||
return PlaceTy::from_ty(self.tcx().ty_error_with_guaranteed(guar));
|
||||
return PlaceTy::from_ty(self.tcx().ty_error(guar));
|
||||
}
|
||||
}
|
||||
place_ty = self.sanitize_projection(place_ty, elem, place, location, context);
|
||||
@ -763,7 +763,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
|
||||
fn error(&mut self) -> Ty<'tcx> {
|
||||
self.errors_reported = true;
|
||||
self.tcx().ty_error()
|
||||
self.tcx().ty_error_misc()
|
||||
}
|
||||
|
||||
fn get_ambient_variance(&self, context: PlaceContext) -> ty::Variance {
|
||||
|
@ -429,7 +429,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
if let (hir::TyKind::Infer, false) = (&ty.kind, self.astconv.allow_ty_infer()) {
|
||||
self.inferred_params.push(ty.span);
|
||||
tcx.ty_error().into()
|
||||
tcx.ty_error_misc().into()
|
||||
} else {
|
||||
self.astconv.ast_ty_to_ty(ty).into()
|
||||
}
|
||||
@ -502,14 +502,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
_ => false,
|
||||
}) {
|
||||
// Avoid ICE #86756 when type error recovery goes awry.
|
||||
return tcx.ty_error().into();
|
||||
return tcx.ty_error_misc().into();
|
||||
}
|
||||
tcx.at(self.span).type_of(param.def_id).subst(tcx, substs).into()
|
||||
} else if infer_args {
|
||||
self.astconv.ty_infer(Some(param), self.span).into()
|
||||
} else {
|
||||
// We've already errored above about the mismatch.
|
||||
tcx.ty_error().into()
|
||||
tcx.ty_error_misc().into()
|
||||
}
|
||||
}
|
||||
GenericParamDefKind::Const { has_default } => {
|
||||
@ -1239,9 +1239,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
}
|
||||
let reported = err.emit();
|
||||
term = match def_kind {
|
||||
hir::def::DefKind::AssocTy => {
|
||||
tcx.ty_error_with_guaranteed(reported).into()
|
||||
}
|
||||
hir::def::DefKind::AssocTy => tcx.ty_error(reported).into(),
|
||||
hir::def::DefKind::AssocConst => tcx
|
||||
.const_error_with_guaranteed(
|
||||
tcx.type_of(assoc_item_def_id)
|
||||
@ -1397,7 +1395,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
.map(|trait_ref| tcx.def_span(trait_ref));
|
||||
let reported =
|
||||
tcx.sess.emit_err(TraitObjectDeclaredWithNoTraits { span, trait_alias_span });
|
||||
return tcx.ty_error_with_guaranteed(reported);
|
||||
return tcx.ty_error(reported);
|
||||
}
|
||||
|
||||
// Check that there are no gross object safety violations;
|
||||
@ -1414,7 +1412,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&object_safety_violations,
|
||||
)
|
||||
.emit();
|
||||
return tcx.ty_error_with_guaranteed(reported);
|
||||
return tcx.ty_error(reported);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1523,10 +1521,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
if arg == dummy_self.into() {
|
||||
let param = &generics.params[index];
|
||||
missing_type_params.push(param.name);
|
||||
return tcx.ty_error().into();
|
||||
return tcx.ty_error_misc().into();
|
||||
} else if arg.walk().any(|arg| arg == dummy_self.into()) {
|
||||
references_self = true;
|
||||
return tcx.ty_error().into();
|
||||
return tcx.ty_error_misc().into();
|
||||
}
|
||||
arg
|
||||
})
|
||||
@ -1588,7 +1586,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
.iter()
|
||||
.map(|arg| {
|
||||
if arg.walk().any(|arg| arg == dummy_self.into()) {
|
||||
return tcx.ty_error_with_guaranteed(guar).into();
|
||||
return tcx.ty_error(guar).into();
|
||||
}
|
||||
arg
|
||||
})
|
||||
@ -2474,7 +2472,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&[path_str],
|
||||
item_segment.ident.name,
|
||||
);
|
||||
return tcx.ty_error_with_guaranteed(reported)
|
||||
return tcx.ty_error(reported)
|
||||
};
|
||||
|
||||
debug!("qpath_to_ty: self_type={:?}", self_ty);
|
||||
@ -2821,7 +2819,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let index = generics.param_def_id_to_index[&def_id.to_def_id()];
|
||||
tcx.mk_ty_param(index, tcx.hir().ty_param_name(def_id))
|
||||
}
|
||||
Some(rbv::ResolvedArg::Error(guar)) => tcx.ty_error_with_guaranteed(guar),
|
||||
Some(rbv::ResolvedArg::Error(guar)) => tcx.ty_error(guar),
|
||||
arg => bug!("unexpected bound var resolution for {hir_id:?}: {arg:?}"),
|
||||
}
|
||||
}
|
||||
@ -2933,7 +2931,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
{
|
||||
err.span_note(impl_.self_ty.span, "not a concrete type");
|
||||
}
|
||||
tcx.ty_error_with_guaranteed(err.emit())
|
||||
tcx.ty_error(err.emit())
|
||||
} else {
|
||||
ty
|
||||
}
|
||||
@ -2986,7 +2984,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
.sess
|
||||
.delay_span_bug(path.span, "path with `Res::Err` but no error emitted");
|
||||
self.set_tainted_by_errors(e);
|
||||
self.tcx().ty_error_with_guaranteed(e)
|
||||
self.tcx().ty_error(e)
|
||||
}
|
||||
_ => span_bug!(span, "unexpected resolution: {:?}", path.res),
|
||||
}
|
||||
@ -3065,7 +3063,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let ty = self.ast_ty_to_ty_inner(qself, false, true);
|
||||
self.associated_path_to_ty(ast_ty.hir_id, ast_ty.span, ty, qself, segment, false)
|
||||
.map(|(ty, _, _)| ty)
|
||||
.unwrap_or_else(|guar| tcx.ty_error_with_guaranteed(guar))
|
||||
.unwrap_or_else(|guar| tcx.ty_error(guar))
|
||||
}
|
||||
&hir::TyKind::Path(hir::QPath::LangItem(lang_item, span, _)) => {
|
||||
let def_id = tcx.require_lang_item(lang_item, Some(span));
|
||||
@ -3113,7 +3111,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
// handled specially and will not descend into this routine.
|
||||
self.ty_infer(None, ast_ty.span)
|
||||
}
|
||||
hir::TyKind::Err => tcx.ty_error(),
|
||||
hir::TyKind::Err => tcx.ty_error_misc(),
|
||||
};
|
||||
|
||||
self.record_ty(ast_ty.hir_id, result_ty, ast_ty.span);
|
||||
|
@ -790,7 +790,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
||||
return_span,
|
||||
format!("could not fully resolve: {ty} => {err:?}"),
|
||||
);
|
||||
collected_tys.insert(def_id, tcx.ty_error_with_guaranteed(reported));
|
||||
collected_tys.insert(def_id, tcx.ty_error(reported));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ impl<'tcx> AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
self.tcx().ty_error_with_guaranteed(err.emit())
|
||||
self.tcx().ty_error(err.emit())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::EarlyBinder<Ty<'_>>
|
||||
match self_ty.find_self_aliases() {
|
||||
spans if spans.len() > 0 => {
|
||||
let guar = tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: spans.into(), note: () });
|
||||
tcx.ty_error_with_guaranteed(guar)
|
||||
tcx.ty_error(guar)
|
||||
},
|
||||
_ => icx.to_ty(*self_ty),
|
||||
}
|
||||
@ -600,10 +600,8 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
|
||||
// ```
|
||||
let tables = self.tcx.typeck(item_def_id);
|
||||
if let Some(guar) = tables.tainted_by_errors {
|
||||
self.found = Some(ty::OpaqueHiddenType {
|
||||
span: DUMMY_SP,
|
||||
ty: self.tcx.ty_error_with_guaranteed(guar),
|
||||
});
|
||||
self.found =
|
||||
Some(ty::OpaqueHiddenType { span: DUMMY_SP, ty: self.tcx.ty_error(guar) });
|
||||
return;
|
||||
}
|
||||
let Some(&typeck_hidden_ty) = tables.concrete_opaque_types.get(&self.def_id) else {
|
||||
@ -622,7 +620,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
|
||||
if let Some(prev) = &mut self.found {
|
||||
if concrete_type.ty != prev.ty && !(concrete_type, prev.ty).references_error() {
|
||||
let guar = prev.report_mismatch(&concrete_type, self.tcx);
|
||||
prev.ty = self.tcx.ty_error_with_guaranteed(guar);
|
||||
prev.ty = self.tcx.ty_error(guar);
|
||||
}
|
||||
} else {
|
||||
self.found = Some(concrete_type);
|
||||
@ -709,7 +707,7 @@ fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: LocalDefId) -> T
|
||||
_ => "item",
|
||||
},
|
||||
});
|
||||
return tcx.ty_error_with_guaranteed(reported);
|
||||
return tcx.ty_error(reported);
|
||||
};
|
||||
|
||||
// Only check against typeck if we didn't already error
|
||||
@ -821,7 +819,7 @@ fn find_opaque_ty_constraints_for_rpit(
|
||||
// Some error in the
|
||||
// owner fn prevented us from populating
|
||||
// the `concrete_opaque_types` table.
|
||||
tcx.ty_error_with_guaranteed(guar)
|
||||
tcx.ty_error(guar)
|
||||
} else {
|
||||
table.concrete_opaque_types.get(&def_id).map(|ty| ty.ty).unwrap_or_else(|| {
|
||||
// We failed to resolve the opaque type or it
|
||||
|
@ -438,7 +438,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
let err = self.report_invalid_callee(call_expr, callee_expr, callee_ty, arg_exprs);
|
||||
|
||||
return self.tcx.ty_error_with_guaranteed(err);
|
||||
return self.tcx.ty_error(err);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -800,7 +800,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
guar: ErrorGuaranteed,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let astconv: &dyn AstConv<'_> = self;
|
||||
let err_ty = self.tcx.ty_error_with_guaranteed(guar);
|
||||
let err_ty = self.tcx.ty_error(guar);
|
||||
|
||||
let supplied_arguments = decl.inputs.iter().map(|a| {
|
||||
// Convert the types that the user supplied (if any), but ignore them.
|
||||
|
@ -177,7 +177,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
let _ = self.commit_if_ok(|_| {
|
||||
self.at(&self.cause, self.param_env).define_opaque_types(true).eq(a, b)
|
||||
});
|
||||
return success(vec![], self.fcx.tcx.ty_error_with_guaranteed(guar), vec![]);
|
||||
return success(vec![], self.fcx.tcx.ty_error(guar), vec![]);
|
||||
}
|
||||
|
||||
// Coercing from `!` to any type is allowed:
|
||||
@ -997,11 +997,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
let (adjustments, _) = self.register_infer_ok_obligations(ok);
|
||||
self.apply_adjustments(expr, adjustments);
|
||||
Ok(if let Err(guar) = expr_ty.error_reported() {
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
} else {
|
||||
target
|
||||
})
|
||||
Ok(if let Err(guar) = expr_ty.error_reported() { self.tcx.ty_error(guar) } else { target })
|
||||
}
|
||||
|
||||
/// Same as `try_coerce()`, but without side-effects.
|
||||
@ -1439,7 +1435,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
|
||||
// If we see any error types, just propagate that error
|
||||
// upwards.
|
||||
if let Err(guar) = (expression_ty, self.merged_ty()).error_reported() {
|
||||
self.final_ty = Some(fcx.tcx.ty_error_with_guaranteed(guar));
|
||||
self.final_ty = Some(fcx.tcx.ty_error(guar));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1624,7 +1620,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
|
||||
|
||||
let reported = err.emit_unless(unsized_return);
|
||||
|
||||
self.final_ty = Some(fcx.tcx.ty_error_with_guaranteed(reported));
|
||||
self.final_ty = Some(fcx.tcx.ty_error(reported));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
return if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] {
|
||||
target.to_owned()
|
||||
} else {
|
||||
self.tcx().ty_error_with_guaranteed(reported)
|
||||
self.tcx().ty_error(reported)
|
||||
};
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
tcx.types.never
|
||||
} else {
|
||||
// There was an error; make type-check fail.
|
||||
tcx.ty_error()
|
||||
tcx.ty_error_misc()
|
||||
}
|
||||
}
|
||||
ExprKind::Ret(ref expr_opt) => self.check_expr_return(expr_opt.as_deref(), expr),
|
||||
@ -354,7 +354,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ExprKind::Field(base, field) => self.check_field(expr, &base, field, expected),
|
||||
ExprKind::Index(base, idx) => self.check_expr_index(base, idx, expr),
|
||||
ExprKind::Yield(value, ref src) => self.check_expr_yield(value, expr, src),
|
||||
hir::ExprKind::Err => tcx.ty_error(),
|
||||
hir::ExprKind::Err => tcx.ty_error_misc(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
{
|
||||
err.subdiagnostic(ExprParenthesesNeeded::surrounding(*sp));
|
||||
}
|
||||
oprnd_t = tcx.ty_error_with_guaranteed(err.emit());
|
||||
oprnd_t = tcx.ty_error(err.emit());
|
||||
}
|
||||
}
|
||||
hir::UnOp::Not => {
|
||||
@ -452,7 +452,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
let tm = ty::TypeAndMut { ty, mutbl };
|
||||
match kind {
|
||||
_ if tm.ty.references_error() => self.tcx.ty_error(),
|
||||
_ if tm.ty.references_error() => self.tcx.ty_error_misc(),
|
||||
hir::BorrowKind::Raw => {
|
||||
self.check_named_place_expr(oprnd);
|
||||
self.tcx.mk_ptr(tm)
|
||||
@ -531,11 +531,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let e =
|
||||
self.tcx.sess.delay_span_bug(qpath.span(), "`Res::Err` but no error emitted");
|
||||
self.set_tainted_by_errors(e);
|
||||
tcx.ty_error_with_guaranteed(e)
|
||||
tcx.ty_error(e)
|
||||
}
|
||||
Res::Def(DefKind::Variant, _) => {
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, expr.span, "E0533", "value");
|
||||
tcx.ty_error_with_guaranteed(e)
|
||||
tcx.ty_error(e)
|
||||
}
|
||||
_ => self.instantiate_value_path(segs, opt_ty, res, expr.span, expr.hir_id).0,
|
||||
};
|
||||
@ -634,7 +634,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// If the loop context is not a `loop { }`, then break with
|
||||
// a value is illegal, and `opt_coerce_to` will be `None`.
|
||||
// Just set expectation to error in that case.
|
||||
let coerce_to = opt_coerce_to.unwrap_or_else(|| tcx.ty_error());
|
||||
let coerce_to = opt_coerce_to.unwrap_or_else(|| tcx.ty_error_misc());
|
||||
|
||||
// Recurse without `enclosing_breakables` borrowed.
|
||||
e_ty = self.check_expr_with_hint(e, coerce_to);
|
||||
@ -1033,11 +1033,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
let result_ty = coerce.complete(self);
|
||||
if let Err(guar) = cond_ty.error_reported() {
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
} else {
|
||||
result_ty
|
||||
}
|
||||
if let Err(guar) = cond_ty.error_reported() { self.tcx.ty_error(guar) } else { result_ty }
|
||||
}
|
||||
|
||||
/// Type check assignment expression `expr` of form `lhs = rhs`.
|
||||
@ -1113,7 +1109,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// If the assignment expression itself is ill-formed, don't
|
||||
// bother emitting another error
|
||||
let reported = err.emit_unless(lhs_ty.references_error() || rhs_ty.references_error());
|
||||
return self.tcx.ty_error_with_guaranteed(reported);
|
||||
return self.tcx.ty_error(reported);
|
||||
}
|
||||
|
||||
let lhs_ty = self.check_expr_with_needs(&lhs, Needs::MutPlace);
|
||||
@ -1160,7 +1156,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self.require_type_is_sized(lhs_ty, lhs.span, traits::AssignmentLhsSized);
|
||||
|
||||
if let Err(guar) = (lhs_ty, rhs_ty).error_reported() {
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
self.tcx.ty_error(guar)
|
||||
} else {
|
||||
self.tcx.mk_unit()
|
||||
}
|
||||
@ -1279,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
// Eagerly check for some obvious errors.
|
||||
if let Err(guar) = (t_expr, t_cast).error_reported() {
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
self.tcx.ty_error(guar)
|
||||
} else {
|
||||
// Defer other checks until we're done type checking.
|
||||
let mut deferred_cast_checks = self.deferred_cast_checks.borrow_mut();
|
||||
@ -1300,7 +1296,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
deferred_cast_checks.push(cast_check);
|
||||
t_cast
|
||||
}
|
||||
Err(guar) => self.tcx.ty_error_with_guaranteed(guar),
|
||||
Err(guar) => self.tcx.ty_error(guar),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1428,7 +1424,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
|
||||
if let Err(guar) = element_ty.error_reported() {
|
||||
return tcx.ty_error_with_guaranteed(guar);
|
||||
return tcx.ty_error(guar);
|
||||
}
|
||||
|
||||
self.check_repeat_element_needs_copy_bound(element, count, element_ty);
|
||||
@ -1498,7 +1494,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
});
|
||||
let tuple = self.tcx.mk_tup(elt_ts_iter);
|
||||
if let Err(guar) = tuple.error_reported() {
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
self.tcx.ty_error(guar)
|
||||
} else {
|
||||
self.require_type_is_sized(tuple, expr.span, traits::TupleInitializerSized);
|
||||
tuple
|
||||
@ -1518,7 +1514,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Ok(data) => data,
|
||||
Err(guar) => {
|
||||
self.check_struct_fields_on_error(fields, base_expr);
|
||||
return self.tcx.ty_error_with_guaranteed(guar);
|
||||
return self.tcx.ty_error(guar);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1618,7 +1614,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
)
|
||||
};
|
||||
|
||||
tcx.ty_error_with_guaranteed(guar)
|
||||
tcx.ty_error(guar)
|
||||
};
|
||||
|
||||
// Make sure to give a type to the field even if there's
|
||||
@ -2270,7 +2266,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
did,
|
||||
expected.only_has_type(self),
|
||||
);
|
||||
return self.tcx().ty_error_with_guaranteed(guar);
|
||||
return self.tcx().ty_error(guar);
|
||||
}
|
||||
|
||||
let guar = if field.name == kw::Empty {
|
||||
@ -2356,7 +2352,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
err.emit()
|
||||
};
|
||||
|
||||
self.tcx().ty_error_with_guaranteed(guar)
|
||||
self.tcx().ty_error(guar)
|
||||
}
|
||||
|
||||
fn suggest_await_on_field_access(
|
||||
@ -2848,7 +2844,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
let reported = err.emit();
|
||||
self.tcx.ty_error_with_guaranteed(reported)
|
||||
self.tcx.ty_error(reported)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
|
||||
// type, `?T` is not considered unsolved, but `?I` is. The
|
||||
// same is true for float variables.)
|
||||
let fallback = match ty.kind() {
|
||||
_ if let Some(e) = self.tainted_by_errors() => self.tcx.ty_error_with_guaranteed(e),
|
||||
_ if let Some(e) = self.tainted_by_errors() => self.tcx.ty_error(e),
|
||||
ty::Infer(ty::IntVar(_)) => self.tcx.types.i32,
|
||||
ty::Infer(ty::FloatVar(_)) => self.tcx.types.f64,
|
||||
_ => match diverging_fallback.get(&ty) {
|
||||
|
@ -451,7 +451,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub fn node_ty(&self, id: hir::HirId) -> Ty<'tcx> {
|
||||
match self.typeck_results.borrow().node_types().get(id) {
|
||||
Some(&t) => t,
|
||||
None if let Some(e) = self.tainted_by_errors() => self.tcx.ty_error_with_guaranteed(e),
|
||||
None if let Some(e) = self.tainted_by_errors() => self.tcx.ty_error(e),
|
||||
None => {
|
||||
bug!(
|
||||
"no type for node {} in fcx {}",
|
||||
@ -465,7 +465,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub fn node_ty_opt(&self, id: hir::HirId) -> Option<Ty<'tcx>> {
|
||||
match self.typeck_results.borrow().node_types().get(id) {
|
||||
Some(&t) => Some(t),
|
||||
None if let Some(e) = self.tainted_by_errors() => Some(self.tcx.ty_error_with_guaranteed(e)),
|
||||
None if let Some(e) = self.tainted_by_errors() => Some(self.tcx.ty_error(e)),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
@ -701,7 +701,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub(in super::super) fn err_args(&self, len: usize) -> Vec<Ty<'tcx>> {
|
||||
let ty_error = self.tcx.ty_error();
|
||||
let ty_error = self.tcx.ty_error_misc();
|
||||
vec![ty_error; len]
|
||||
}
|
||||
|
||||
@ -1162,7 +1162,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
let reported = err.emit();
|
||||
return (tcx.ty_error_with_guaranteed(reported), res);
|
||||
return (tcx.ty_error(reported), res);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1418,7 +1418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.emit_inference_failure_err((**self).body_id, sp, ty.into(), E0282, true)
|
||||
.emit()
|
||||
});
|
||||
let err = self.tcx.ty_error_with_guaranteed(e);
|
||||
let err = self.tcx.ty_error(e);
|
||||
self.demand_suptype(sp, err, ty);
|
||||
err
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let ty = self.typeck_results.borrow().expr_ty_adjusted(expr);
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
if ty.has_non_region_infer() {
|
||||
self.tcx.ty_error()
|
||||
self.tcx.ty_error_misc()
|
||||
} else {
|
||||
self.tcx.erase_regions(ty)
|
||||
}
|
||||
@ -115,7 +115,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
tuple_arguments,
|
||||
method.ok().map(|method| method.def_id),
|
||||
);
|
||||
return self.tcx.ty_error();
|
||||
return self.tcx.ty_error_misc();
|
||||
}
|
||||
|
||||
let method = method.unwrap();
|
||||
@ -535,7 +535,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.typeck_results
|
||||
.borrow()
|
||||
.expr_ty_adjusted_opt(*expr)
|
||||
.unwrap_or_else(|| tcx.ty_error());
|
||||
.unwrap_or_else(|| tcx.ty_error_misc());
|
||||
(self.resolve_vars_if_possible(ty), normalize_span(expr.span))
|
||||
})
|
||||
.collect();
|
||||
@ -1288,7 +1288,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
opt_ty.unwrap_or_else(|| self.next_float_var())
|
||||
}
|
||||
ast::LitKind::Bool(_) => tcx.types.bool,
|
||||
ast::LitKind::Err => tcx.ty_error(),
|
||||
ast::LitKind::Err => tcx.ty_error_misc(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -1717,7 +1717,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
) {
|
||||
if let Err(guar) = ty.error_reported() {
|
||||
// Override the types everywhere with `err()` to avoid knock on errors.
|
||||
let err = self.tcx.ty_error_with_guaranteed(guar);
|
||||
let err = self.tcx.ty_error(guar);
|
||||
self.write_ty(hir_id, err);
|
||||
self.write_ty(pat.hir_id, err);
|
||||
let local_ty = LocalTy { decl_ty: err, revealed_ty: err };
|
||||
@ -1746,9 +1746,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let result = self
|
||||
.astconv()
|
||||
.associated_path_to_ty(hir_id, path_span, ty.raw, qself, segment, true);
|
||||
let ty = result
|
||||
.map(|(ty, _, _)| ty)
|
||||
.unwrap_or_else(|guar| self.tcx().ty_error_with_guaranteed(guar));
|
||||
let ty =
|
||||
result.map(|(ty, _, _)| ty).unwrap_or_else(|guar| self.tcx().ty_error(guar));
|
||||
let ty = self.handle_raw_ty(path_span, ty);
|
||||
let result = result.map(|(_, kind, def_id)| (kind, def_id));
|
||||
|
||||
|
@ -297,7 +297,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
method.sig.output()
|
||||
}
|
||||
// error types are considered "builtin"
|
||||
Err(_) if lhs_ty.references_error() || rhs_ty.references_error() => self.tcx.ty_error(),
|
||||
Err(_) if lhs_ty.references_error() || rhs_ty.references_error() => {
|
||||
self.tcx.ty_error_misc()
|
||||
}
|
||||
Err(errors) => {
|
||||
let (_, trait_def_id) =
|
||||
lang_item_for_op(self.tcx, Op::Binary(op, is_assign), op.span);
|
||||
@ -518,7 +520,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
let reported = err.emit();
|
||||
self.tcx.ty_error_with_guaranteed(reported)
|
||||
self.tcx.ty_error(reported)
|
||||
}
|
||||
};
|
||||
|
||||
@ -703,7 +705,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
err.emit()
|
||||
});
|
||||
self.tcx.ty_error_with_guaranteed(guar)
|
||||
self.tcx.ty_error(guar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// There exists a side that didn't meet our criteria that the end-point
|
||||
// be of a numeric or char type, as checked in `calc_side` above.
|
||||
let guar = self.emit_err_pat_range(span, lhs, rhs);
|
||||
return self.tcx.ty_error_with_guaranteed(guar);
|
||||
return self.tcx.ty_error(guar);
|
||||
}
|
||||
|
||||
// Unify each side with `expected`.
|
||||
@ -496,7 +496,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
demand_eqtype(&mut rhs, lhs);
|
||||
|
||||
if let (Some((true, ..)), _) | (_, Some((true, ..))) = (lhs, rhs) {
|
||||
return self.tcx.ty_error();
|
||||
return self.tcx.ty_error_misc();
|
||||
}
|
||||
|
||||
// Find the unified type and check if it's of numeric or char type again.
|
||||
@ -512,7 +512,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
*fail = true;
|
||||
}
|
||||
let guar = self.emit_err_pat_range(span, lhs, rhs);
|
||||
return self.tcx.ty_error_with_guaranteed(guar);
|
||||
return self.tcx.ty_error(guar);
|
||||
}
|
||||
ty
|
||||
}
|
||||
@ -850,7 +850,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let (variant, pat_ty) = match self.check_struct_path(qpath, pat.hir_id) {
|
||||
Ok(data) => data,
|
||||
Err(guar) => {
|
||||
let err = self.tcx.ty_error_with_guaranteed(guar);
|
||||
let err = self.tcx.ty_error(guar);
|
||||
for field in fields {
|
||||
let ti = ti;
|
||||
self.check_pat(field.pat, err, def_bm, ti);
|
||||
@ -866,7 +866,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
if self.check_struct_pat_fields(pat_ty, &pat, variant, fields, has_rest_pat, def_bm, ti) {
|
||||
pat_ty
|
||||
} else {
|
||||
self.tcx.ty_error()
|
||||
self.tcx.ty_error_misc()
|
||||
}
|
||||
}
|
||||
|
||||
@ -886,12 +886,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Res::Err => {
|
||||
let e = tcx.sess.delay_span_bug(qpath.span(), "`Res::Err` but no error emitted");
|
||||
self.set_tainted_by_errors(e);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
Res::Def(DefKind::AssocFn | DefKind::Ctor(_, CtorKind::Fn) | DefKind::Variant, _) => {
|
||||
let expected = "unit struct, unit variant or constant";
|
||||
let e = report_unexpected_variant_res(tcx, res, qpath, pat.span, "E0533", expected);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
Res::SelfCtor(..)
|
||||
| Res::Def(
|
||||
@ -1034,7 +1034,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let on_error = |e| {
|
||||
for pat in subpats {
|
||||
self.check_pat(pat, tcx.ty_error_with_guaranteed(e), def_bm, ti);
|
||||
self.check_pat(pat, tcx.ty_error(e), def_bm, ti);
|
||||
}
|
||||
};
|
||||
let report_unexpected_res = |res: Res| {
|
||||
@ -1051,7 +1051,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let e = tcx.sess.delay_span_bug(pat.span, "`Res::Err` but no error emitted");
|
||||
self.set_tainted_by_errors(e);
|
||||
on_error(e);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
|
||||
// Type-check the path.
|
||||
@ -1059,7 +1059,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self.instantiate_value_path(segments, opt_ty, res, pat.span, pat.hir_id);
|
||||
if !pat_ty.is_fn() {
|
||||
let e = report_unexpected_res(res);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
|
||||
let variant = match res {
|
||||
@ -1067,11 +1067,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let e = tcx.sess.delay_span_bug(pat.span, "`Res::Err` but no error emitted");
|
||||
self.set_tainted_by_errors(e);
|
||||
on_error(e);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
Res::Def(DefKind::AssocConst | DefKind::AssocFn, _) => {
|
||||
let e = report_unexpected_res(res);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) => tcx.expect_variant_res(res),
|
||||
_ => bug!("unexpected pattern resolution: {:?}", res),
|
||||
@ -1112,7 +1112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// Pattern has wrong number of fields.
|
||||
let e = self.e0023(pat.span, res, qpath, subpats, &variant.fields, expected, had_err);
|
||||
on_error(e);
|
||||
return tcx.ty_error_with_guaranteed(e);
|
||||
return tcx.ty_error(e);
|
||||
}
|
||||
pat_ty
|
||||
}
|
||||
@ -1308,9 +1308,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let reported = err.emit();
|
||||
// Walk subpatterns with an expected type of `err` in this case to silence
|
||||
// further errors being emitted when using the bindings. #50333
|
||||
let element_tys_iter = (0..max_len).map(|_| tcx.ty_error_with_guaranteed(reported));
|
||||
let element_tys_iter = (0..max_len).map(|_| tcx.ty_error(reported));
|
||||
for (_, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) {
|
||||
self.check_pat(elem, tcx.ty_error_with_guaranteed(reported), def_bm, ti);
|
||||
self.check_pat(elem, tcx.ty_error(reported), def_bm, ti);
|
||||
}
|
||||
tcx.mk_tup(element_tys_iter)
|
||||
} else {
|
||||
@ -1358,7 +1358,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Occupied(occupied) => {
|
||||
no_field_errors = false;
|
||||
let guar = self.error_field_already_bound(span, field.ident, *occupied.get());
|
||||
tcx.ty_error_with_guaranteed(guar)
|
||||
tcx.ty_error(guar)
|
||||
}
|
||||
Vacant(vacant) => {
|
||||
vacant.insert(span);
|
||||
@ -1372,7 +1372,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.unwrap_or_else(|| {
|
||||
inexistent_fields.push(field);
|
||||
no_field_errors = false;
|
||||
tcx.ty_error()
|
||||
tcx.ty_error_misc()
|
||||
})
|
||||
}
|
||||
};
|
||||
@ -1944,7 +1944,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
(box_ty, inner_ty)
|
||||
}
|
||||
Err(guar) => {
|
||||
let err = tcx.ty_error_with_guaranteed(guar);
|
||||
let err = tcx.ty_error(guar);
|
||||
(err, err)
|
||||
}
|
||||
};
|
||||
@ -1995,7 +1995,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
Err(guar) => {
|
||||
let err = tcx.ty_error_with_guaranteed(guar);
|
||||
let err = tcx.ty_error(guar);
|
||||
(err, err)
|
||||
}
|
||||
};
|
||||
@ -2049,7 +2049,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.error_reported()
|
||||
.err()
|
||||
.unwrap_or_else(|| self.error_expected_array_or_slice(span, expected, ti));
|
||||
let err = self.tcx.ty_error_with_guaranteed(guar);
|
||||
let err = self.tcx.ty_error(guar);
|
||||
(err, Some(err), err)
|
||||
}
|
||||
};
|
||||
@ -2116,7 +2116,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
|
||||
// If we get here, we must have emitted an error.
|
||||
(Some(self.tcx.ty_error_with_guaranteed(guar)), arr_ty)
|
||||
(Some(self.tcx.ty_error(guar)), arr_ty)
|
||||
}
|
||||
|
||||
fn error_scrutinee_inconsistent_length(
|
||||
|
@ -91,10 +91,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
);
|
||||
}
|
||||
let reported = err.emit();
|
||||
Some((
|
||||
self.tcx.ty_error_with_guaranteed(reported),
|
||||
self.tcx.ty_error_with_guaranteed(reported),
|
||||
))
|
||||
Some((self.tcx.ty_error(reported), self.tcx.ty_error(reported)))
|
||||
}
|
||||
|
||||
/// To type-check `base_expr[index_expr]`, we progressively autoderef
|
||||
|
@ -797,7 +797,7 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
|
||||
debug!("Resolver::fold_ty: input type `{:?}` not fully resolvable", t);
|
||||
let e = self.report_error(t);
|
||||
self.replaced_with_error = Some(e);
|
||||
self.interner().ty_error_with_guaranteed(e)
|
||||
self.interner().ty_error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
|
||||
|
||||
(&ty::Error(e), _) | (_, &ty::Error(e)) => {
|
||||
infcx.set_tainted_by_errors(e);
|
||||
Ok(self.tcx().ty_error_with_guaranteed(e))
|
||||
Ok(self.tcx().ty_error(e))
|
||||
}
|
||||
|
||||
(
|
||||
|
@ -89,9 +89,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
|
||||
Err(TypeError::Sorts(relate::expected_found(self, a, b)))
|
||||
}
|
||||
|
||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => {
|
||||
Ok(self.tcx().ty_error_with_guaranteed(guar))
|
||||
}
|
||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(self.tcx().ty_error(guar)),
|
||||
|
||||
_ => relate::super_relate_tys(self, a, b),
|
||||
}
|
||||
|
@ -718,13 +718,13 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
|
||||
/// Constructs a `TyKind::Error` type with current `ErrorGuaranteed`
|
||||
#[track_caller]
|
||||
pub fn ty_error_with_guaranteed(self, reported: ErrorGuaranteed) -> Ty<'tcx> {
|
||||
pub fn ty_error(self, reported: ErrorGuaranteed) -> Ty<'tcx> {
|
||||
self.mk_ty(Error(reported))
|
||||
}
|
||||
|
||||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn ty_error(self) -> Ty<'tcx> {
|
||||
pub fn ty_error_misc(self) -> Ty<'tcx> {
|
||||
self.ty_error_with_message(DUMMY_SP, "TyKind::Error constructed but no error reported")
|
||||
}
|
||||
|
||||
@ -2463,7 +2463,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
impl<'tcx> TyCtxtAt<'tcx> {
|
||||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn ty_error(self) -> Ty<'tcx> {
|
||||
pub fn ty_error_misc(self) -> Ty<'tcx> {
|
||||
self.tcx.ty_error_with_message(self.span, "TyKind::Error constructed but no error reported")
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl GenericParamDef {
|
||||
) -> ty::GenericArg<'tcx> {
|
||||
match &self.kind {
|
||||
ty::GenericParamDefKind::Lifetime => tcx.mk_re_error_misc().into(),
|
||||
ty::GenericParamDefKind::Type { .. } => tcx.ty_error().into(),
|
||||
ty::GenericParamDefKind::Type { .. } => tcx.ty_error_misc().into(),
|
||||
ty::GenericParamDefKind::Const { .. } => {
|
||||
tcx.const_error(tcx.type_of(self.def_id).subst(tcx, preceding_substs)).into()
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReverseMapper<'tcx> {
|
||||
.emit();
|
||||
}
|
||||
|
||||
self.interner().ty_error()
|
||||
self.interner().ty_error_misc()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
|
||||
bug!("bound types encountered in super_relate_tys")
|
||||
}
|
||||
|
||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error_with_guaranteed(guar)),
|
||||
(&ty::Error(guar), _) | (_, &ty::Error(guar)) => Ok(tcx.ty_error(guar)),
|
||||
|
||||
(&ty::Never, _)
|
||||
| (&ty::Char, _)
|
||||
|
@ -16,7 +16,7 @@ impl<'tcx> Value<TyCtxt<'tcx>, DepKind> for Ty<'_> {
|
||||
fn from_cycle_error(tcx: TyCtxt<'tcx>, _: &[QueryInfo<DepKind>]) -> Self {
|
||||
// SAFETY: This is never called when `Self` is not `Ty<'tcx>`.
|
||||
// FIXME: Represent the above fact in the trait system somehow.
|
||||
unsafe { std::mem::transmute::<Ty<'tcx>, Ty<'_>>(tcx.ty_error()) }
|
||||
unsafe { std::mem::transmute::<Ty<'tcx>, Ty<'_>>(tcx.ty_error_misc()) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ impl<'tcx> Value<TyCtxt<'tcx>, DepKind> for ty::SymbolName<'_> {
|
||||
|
||||
impl<'tcx> Value<TyCtxt<'tcx>, DepKind> for ty::Binder<'_, ty::FnSig<'_>> {
|
||||
fn from_cycle_error(tcx: TyCtxt<'tcx>, stack: &[QueryInfo<DepKind>]) -> Self {
|
||||
let err = tcx.ty_error();
|
||||
let err = tcx.ty_error_misc();
|
||||
|
||||
let arity = if let Some(frame) = stack.get(0)
|
||||
&& frame.query.dep_kind == DepKind::fn_sig
|
||||
|
@ -639,7 +639,7 @@ fn construct_error(
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def);
|
||||
let generator_kind = tcx.generator_kind(def);
|
||||
|
||||
let ty = tcx.ty_error_with_guaranteed(err);
|
||||
let ty = tcx.ty_error(err);
|
||||
let num_params = match body_owner_kind {
|
||||
hir::BodyOwnerKind::Fn => tcx.fn_sig(def).skip_binder().inputs().skip_binder().len(),
|
||||
hir::BodyOwnerKind::Closure => {
|
||||
|
@ -316,7 +316,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
||||
| ty::Never
|
||||
| ty::Foreign(..) => tcx.types.unit,
|
||||
|
||||
ty::Error(e) => tcx.ty_error_with_guaranteed(*e),
|
||||
ty::Error(e) => tcx.ty_error(*e),
|
||||
|
||||
ty::Str | ty::Slice(_) => tcx.types.usize,
|
||||
|
||||
|
@ -3531,7 +3531,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
if let hir::Expr { kind: hir::ExprKind::Block(..), .. } = expr {
|
||||
let expr = expr.peel_blocks();
|
||||
let ty = typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error());
|
||||
let ty = typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error_misc());
|
||||
let span = expr.span;
|
||||
if Some(span) != err.span.primary_span() {
|
||||
err.span_label(
|
||||
@ -3634,7 +3634,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
let mut assocs = vec![];
|
||||
let mut expr = expr;
|
||||
let mut prev_ty = self.resolve_vars_if_possible(
|
||||
typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error()),
|
||||
typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error_misc()),
|
||||
);
|
||||
while let hir::ExprKind::MethodCall(_path_segment, rcvr_expr, _args, span) = expr.kind {
|
||||
// Point at every method call in the chain with the resulting type.
|
||||
@ -3645,7 +3645,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
self.probe_assoc_types_at_expr(&type_diffs, span, prev_ty, expr.hir_id, param_env);
|
||||
assocs.push(assocs_in_this_method);
|
||||
prev_ty = self.resolve_vars_if_possible(
|
||||
typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error()),
|
||||
typeck_results.expr_ty_adjusted_opt(expr).unwrap_or(tcx.ty_error_misc()),
|
||||
);
|
||||
|
||||
if let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = expr.kind
|
||||
@ -3663,7 +3663,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
if let hir::Node::Param(param) = parent {
|
||||
// ...and it is a an fn argument.
|
||||
let prev_ty = self.resolve_vars_if_possible(
|
||||
typeck_results.node_type_opt(param.hir_id).unwrap_or(tcx.ty_error()),
|
||||
typeck_results.node_type_opt(param.hir_id).unwrap_or(tcx.ty_error_misc()),
|
||||
);
|
||||
let assocs_in_this_method = self.probe_assoc_types_at_expr(&type_diffs, param.ty_span, prev_ty, param.hir_id, param_env);
|
||||
if assocs_in_this_method.iter().any(|a| a.is_some()) {
|
||||
|
@ -1214,7 +1214,7 @@ struct Progress<'tcx> {
|
||||
|
||||
impl<'tcx> Progress<'tcx> {
|
||||
fn error(tcx: TyCtxt<'tcx>, guar: ErrorGuaranteed) -> Self {
|
||||
Progress { term: tcx.ty_error_with_guaranteed(guar).into(), obligations: vec![] }
|
||||
Progress { term: tcx.ty_error(guar).into(), obligations: vec![] }
|
||||
}
|
||||
|
||||
fn with_addl_obligations(mut self, mut obligations: Vec<PredicateObligation<'tcx>>) -> Self {
|
||||
@ -2111,7 +2111,7 @@ fn confirm_impl_candidate<'cx, 'tcx>(
|
||||
"confirm_impl_candidate: no associated type {:?} for {:?}",
|
||||
assoc_ty.item.name, obligation.predicate
|
||||
);
|
||||
return Progress { term: tcx.ty_error().into(), obligations: nested };
|
||||
return Progress { term: tcx.ty_error_misc().into(), obligations: nested };
|
||||
}
|
||||
// If we're trying to normalize `<Vec<u32> as X>::A<S>` using
|
||||
//`impl<T> X for Vec<T> { type A<Y> = Box<Y>; }`, then:
|
||||
@ -2200,7 +2200,7 @@ fn confirm_impl_trait_in_trait_candidate<'tcx>(
|
||||
Err(guar) => return Progress::error(tcx, guar),
|
||||
};
|
||||
if !leaf_def.item.defaultness(tcx).has_value() {
|
||||
return Progress { term: tcx.ty_error().into(), obligations };
|
||||
return Progress { term: tcx.ty_error_misc().into(), obligations };
|
||||
}
|
||||
|
||||
// Use the default `impl Trait` for the trait, e.g., for a default trait body
|
||||
@ -2271,10 +2271,7 @@ fn confirm_impl_trait_in_trait_candidate<'tcx>(
|
||||
obligation.recursion_depth + 1,
|
||||
tcx.bound_return_position_impl_trait_in_trait_tys(impl_fn_def_id)
|
||||
.map_bound(|tys| {
|
||||
tys.map_or_else(
|
||||
|guar| tcx.ty_error_with_guaranteed(guar),
|
||||
|tys| tys[&obligation.predicate.def_id],
|
||||
)
|
||||
tys.map_or_else(|guar| tcx.ty_error(guar), |tys| tys[&obligation.predicate.def_id])
|
||||
})
|
||||
.subst(tcx, impl_fn_substs),
|
||||
&mut obligations,
|
||||
|
@ -2451,7 +2451,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
),
|
||||
);
|
||||
let value = self.infcx.fresh_substs_for_item(obligation.cause.span, impl_def_id);
|
||||
let err = self.tcx().ty_error_with_guaranteed(guar);
|
||||
let err = self.tcx().ty_error(guar);
|
||||
let value = value.fold_with(&mut BottomUpFolder {
|
||||
tcx: self.tcx(),
|
||||
ty_op: |_| err,
|
||||
|
@ -455,7 +455,7 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
|
||||
interner.tcx.mk_alias_ty(assoc_ty.0, substitution.lower_into(interner)),
|
||||
),
|
||||
TyKind::Foreign(def_id) => ty::Foreign(def_id.0),
|
||||
TyKind::Error => return interner.tcx.ty_error(),
|
||||
TyKind::Error => return interner.tcx.ty_error_misc(),
|
||||
TyKind::Alias(alias_ty) => match alias_ty {
|
||||
chalk_ir::AliasTy::Projection(projection) => ty::Alias(
|
||||
ty::Projection,
|
||||
|
@ -98,7 +98,7 @@ fn impl_defaultness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::Defaultness {
|
||||
fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
if matches!(tcx.representability(def_id), ty::Representability::Infinite) {
|
||||
return tcx.intern_type_list(&[tcx.ty_error()]);
|
||||
return tcx.intern_type_list(&[tcx.ty_error_misc()]);
|
||||
}
|
||||
}
|
||||
let def = tcx.adt_def(def_id);
|
||||
|
Loading…
Reference in New Issue
Block a user