File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -958,6 +958,23 @@ fn test() {
958
958
) ;
959
959
}
960
960
961
+ #[ test]
962
+ fn error_bound_chalk ( ) {
963
+ let t = type_at (
964
+ r#"
965
+ //- /main.rs
966
+ trait Trait {
967
+ fn foo(&self) -> u32 {}
968
+ }
969
+
970
+ fn test(x: (impl Trait + UnknownTrait)) {
971
+ x.foo()<|>;
972
+ }
973
+ "# ,
974
+ ) ;
975
+ assert_eq ! ( t, "u32" ) ;
976
+ }
977
+
961
978
#[ test]
962
979
fn assoc_type_bindings ( ) {
963
980
assert_snapshot ! (
Original file line number Diff line number Diff line change @@ -129,12 +129,22 @@ impl ToChalk for Ty {
129
129
Ty :: Bound ( idx) => chalk_ir:: TyData :: BoundVar ( idx as usize ) . intern ( ) ,
130
130
Ty :: Infer ( _infer_ty) => panic ! ( "uncanonicalized infer ty" ) ,
131
131
Ty :: Dyn ( predicates) => {
132
- let where_clauses = predicates. iter ( ) . cloned ( ) . map ( |p| p. to_chalk ( db) ) . collect ( ) ;
132
+ let where_clauses = predicates
133
+ . iter ( )
134
+ . filter ( |p| !p. is_error ( ) )
135
+ . cloned ( )
136
+ . map ( |p| p. to_chalk ( db) )
137
+ . collect ( ) ;
133
138
let bounded_ty = chalk_ir:: BoundedTy { bounds : make_binders ( where_clauses, 1 ) } ;
134
139
chalk_ir:: TyData :: Dyn ( bounded_ty) . intern ( )
135
140
}
136
141
Ty :: Opaque ( predicates) => {
137
- let where_clauses = predicates. iter ( ) . cloned ( ) . map ( |p| p. to_chalk ( db) ) . collect ( ) ;
142
+ let where_clauses = predicates
143
+ . iter ( )
144
+ . filter ( |p| !p. is_error ( ) )
145
+ . cloned ( )
146
+ . map ( |p| p. to_chalk ( db) )
147
+ . collect ( ) ;
138
148
let bounded_ty = chalk_ir:: BoundedTy { bounds : make_binders ( where_clauses, 1 ) } ;
139
149
chalk_ir:: TyData :: Opaque ( bounded_ty) . intern ( )
140
150
}
You can’t perform that action at this time.
0 commit comments