Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/display_source_code.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/display_source_code.rs | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/crates/hir-ty/src/tests/display_source_code.rs b/crates/hir-ty/src/tests/display_source_code.rs index 6e3faa05a6..dc3869930d 100644 --- a/crates/hir-ty/src/tests/display_source_code.rs +++ b/crates/hir-ty/src/tests/display_source_code.rs @@ -67,11 +67,11 @@ trait B: A {} fn test<'a>( _: &(dyn A<Assoc = ()> + Send), - //^ &(dyn A<Assoc = ()> + Send) + //^ &(dyn A<Assoc = ()> + Send + 'static) _: &'a (dyn Send + A<Assoc = ()>), - //^ &'a (dyn A<Assoc = ()> + Send) + //^ &'a (dyn A<Assoc = ()> + Send + 'static) _: &dyn B<Assoc = ()>, - //^ &(dyn B<Assoc = ()>) + //^ &(dyn B<Assoc = ()> + 'static) ) {} "#, ); @@ -85,7 +85,7 @@ fn render_dyn_for_ty() { trait Foo<'a> {} fn foo(foo: &dyn for<'a> Foo<'a>) {} - // ^^^ &dyn Foo<'?> + // ^^^ &(dyn Foo<'?> + 'static) "#, ); } @@ -246,3 +246,22 @@ fn test() { "#, ); } + +#[test] +fn type_placeholder_type() { + check_types_source_code( + r#" +struct S<T>(T); +fn test() { + let f: S<_> = S(3); + //^ i32 + let f: [_; _] = [4_u32, 5, 6]; + //^ u32 + let f: (_, _, _) = (1_u32, 1_i32, false); + //^ u32 + //^ i32 + //^ bool +} +"#, + ); +} |