Add inlay hints lifetime arg tests

This commit is contained in:
Lukas Wirth 2024-04-24 21:24:40 +02:00
parent ec1a29b443
commit 10e82da69d
4 changed files with 27 additions and 8 deletions

View File

@ -5623,7 +5623,7 @@ fn func<T: Debug>(i: Struct<'_, T>) {
fun_name(i); fun_name(i);
} }
fn $0fun_name(i: Struct<'_, T>) { fn $0fun_name(i: Struct<T>) {
foo(i); foo(i);
} }
"#, "#,

View File

@ -19,7 +19,7 @@ struct Foo<'lt, T, const C: usize> where $0 {}
en Enum Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> Foo<'{error}, {unknown}, _> st Foo<> Foo<{unknown}, _>
st Record Record st Record Record
st Tuple Tuple st Tuple Tuple
st Unit Unit st Unit Unit
@ -92,7 +92,7 @@ struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
en Enum Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
st Foo<> Foo<'{error}, {unknown}, _> st Foo<> Foo<{unknown}, _>
st Record Record st Record Record
st Tuple Tuple st Tuple Tuple
st Unit Unit st Unit Unit

View File

@ -20,8 +20,8 @@ struct Foo<'lt, T, const C: usize> {
en Enum Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self Foo<'{error}, {unknown}, _> sp Self Foo<{unknown}, _>
st Foo<> Foo<'{error}, {unknown}, _> st Foo<> Foo<{unknown}, _>
st Record Record st Record Record
st Tuple Tuple st Tuple Tuple
st Unit Unit st Unit Unit
@ -45,8 +45,8 @@ fn tuple_struct_field() {
en Enum Enum en Enum Enum
ma makro!() macro_rules! makro ma makro!() macro_rules! makro
md module md module
sp Self Foo<'{error}, {unknown}, _> sp Self Foo<{unknown}, _>
st Foo<> Foo<'{error}, {unknown}, _> st Foo<> Foo<{unknown}, _>
st Record Record st Record Record
st Tuple Tuple st Tuple Tuple
st Unit Unit st Unit Unit

View File

@ -331,6 +331,25 @@ pub fn quux<T: Foo>() -> T::Bar {
); );
} }
#[test]
fn lt_hints() {
check_types(
r#"
struct S<'lt>;
fn f<'a>() {
let x = S::<'static>;
//^ S<'static>
let y = S::<'_>;
//^ S
let z = S::<'a>;
//^ S<'a>
}
"#,
);
}
#[test] #[test]
fn fn_hints() { fn fn_hints() {
check_types( check_types(
@ -341,7 +360,7 @@ fn foo1() -> impl Fn(f64) { loop {} }
fn foo2() -> impl Fn(f64, f64) { loop {} } fn foo2() -> impl Fn(f64, f64) { loop {} }
fn foo3() -> impl Fn(f64, f64) -> u32 { loop {} } fn foo3() -> impl Fn(f64, f64) -> u32 { loop {} }
fn foo4() -> &'static dyn Fn(f64, f64) -> u32 { loop {} } fn foo4() -> &'static dyn Fn(f64, f64) -> u32 { loop {} }
fn foo5() -> &'static dyn Fn(&'static dyn Fn(f64, f64) -> u32, f64) -> u32 { loop {} } fn foo5() -> &'static for<'a> dyn Fn(&'a dyn Fn(f64, f64) -> u32, f64) -> u32 { loop {} }
fn foo6() -> impl Fn(f64, f64) -> u32 + Sized { loop {} } fn foo6() -> impl Fn(f64, f64) -> u32 + Sized { loop {} }
fn foo7() -> *const (impl Fn(f64, f64) -> u32 + Sized) { loop {} } fn foo7() -> *const (impl Fn(f64, f64) -> u32 + Sized) { loop {} }