diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-20 20:17:14 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-20 20:17:14 +0000 |
commit | 62bc753f8b1957699288ceea90a4096667bf0ebc (patch) | |
tree | 3e21520683ad2fce54368614ff7e6b8b5ea62642 /crates/hir/src | |
parent | d0a787152d9f226707168f65ebfb215e23cedeed (diff) | |
parent | 0799288f0189c07907a30787e7d2f5f0bf960996 (diff) |
Merge #7732
7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril
Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects?
Fixes #7683(hopefully for real this time)
I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see https://github.com/Veykril/rust-analyzer/commit/b9d69048451a5f2e9c5a72c800369bbeef36fdcf) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now.
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/code_model.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 021e4ad31..b3218833d 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -28,7 +28,7 @@ use hir_expand::{ | |||
28 | }; | 28 | }; |
29 | use hir_ty::{ | 29 | use hir_ty::{ |
30 | autoderef, | 30 | autoderef, |
31 | display::{write_bounds_like_dyn_trait, HirDisplayError, HirFormatter}, | 31 | display::{write_bounds_like_dyn_trait_with_prefix, HirDisplayError, HirFormatter}, |
32 | method_resolution, | 32 | method_resolution, |
33 | traits::{FnTrait, Solution, SolutionVariables}, | 33 | traits::{FnTrait, Solution, SolutionVariables}, |
34 | ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate, | 34 | ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate, |
@@ -1379,8 +1379,7 @@ impl HirDisplay for TypeParam { | |||
1379 | let substs = Substs::type_params(f.db, self.id.parent); | 1379 | let substs = Substs::type_params(f.db, self.id.parent); |
1380 | let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); | 1380 | let predicates = bounds.iter().cloned().map(|b| b.subst(&substs)).collect::<Vec<_>>(); |
1381 | if !(predicates.is_empty() || f.omit_verbose_types()) { | 1381 | if !(predicates.is_empty() || f.omit_verbose_types()) { |
1382 | write!(f, ": ")?; | 1382 | write_bounds_like_dyn_trait_with_prefix(":", &predicates, f)?; |
1383 | write_bounds_like_dyn_trait(&predicates, f)?; | ||
1384 | } | 1383 | } |
1385 | Ok(()) | 1384 | Ok(()) |
1386 | } | 1385 | } |