1
Fork 0

Allow ensure queries to return Result<(), ErrorGuaranteed>

This commit is contained in:
Oli Scherer 2023-10-18 15:53:06 +00:00
parent eb99a89bd7
commit fe8ebb1890
5 changed files with 75 additions and 9 deletions

View file

@ -1899,10 +1899,10 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
fn check_mod_type_wf(tcx: TyCtxt<'_>, module: LocalModDefId) -> Result<(), ErrorGuaranteed> {
let items = tcx.hir_module_items(module);
let mut res = items.par_items(|item| tcx.check_well_formed(item.owner_id));
res = res.and(items.par_impl_items(|item| tcx.check_well_formed(item.owner_id)));
res = res.and(items.par_trait_items(|item| tcx.check_well_formed(item.owner_id)));
res.and(items.par_foreign_items(|item| tcx.check_well_formed(item.owner_id)))
let mut res = items.par_items(|item| tcx.ensure().check_well_formed(item.owner_id));
res = res.and(items.par_impl_items(|item| tcx.ensure().check_well_formed(item.owner_id)));
res = res.and(items.par_trait_items(|item| tcx.ensure().check_well_formed(item.owner_id)));
res.and(items.par_foreign_items(|item| tcx.ensure().check_well_formed(item.owner_id)))
}
fn error_392(

View file

@ -206,7 +206,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
}
tcx.sess.time("wf_checking", || {
tcx.hir().try_par_for_each_module(|module| tcx.check_mod_type_wf(module))
tcx.hir().try_par_for_each_module(|module| tcx.ensure().check_mod_type_wf(module))
})?;
// NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.