about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/instance.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-04-25 11:48:57 -0400
committerMichael Goulet <michael@errs.io>2024-04-25 11:49:12 -0400
commitcc606174a6b18572f523790e80bcd59c95649b2a (patch)
tree8456713ee305ab0b55ec093a0a2d40352b5c90e3 /compiler/rustc_ty_utils/src/instance.rs
parent1c84675e1f5bd97307af5a86b4f8e6d9e571362c (diff)
downloadrust-cc606174a6b18572f523790e80bcd59c95649b2a.tar.gz
rust-cc606174a6b18572f523790e80bcd59c95649b2a.zip
Don't ICE when codegen_select returns ambiguity in new solver
Diffstat (limited to 'compiler/rustc_ty_utils/src/instance.rs')
-rw-r--r--compiler/rustc_ty_utils/src/instance.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs
index c1661fa63a8..d0aa4eb2e71 100644
--- a/compiler/rustc_ty_utils/src/instance.rs
+++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -101,18 +101,11 @@ fn resolve_associated_item<'tcx>(
 
     let vtbl = match tcx.codegen_select_candidate((param_env, trait_ref)) {
         Ok(vtbl) => vtbl,
-        Err(CodegenObligationError::Ambiguity) => {
-            let reported = tcx.dcx().span_delayed_bug(
-                tcx.def_span(trait_item_id),
-                format!(
-                    "encountered ambiguity selecting `{trait_ref:?}` during codegen, presuming due to \
-                     overflow or prior type error",
-                ),
-            );
-            return Err(reported);
-        }
-        Err(CodegenObligationError::Unimplemented) => return Ok(None),
-        Err(CodegenObligationError::FulfillmentError) => return Ok(None),
+        Err(
+            CodegenObligationError::Ambiguity
+            | CodegenObligationError::Unimplemented
+            | CodegenObligationError::FulfillmentError,
+        ) => return Ok(None),
     };
 
     // Now that we know which impl is being used, we can dispatch to