From dc935be1b511d1179b6b0d1cf1b80c6c931724e4 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 14 Sep 2019 10:20:05 +0200 Subject: Support bare `Trait` without dyn --- crates/ra_hir/src/ty/lower.rs | 3 +-- crates/ra_hir/src/ty/tests.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 3fdb2ca92..6ead3846a 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs @@ -124,8 +124,7 @@ impl Ty { Ty::Unknown } } else { - // FIXME dyn Trait without the dyn - Ty::Unknown + Ty::Dyn(Arc::new([GenericPredicate::Implemented(trait_ref)])) }; } TypeNs::GenericParam(idx) => { diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 9a5f6949d..f6a2a658f 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -3626,19 +3626,19 @@ fn test(x: Trait, y: &Trait) -> u64 { @r###" [27; 31) 'self': &Self [61; 63) '{}': () - [73; 74) 'x': {unknown} - [83; 84) 'y': &{unknown} + [73; 74) 'x': dyn Trait + [83; 84) 'y': &dyn Trait [101; 176) '{ ...o(); }': () - [107; 108) 'x': {unknown} - [114; 115) 'y': &{unknown} - [125; 126) 'z': {unknown} - [129; 132) 'bar': fn bar() -> {unknown} - [129; 134) 'bar()': {unknown} - [140; 141) 'x': {unknown} + [107; 108) 'x': dyn Trait + [114; 115) 'y': &dyn Trait + [125; 126) 'z': dyn Trait + [129; 132) 'bar': fn bar() -> dyn Trait + [129; 134) 'bar()': dyn Trait + [140; 141) 'x': dyn Trait [140; 147) 'x.foo()': u64 - [153; 154) 'y': &{unknown} + [153; 154) 'y': &dyn Trait [153; 160) 'y.foo()': u64 - [166; 167) 'z': {unknown} + [166; 167) 'z': dyn Trait [166; 173) 'z.foo()': u64 "### ); -- cgit v1.2.3