From db32a2e4211f9444ef4f10b633e400d27ed2662e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 10 Apr 2020 22:05:46 +0200 Subject: Implement inline associated type bounds Like `Iterator`. This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :) --- crates/ra_hir_def/src/data.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/data.rs') diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 56a20c5bd..b3c91fea2 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -15,7 +15,7 @@ use ra_syntax::ast::{ use crate::{ attr::Attrs, db::DefDatabase, - path::{path, GenericArgs, Path}, + path::{path, AssociatedTypeBinding, GenericArgs, Path}, src::HasSource, type_ref::{Mutability, TypeBound, TypeRef}, visibility::RawVisibility, @@ -95,7 +95,11 @@ fn desugar_future_path(orig: TypeRef) -> Path { let path = path![std::future::Future]; let mut generic_args: Vec<_> = std::iter::repeat(None).take(path.segments.len() - 1).collect(); let mut last = GenericArgs::empty(); - last.bindings.push((name![Output], orig)); + last.bindings.push(AssociatedTypeBinding { + name: name![Output], + type_ref: Some(orig), + bounds: Vec::new(), + }); generic_args.push(Some(Arc::new(last))); Path::from_known_path(path, generic_args) -- cgit v1.2.3