about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-25 09:20:22 +0000
committerbors <bors@rust-lang.org>2024-01-25 09:20:22 +0000
commit5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c (patch)
treec2377bd46c3a4a0ae0479913f2e203ff8466fb81 /compiler/rustc_monomorphize/src
parentd93feccb35183fa66fee77e7a2c9d4bf4d01695c (diff)
parent8c1ba5931c30b5102fa30202b44ba2a8c40f565e (diff)
downloadrust-5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c.tar.gz
rust-5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c.zip
Auto merge of #120335 - matthiaskrgr:rollup-2a0y3rd, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #119305 (Add `AsyncFn` family of traits)
 - #119389 (Provide more context on recursive `impl` evaluation overflow)
 - #119895 (Remove `track_errors` entirely)
 - #120230 (Assert that a single scope is passed to `for_scope`)
 - #120278 (Remove --fatal-warnings on wasm targets)
 - #120292 (coverage: Dismantle `Instrumentor` and flatten span refinement)
 - #120315 (On E0308 involving `dyn Trait`, mention trait objects)
 - #120317 (pattern_analysis: Let `ctor_sub_tys` return any Iterator they want)
 - #120318 (pattern_analysis: Reuse most of the `DeconstructedPat` `Debug` impl)
 - #120325 (rustc_data_structures: use either instead of itertools)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_monomorphize/src')
-rw-r--r--compiler/rustc_monomorphize/src/collector.rs8
-rw-r--r--compiler/rustc_monomorphize/src/lib.rs5
2 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs
index 8b991268819..b86244e5a4b 100644
--- a/compiler/rustc_monomorphize/src/collector.rs
+++ b/compiler/rustc_monomorphize/src/collector.rs
@@ -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;
diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs
index 2f5f2d15cd4..3fa40db3c80 100644
--- a/compiler/rustc_monomorphize/src/lib.rs
+++ b/compiler/rustc_monomorphize/src/lib.rs
@@ -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);
         }