File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
compiler/rustc_trait_selection/src/solve Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use rustc_infer::traits::{
1010use rustc_macros:: extension;
1111use rustc_middle:: { bug, span_bug} ;
1212use rustc_span:: Span ;
13+ use thin_vec:: ThinVec ;
1314
1415use crate :: solve:: inspect:: { self , ProofTreeInferCtxtExt } ;
1516
@@ -147,7 +148,7 @@ fn to_selection<'tcx>(
147148 }
148149
149150 let ( nested, impl_args) = cand. instantiate_nested_goals_and_opt_impl_args ( span) ;
150- let nested = nested
151+ let mut nested: ThinVec < _ > = nested
151152 . into_iter ( )
152153 . map ( |nested| {
153154 Obligation :: new (
@@ -159,6 +160,10 @@ fn to_selection<'tcx>(
159160 } )
160161 . collect ( ) ;
161162
163+ if let Ok ( Certainty :: Yes ) = cand. result ( ) {
164+ nested. clear ( ) ;
165+ }
166+
162167 Some ( match cand. kind ( ) {
163168 ProbeKind :: TraitCandidate { source, result : _ } => match source {
164169 CandidateSource :: Impl ( impl_def_id) => {
You can’t perform that action at this time.
0 commit comments