diff options
author | Florian Diebold <[email protected]> | 2019-12-21 18:15:06 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-22 23:08:03 +0000 |
commit | 1f7f4578f72721c1b0e17e8405f986fd2ce89aaf (patch) | |
tree | efe0fe32ff3d2cc5981206ad1a7777824cf9de05 /crates/ra_hir_ty/src/traits/chalk.rs | |
parent | 4053fcfca0e33f133c53fa755c1b1bcc0b4c11bb (diff) |
Filter out error predicates in type bounds as well
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 9e38337e5..555930c9b 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -129,12 +129,22 @@ impl ToChalk for Ty { | |||
129 | Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(), | 129 | Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(), |
130 | Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), | 130 | Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), |
131 | Ty::Dyn(predicates) => { | 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 | let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) }; | 138 | let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) }; |
134 | chalk_ir::TyData::Dyn(bounded_ty).intern() | 139 | chalk_ir::TyData::Dyn(bounded_ty).intern() |
135 | } | 140 | } |
136 | Ty::Opaque(predicates) => { | 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 | let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) }; | 148 | let bounded_ty = chalk_ir::BoundedTy { bounds: make_binders(where_clauses, 1) }; |
139 | chalk_ir::TyData::Opaque(bounded_ty).intern() | 149 | chalk_ir::TyData::Opaque(bounded_ty).intern() |
140 | } | 150 | } |