File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use self::program_clauses::ToProgramClauses;
33use crate :: RustIrDatabase ;
44use chalk_ir:: cast:: { Cast , Caster } ;
55use chalk_ir:: could_match:: CouldMatch ;
6+ use chalk_ir:: fold:: Subst ;
67use chalk_ir:: * ;
78use rustc_hash:: FxHashSet ;
89use std:: sync:: Arc ;
@@ -167,6 +168,16 @@ fn program_clauses_that_could_match(
167168 }
168169 }
169170
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+
170181 // TODO sized, unsize_trait, builtin impls?
171182 }
172183 DomainGoal :: Holds ( WhereClause :: ProjectionEq ( projection_predicate) ) => {
You can’t perform that action at this time.
0 commit comments