From 9f238930f1969731869c89956414f4b160b180c0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 22 Aug 2019 15:28:08 +0300 Subject: Don't add `?` bounds as real bounds closes #1709 --- crates/ra_hir/src/ty/tests.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 6c2d857bc..57fd5492d 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -3028,6 +3028,35 @@ fn test(s: S) { assert_eq!(t, "{unknown}"); } +#[test] +fn deref_trait_with_question_mark_size() { + let t = type_at( + r#" +//- /main.rs +#[lang = "deref"] +trait Deref { + type Target; + fn deref(&self) -> &Self::Target; +} + +struct Arc; +impl Deref for Arc { + type Target = T; +} + +struct S; +impl S { + fn foo(&self) -> u128 {} +} + +fn test(s: Arc) { + (*s, s.foo())<|> +} +"#, + ); + assert_eq!(t, "(S, u128)"); +} + #[test] fn obligation_from_function_clause() { let t = type_at( -- cgit v1.2.3