Skip to content

Commit ec941e5

Browse files
committed
Add inlay hints lifetime arg tests
1 parent 31304ad commit ec941e5

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

crates/ide-assists/src/handlers/extract_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5623,7 +5623,7 @@ fn func<T: Debug>(i: Struct<'_, T>) {
56235623
fun_name(i);
56245624
}
56255625
5626-
fn $0fun_name(i: Struct<'_, T>) {
5626+
fn $0fun_name(i: Struct<T>) {
56275627
foo(i);
56285628
}
56295629
"#,

crates/ide-completion/src/tests/predicate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct Foo<'lt, T, const C: usize> where $0 {}
1919
en Enum Enum
2020
ma makro!(…) macro_rules! makro
2121
md module
22-
st Foo<…> Foo<'{error}, {unknown}, _>
22+
st Foo<…> Foo<{unknown}, _>
2323
st Record Record
2424
st Tuple Tuple
2525
st Unit Unit
@@ -92,7 +92,7 @@ struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
9292
en Enum Enum
9393
ma makro!(…) macro_rules! makro
9494
md module
95-
st Foo<…> Foo<'{error}, {unknown}, _>
95+
st Foo<…> Foo<{unknown}, _>
9696
st Record Record
9797
st Tuple Tuple
9898
st Unit Unit

crates/ide-completion/src/tests/type_pos.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ struct Foo<'lt, T, const C: usize> {
2020
en Enum Enum
2121
ma makro!(…) macro_rules! makro
2222
md module
23-
sp Self Foo<'{error}, {unknown}, _>
24-
st Foo<…> Foo<'{error}, {unknown}, _>
23+
sp Self Foo<{unknown}, _>
24+
st Foo<…> Foo<{unknown}, _>
2525
st Record Record
2626
st Tuple Tuple
2727
st Unit Unit
@@ -45,8 +45,8 @@ struct Foo<'lt, T, const C: usize>(f$0);
4545
en Enum Enum
4646
ma makro!(…) macro_rules! makro
4747
md module
48-
sp Self Foo<'{error}, {unknown}, _>
49-
st Foo<…> Foo<'{error}, {unknown}, _>
48+
sp Self Foo<{unknown}, _>
49+
st Foo<…> Foo<{unknown}, _>
5050
st Record Record
5151
st Tuple Tuple
5252
st Unit Unit

crates/ide/src/inlay_hints/bind_pat.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,25 @@ fn main(a: SliceIter<'_, Container>) {
331331
);
332332
}
333333

334+
#[test]
335+
fn lt_hints() {
336+
check_types(
337+
r#"
338+
struct S<'lt>;
339+
340+
fn f<'a>() {
341+
let x = S::<'static>;
342+
//^ S<'static>
343+
let y = S::<'_>;
344+
//^ S
345+
let z = S::<'a>;
346+
//^ S<'a>
347+
348+
}
349+
"#,
350+
);
351+
}
352+
334353
#[test]
335354
fn fn_hints() {
336355
check_types(
@@ -341,7 +360,7 @@ fn foo1() -> impl Fn(f64) { loop {} }
341360
fn foo2() -> impl Fn(f64, f64) { loop {} }
342361
fn foo3() -> impl Fn(f64, f64) -> u32 { loop {} }
343362
fn foo4() -> &'static dyn Fn(f64, f64) -> u32 { loop {} }
344-
fn foo5() -> &'static dyn Fn(&'static dyn Fn(f64, f64) -> u32, f64) -> u32 { loop {} }
363+
fn foo5() -> &'static for<'a> dyn Fn(&'a dyn Fn(f64, f64) -> u32, f64) -> u32 { loop {} }
345364
fn foo6() -> impl Fn(f64, f64) -> u32 + Sized { loop {} }
346365
fn foo7() -> *const (impl Fn(f64, f64) -> u32 + Sized) { loop {} }
347366

0 commit comments

Comments
 (0)