about summary refs log tree commit diff
path: root/compiler/rustc_next_trait_solver
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-23 23:30:43 +0000
committerbors <bors@rust-lang.org>2025-08-23 23:30:43 +0000
commitf6d23413c399fb530be362ebcf25a4e788e16137 (patch)
tree9741e8487693d945ae6e4eec8c4f154845a60f8d /compiler/rustc_next_trait_solver
parent69b76df90c7ea63b5350d1865f92902a0b27c9a2 (diff)
parent4d38062da118ec2e832f6d4b0700b4b62d65efda (diff)
downloadrust-f6d23413c399fb530be362ebcf25a4e788e16137.tar.gz
rust-f6d23413c399fb530be362ebcf25a4e788e16137.zip
Auto merge of #145796 - samueltardieu:rollup-linfi86, r=samueltardieu
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#143898 (opt-dist: rebuild rustc when doing static LLVM builds)
 - rust-lang/rust#144452 (std/sys/fd: Relax `READ_LIMIT` on Darwin)
 - rust-lang/rust#145234 (match exhaustiveness diagnostics: show a trailing comma on singleton tuple consructors in witness patterns (and clean up a little))
 - rust-lang/rust#145515 (Optimize `char::encode_utf8`)
 - rust-lang/rust#145540 (interpret/allocation: get_range on ProvenanceMap)
 - rust-lang/rust#145670 (port `sanitize` attribute to the new parsing infrastructure)
 - rust-lang/rust#145713 (next-solver: fix `feature(const_trait_impl)` bootstrap)
 - rust-lang/rust#145729 (Remove two duplicated crates)
 - rust-lang/rust#145744 (miri: also detect aliasing of in-place argument and return place)
 - rust-lang/rust#145774 (Remove default opts from config)
 - rust-lang/rust#145781 (Remove profile section from Clippy)
 - rust-lang/rust#145782 (rustdoc: make attributes render consistently)
 - rust-lang/rust#145787 (citool: cleanup `mismatched_lifetime_syntaxes` warnings)
 - rust-lang/rust#145791 (Fix ICE when validating transmuting ZST to inhabited enum)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_next_trait_solver')
-rw-r--r--compiler/rustc_next_trait_solver/src/solve/effect_goals.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
index 9a22bf58c03..b7ae9994c62 100644
--- a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
@@ -6,7 +6,7 @@ use rustc_type_ir::inherent::*;
 use rustc_type_ir::lang_items::TraitSolverLangItem;
 use rustc_type_ir::solve::SizedTraitKind;
 use rustc_type_ir::solve::inspect::ProbeKind;
-use rustc_type_ir::{self as ty, Interner, elaborate};
+use rustc_type_ir::{self as ty, Interner, TypingMode, elaborate};
 use tracing::instrument;
 
 use super::assembly::{Candidate, structural_traits};
@@ -135,12 +135,16 @@ where
         }
 
         let impl_polarity = cx.impl_polarity(impl_def_id);
-        match impl_polarity {
+        let certainty = match impl_polarity {
             ty::ImplPolarity::Negative => return Err(NoSolution),
-            ty::ImplPolarity::Reservation => {
-                unimplemented!("reservation impl for const trait: {:?}", goal)
-            }
-            ty::ImplPolarity::Positive => {}
+            ty::ImplPolarity::Reservation => match ecx.typing_mode() {
+                TypingMode::Coherence => Certainty::AMBIGUOUS,
+                TypingMode::Analysis { .. }
+                | TypingMode::Borrowck { .. }
+                | TypingMode::PostBorrowckAnalysis { .. }
+                | TypingMode::PostAnalysis => return Err(NoSolution),
+            },
+            ty::ImplPolarity::Positive => Certainty::Yes,
         };
 
         if !cx.impl_is_const(impl_def_id) {
@@ -171,7 +175,7 @@ where
                 });
             ecx.add_goals(GoalSource::ImplWhereBound, const_conditions);
 
-            ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
+            ecx.evaluate_added_goals_and_make_canonical_response(certainty)
         })
     }