Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #119582 (bootstrap: handle vendored sources when remapping crate paths) - #119730 (docs: fix typos) - #119828 (Improved collapse_debuginfo attribute, added command-line flag) - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - #120037 (Remove `next_root_ty_var`) - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - #120096 (Set RUSTC_BOOTSTRAP=1 consistently) - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - #120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
92d727796b
61 changed files with 767 additions and 251 deletions
|
@ -82,6 +82,10 @@ impl<T> EraseType for Result<&'_ T, rustc_errors::ErrorGuaranteed> {
|
|||
type Result = [u8; size_of::<Result<&'static (), rustc_errors::ErrorGuaranteed>>()];
|
||||
}
|
||||
|
||||
impl<T> EraseType for Result<&'_ [T], rustc_errors::ErrorGuaranteed> {
|
||||
type Result = [u8; size_of::<Result<&'static [()], rustc_errors::ErrorGuaranteed>>()];
|
||||
}
|
||||
|
||||
impl<T> EraseType for Result<&'_ T, traits::CodegenObligationError> {
|
||||
type Result = [u8; size_of::<Result<&'static (), traits::CodegenObligationError>>()];
|
||||
}
|
||||
|
|
|
@ -851,13 +851,13 @@ rustc_queries! {
|
|||
/// Maps a `DefId` of a type to a list of its inherent impls.
|
||||
/// Contains implementations of methods that are inherent to a type.
|
||||
/// Methods in these implementations don't need to be exported.
|
||||
query inherent_impls(key: DefId) -> &'tcx [DefId] {
|
||||
query inherent_impls(key: DefId) -> Result<&'tcx [DefId], ErrorGuaranteed> {
|
||||
desc { |tcx| "collecting inherent impls for `{}`", tcx.def_path_str(key) }
|
||||
cache_on_disk_if { key.is_local() }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
||||
query incoherent_impls(key: SimplifiedType) -> &'tcx [DefId] {
|
||||
query incoherent_impls(key: SimplifiedType) -> Result<&'tcx [DefId], ErrorGuaranteed> {
|
||||
desc { |tcx| "collecting all inherent impls for `{:?}`", key }
|
||||
}
|
||||
|
||||
|
@ -953,8 +953,9 @@ rustc_queries! {
|
|||
desc { |tcx| "checking deathness of variables in {}", describe_as_module(key, tcx) }
|
||||
}
|
||||
|
||||
query check_mod_impl_wf(key: LocalModDefId) -> () {
|
||||
query check_mod_impl_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
|
||||
desc { |tcx| "checking that impls are well-formed in {}", describe_as_module(key, tcx) }
|
||||
ensure_forwards_result_if_red
|
||||
}
|
||||
|
||||
query check_mod_type_wf(key: LocalModDefId) -> Result<(), ErrorGuaranteed> {
|
||||
|
@ -1003,15 +1004,16 @@ rustc_queries! {
|
|||
|
||||
/// Gets a complete map from all types to their inherent impls.
|
||||
/// Not meant to be used directly outside of coherence.
|
||||
query crate_inherent_impls(k: ()) -> &'tcx CrateInherentImpls {
|
||||
arena_cache
|
||||
query crate_inherent_impls(k: ()) -> Result<&'tcx CrateInherentImpls, ErrorGuaranteed> {
|
||||
desc { "finding all inherent impls defined in crate" }
|
||||
ensure_forwards_result_if_red
|
||||
}
|
||||
|
||||
/// Checks all types in the crate for overlap in their inherent impls. Reports errors.
|
||||
/// Not meant to be used directly outside of coherence.
|
||||
query crate_inherent_impls_overlap_check(_: ()) -> () {
|
||||
query crate_inherent_impls_overlap_check(_: ()) -> Result<(), ErrorGuaranteed> {
|
||||
desc { "check for overlap between inherent impls defined in this crate" }
|
||||
ensure_forwards_result_if_red
|
||||
}
|
||||
|
||||
/// Checks whether all impls in the crate pass the overlap check, returning
|
||||
|
@ -1637,7 +1639,7 @@ rustc_queries! {
|
|||
///
|
||||
/// Do not call this directly, but instead use the `incoherent_impls` query.
|
||||
/// This query is only used to get the data necessary for that query.
|
||||
query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> &'tcx [DefId] {
|
||||
query crate_incoherent_impls(key: (CrateNum, SimplifiedType)) -> Result<&'tcx [DefId], ErrorGuaranteed> {
|
||||
desc { |tcx| "collecting all impls for a type in a crate" }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ pub fn query_ensure<'tcx, Cache>(
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn query_ensure_error_guaranteed<'tcx, Cache>(
|
||||
pub fn query_ensure_error_guaranteed<'tcx, Cache, T>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
execute_query: fn(TyCtxt<'tcx>, Span, Cache::Key, QueryMode) -> Option<Cache::Value>,
|
||||
query_cache: &Cache,
|
||||
|
@ -182,14 +182,16 @@ pub fn query_ensure_error_guaranteed<'tcx, Cache>(
|
|||
check_cache: bool,
|
||||
) -> Result<(), ErrorGuaranteed>
|
||||
where
|
||||
Cache: QueryCache<Value = super::erase::Erase<Result<(), ErrorGuaranteed>>>,
|
||||
Cache: QueryCache<Value = super::erase::Erase<Result<T, ErrorGuaranteed>>>,
|
||||
Result<T, ErrorGuaranteed>: EraseType,
|
||||
{
|
||||
let key = key.into_query_param();
|
||||
if let Some(res) = try_get_cached(tcx, query_cache, &key) {
|
||||
super::erase::restore(res)
|
||||
super::erase::restore(res).map(drop)
|
||||
} else {
|
||||
execute_query(tcx, DUMMY_SP, key, QueryMode::Ensure { check_cache })
|
||||
.map(super::erase::restore)
|
||||
.map(|res| res.map(drop))
|
||||
// Either we actually executed the query, which means we got a full `Result`,
|
||||
// or we can just assume the query succeeded, because it was green in the
|
||||
// incremental cache. If it is green, that means that the previous compilation
|
||||
|
@ -205,7 +207,7 @@ macro_rules! query_ensure {
|
|||
query_ensure($($args)*)
|
||||
};
|
||||
([(ensure_forwards_result_if_red) $($rest:tt)*]$($args:tt)*) => {
|
||||
query_ensure_error_guaranteed($($args)*)
|
||||
query_ensure_error_guaranteed($($args)*).map(|_| ())
|
||||
};
|
||||
([$other:tt $($modifiers:tt)*]$($args:tt)*) => {
|
||||
query_ensure!([$($modifiers)*]$($args)*)
|
||||
|
@ -667,5 +669,7 @@ mod sealed {
|
|||
|
||||
pub use sealed::IntoQueryParam;
|
||||
|
||||
use super::erase::EraseType;
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable)]
|
||||
pub struct CyclePlaceholder(pub ErrorGuaranteed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue