File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use self::program_clauses::ToProgramClauses;
3
3
use crate :: RustIrDatabase ;
4
4
use chalk_ir:: cast:: { Cast , Caster } ;
5
5
use chalk_ir:: could_match:: CouldMatch ;
6
+ use chalk_ir:: fold:: Subst ;
6
7
use chalk_ir:: * ;
7
8
use rustc_hash:: FxHashSet ;
8
9
use std:: sync:: Arc ;
@@ -167,6 +168,16 @@ fn program_clauses_that_could_match(
167
168
}
168
169
}
169
170
171
+ // Check for impl and dyn Traits so that we generate `Implemented(impl Foo: Foo)`
172
+ match trait_ref. self_type_parameter ( ) {
173
+ Some ( Ty :: Opaque ( qwc) ) | Some ( Ty :: Dyn ( qwc) ) => {
174
+ let self_ty = trait_ref. self_type_parameter ( ) . unwrap ( ) ; // This cannot be None
175
+ let wc = Subst :: apply ( & [ self_ty. cast ( ) ] , & qwc. value ) ;
176
+ clauses. extend ( wc. into_iter ( ) . casted ( ) ) ;
177
+ }
178
+ _ => { }
179
+ }
180
+
170
181
// TODO sized, unsize_trait, builtin impls?
171
182
}
172
183
DomainGoal :: Holds ( WhereClause :: ProjectionEq ( projection_predicate) ) => {
You can’t perform that action at this time.
0 commit comments