diff options
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 13 | ||||
-rw-r--r-- | crates/hir_def/src/item_tree/pretty.rs | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 91cf75371..b4389371f 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -384,7 +384,7 @@ impl<'a> Ctx<'a> { | |||
384 | 384 | ||
385 | let ret_type = if func.async_token().is_some() { | 385 | let ret_type = if func.async_token().is_some() { |
386 | let future_impl = desugar_future_path(ret_type); | 386 | let future_impl = desugar_future_path(ret_type); |
387 | let ty_bound = TypeBound::Path(future_impl); | 387 | let ty_bound = Interned::new(TypeBound::Path(future_impl)); |
388 | TypeRef::ImplTrait(vec![ty_bound]) | 388 | TypeRef::ImplTrait(vec![ty_bound]) |
389 | } else { | 389 | } else { |
390 | ret_type | 390 | ret_type |
@@ -738,11 +738,12 @@ impl<'a> Ctx<'a> { | |||
738 | Interned::new(generics) | 738 | Interned::new(generics) |
739 | } | 739 | } |
740 | 740 | ||
741 | fn lower_type_bounds(&mut self, node: &impl ast::TypeBoundsOwner) -> Vec<TypeBound> { | 741 | fn lower_type_bounds(&mut self, node: &impl ast::TypeBoundsOwner) -> Vec<Interned<TypeBound>> { |
742 | match node.type_bound_list() { | 742 | match node.type_bound_list() { |
743 | Some(bound_list) => { | 743 | Some(bound_list) => bound_list |
744 | bound_list.bounds().map(|it| TypeBound::from_ast(&self.body_ctx, it)).collect() | 744 | .bounds() |
745 | } | 745 | .map(|it| Interned::new(TypeBound::from_ast(&self.body_ctx, it))) |
746 | .collect(), | ||
746 | None => Vec::new(), | 747 | None => Vec::new(), |
747 | } | 748 | } |
748 | } | 749 | } |
@@ -810,7 +811,7 @@ fn desugar_future_path(orig: TypeRef) -> Path { | |||
810 | let binding = | 811 | let binding = |
811 | AssociatedTypeBinding { name: name![Output], type_ref: Some(orig), bounds: Vec::new() }; | 812 | AssociatedTypeBinding { name: name![Output], type_ref: Some(orig), bounds: Vec::new() }; |
812 | last.bindings.push(binding); | 813 | last.bindings.push(binding); |
813 | generic_args.push(Some(Arc::new(last))); | 814 | generic_args.push(Some(Interned::new(last))); |
814 | 815 | ||
815 | Path::from_known_path(path, generic_args) | 816 | Path::from_known_path(path, generic_args) |
816 | } | 817 | } |
diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs index 4bc87a0e2..9394a5de6 100644 --- a/crates/hir_def/src/item_tree/pretty.rs +++ b/crates/hir_def/src/item_tree/pretty.rs | |||
@@ -513,13 +513,13 @@ impl<'a> Printer<'a> { | |||
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | fn print_type_bounds(&mut self, bounds: &[TypeBound]) { | 516 | fn print_type_bounds(&mut self, bounds: &[Interned<TypeBound>]) { |
517 | for (i, bound) in bounds.iter().enumerate() { | 517 | for (i, bound) in bounds.iter().enumerate() { |
518 | if i != 0 { | 518 | if i != 0 { |
519 | w!(self, " + "); | 519 | w!(self, " + "); |
520 | } | 520 | } |
521 | 521 | ||
522 | match bound { | 522 | match bound.as_ref() { |
523 | TypeBound::Path(path) => self.print_path(path), | 523 | TypeBound::Path(path) => self.print_path(path), |
524 | TypeBound::Lifetime(lt) => w!(self, "{}", lt.name), | 524 | TypeBound::Lifetime(lt) => w!(self, "{}", lt.name), |
525 | TypeBound::Error => w!(self, "{{unknown}}"), | 525 | TypeBound::Error => w!(self, "{{unknown}}"), |