File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
compiler/rustc_trait_selection/src/solve Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use rustc_infer::traits::{
10
10
use rustc_macros:: extension;
11
11
use rustc_middle:: { bug, span_bug} ;
12
12
use rustc_span:: Span ;
13
+ use thin_vec:: ThinVec ;
13
14
14
15
use crate :: solve:: inspect:: { self , ProofTreeInferCtxtExt } ;
15
16
@@ -147,7 +148,7 @@ fn to_selection<'tcx>(
147
148
}
148
149
149
150
let ( nested, impl_args) = cand. instantiate_nested_goals_and_opt_impl_args ( span) ;
150
- let nested = nested
151
+ let mut nested: ThinVec < _ > = nested
151
152
. into_iter ( )
152
153
. map ( |nested| {
153
154
Obligation :: new (
@@ -159,6 +160,12 @@ fn to_selection<'tcx>(
159
160
} )
160
161
. collect ( ) ;
161
162
163
+ // Drop nested goals from selection since they can't constrain the impl args
164
+ // further if they're unambiguous.
165
+ if let Ok ( Certainty :: Yes ) = cand. result ( ) {
166
+ nested. clear ( ) ;
167
+ }
168
+
162
169
Some ( match cand. kind ( ) {
163
170
ProbeKind :: TraitCandidate { source, result : _ } => match source {
164
171
CandidateSource :: Impl ( impl_def_id) => {
You can’t perform that action at this time.
0 commit comments