about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-30 19:45:27 -0400
committerMichael Goulet <michael@errs.io>2024-05-30 19:45:59 -0400
commite485b193d07a77495dcdcb3f52f5976c9c9ca1f4 (patch)
treee38739b95556b6ac3a69a4b480fc7bbdf9b7fdcc /compiler/rustc_trait_selection/src/traits
parent6f3df08aadf71e8d4bf7e49f5dc10dfa6f254cb4 (diff)
downloadrust-e485b193d07a77495dcdcb3f52f5976c9c9ca1f4.tar.gz
rust-e485b193d07a77495dcdcb3f52f5976c9c9ca1f4.zip
Don't drop Upcast candidate in intercrate mode
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
index fd7c47ad6fb..f0ecbd83341 100644
--- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
@@ -921,6 +921,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
         param_env: ty::ParamEnv<'tcx>,
         cause: &ObligationCause<'tcx>,
     ) -> Option<ty::PolyExistentialTraitRef<'tcx>> {
+        // Don't drop any candidates in intercrate mode, as it's incomplete.
+        // (Not that it matters, since `Unsize` is not a stable trait.)
+        if self.infcx.intercrate {
+            return None;
+        }
+
         let tcx = self.tcx();
         if tcx.features().trait_upcasting {
             return None;