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

@ -1,6 +1,7 @@
use crate::mir;
use crate::query::CyclePlaceholder;
use crate::traits;
use crate::ty::adjustment::CoerceUnsizedInfo;
use crate::ty::{self, Ty};
use std::intrinsics::transmute_unchecked;
use std::mem::{size_of, MaybeUninit};
@ -105,6 +106,10 @@ impl EraseType for Result<Option<ty::Instance<'_>>, rustc_errors::ErrorGuarantee
[u8; size_of::<Result<Option<ty::Instance<'static>>, rustc_errors::ErrorGuaranteed>>()];
}
impl EraseType for Result<CoerceUnsizedInfo, rustc_errors::ErrorGuaranteed> {
type Result = [u8; size_of::<Result<CoerceUnsizedInfo, rustc_errors::ErrorGuaranteed>>()];
}
impl EraseType for Result<Option<ty::EarlyBinder<ty::Const<'_>>>, rustc_errors::ErrorGuaranteed> {
type Result = [u8; size_of::<
Result<Option<ty::EarlyBinder<ty::Const<'static>>>, rustc_errors::ErrorGuaranteed>,

View file

@ -977,10 +977,11 @@ rustc_queries! {
}
/// Caches `CoerceUnsized` kinds for impls on custom types.
query coerce_unsized_info(key: DefId) -> ty::adjustment::CoerceUnsizedInfo {
query coerce_unsized_info(key: DefId) -> Result<ty::adjustment::CoerceUnsizedInfo, ErrorGuaranteed> {
desc { |tcx| "computing CoerceUnsized info for `{}`", tcx.def_path_str(key) }
cache_on_disk_if { key.is_local() }
separate_provide_extern
ensure_forwards_result_if_red
}
query typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
@ -1000,8 +1001,9 @@ rustc_queries! {
desc { |tcx| "checking whether `{}` has a body", tcx.def_path_str(def_id) }
}
query coherent_trait(def_id: DefId) -> () {
query coherent_trait(def_id: DefId) -> Result<(), ErrorGuaranteed> {
desc { |tcx| "coherence checking all impls of trait `{}`", tcx.def_path_str(def_id) }
ensure_forwards_result_if_red
}
/// Borrow-checks the function body. If this is a closure, returns
@ -1032,6 +1034,7 @@ rustc_queries! {
"checking whether impl `{}` follows the orphan rules",
tcx.def_path_str(key),
}
ensure_forwards_result_if_red
}
/// Check whether the function has any recursion that could cause the inliner to trigger
@ -1300,6 +1303,7 @@ rustc_queries! {
query specialization_graph_of(trait_id: DefId) -> Result<&'tcx specialization_graph::Graph, ErrorGuaranteed> {
desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(trait_id) }
cache_on_disk_if { true }
ensure_forwards_result_if_red
}
query object_safety_violations(trait_id: DefId) -> &'tcx [ObjectSafetyViolation] {
desc { |tcx| "determining object safety of trait `{}`", tcx.def_path_str(trait_id) }

View file

@ -350,7 +350,7 @@ impl<'tcx> TyCtxt<'tcx> {
validate: impl Fn(Self, DefId) -> Result<(), ErrorGuaranteed>,
) -> Option<ty::Destructor> {
let drop_trait = self.lang_items().drop_trait()?;
self.ensure().coherent_trait(drop_trait);
self.ensure().coherent_trait(drop_trait).ok()?;
let ty = self.type_of(adt_did).instantiate_identity();
let mut dtor_candidate = None;