aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/lower.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-02-21 22:06:18 +0000
committerFlorian Diebold <[email protected]>2020-02-22 10:09:21 +0000
commit463df6720cc8d2c7176a48a0ca8f4e333016a16a (patch)
tree48aa09c0066b945b4885a6ae0cc0a5981bfd631b /crates/ra_hir_ty/src/lower.rs
parent2d5ab6324795e5fc36e4b61cb66737958dc67e7a (diff)
Fix wrong handling of bare `dyn Trait` exposed by canonicalizer fix
The self type in the `dyn Trait` trait ref should always be ^0, but we didn't put that in there in the bare case.
Diffstat (limited to 'crates/ra_hir_ty/src/lower.rs')
-rw-r--r--crates/ra_hir_ty/src/lower.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs
index 52da34574..0e6efa971 100644
--- a/crates/ra_hir_ty/src/lower.rs
+++ b/crates/ra_hir_ty/src/lower.rs
@@ -239,7 +239,9 @@ impl Ty {
239 ) -> Ty { 239 ) -> Ty {
240 let ty = match resolution { 240 let ty = match resolution {
241 TypeNs::TraitId(trait_) => { 241 TypeNs::TraitId(trait_) => {
242 let trait_ref = TraitRef::from_resolved_path(ctx, trait_, resolved_segment, None); 242 // if this is a bare dyn Trait, we'll directly put the required ^0 for the self type in there
243 let self_ty = if remaining_segments.len() == 0 { Some(Ty::Bound(0)) } else { None };
244 let trait_ref = TraitRef::from_resolved_path(ctx, trait_, resolved_segment, self_ty);
243 return if remaining_segments.len() == 1 { 245 return if remaining_segments.len() == 1 {
244 let segment = remaining_segments.first().unwrap(); 246 let segment = remaining_segments.first().unwrap();
245 let associated_ty = associated_type_by_name_including_super_traits( 247 let associated_ty = associated_type_by_name_including_super_traits(