1
Fork 0

Rollup merge of #119895 - oli-obk:track_errors_3, r=matthewjasper

Remove `track_errors` entirely

follow up to https://github.com/rust-lang/rust/pull/119869

r? `@matthewjasper`

There are some diagnostic changes adding new diagnostics or not emitting some anymore. We can improve upon that in follow-up work imo.
This commit is contained in:
Matthias Krüger 2024-01-25 08:39:42 +01:00 committed by GitHub
commit 0c45e3c7dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 498 additions and 201 deletions

View file

@ -1113,7 +1113,13 @@ fn find_vtable_types_for_unsizing<'tcx>(
assert_eq!(source_adt_def, target_adt_def);
let CustomCoerceUnsized::Struct(coerce_index) =
crate::custom_coerce_unsize_info(tcx, source_ty, target_ty);
match crate::custom_coerce_unsize_info(tcx, source_ty, target_ty) {
Ok(ccu) => ccu,
Err(e) => {
let e = Ty::new_error(tcx.tcx, e);
return (e, e);
}
};
let source_fields = &source_adt_def.non_enum_variant().fields;
let target_fields = &target_adt_def.non_enum_variant().fields;

View file

@ -15,6 +15,7 @@ use rustc_middle::query::{Providers, TyCtxtAt};
use rustc_middle::traits;
use rustc_middle::ty::adjustment::CustomCoerceUnsized;
use rustc_middle::ty::{self, Ty};
use rustc_span::ErrorGuaranteed;
mod collector;
mod errors;
@ -28,7 +29,7 @@ fn custom_coerce_unsize_info<'tcx>(
tcx: TyCtxtAt<'tcx>,
source_ty: Ty<'tcx>,
target_ty: Ty<'tcx>,
) -> CustomCoerceUnsized {
) -> Result<CustomCoerceUnsized, ErrorGuaranteed> {
let trait_ref = ty::TraitRef::from_lang_item(
tcx.tcx,
LangItem::CoerceUnsized,
@ -40,7 +41,7 @@ fn custom_coerce_unsize_info<'tcx>(
Ok(traits::ImplSource::UserDefined(traits::ImplSourceUserDefinedData {
impl_def_id,
..
})) => tcx.coerce_unsized_info(impl_def_id).custom_kind.unwrap(),
})) => Ok(tcx.coerce_unsized_info(impl_def_id)?.custom_kind.unwrap()),
impl_source => {
bug!("invalid `CoerceUnsized` impl_source: {:?}", impl_source);
}