Show and render error lifetime args as '_
This commit is contained in:
parent
e0b1719171
commit
9dad25a7cb
@ -1523,18 +1523,6 @@ fn hir_fmt_generic_arguments(
|
|||||||
None => (parameters, &[][..]),
|
None => (parameters, &[][..]),
|
||||||
};
|
};
|
||||||
for generic_arg in lifetimes.iter().chain(ty_or_const) {
|
for generic_arg in lifetimes.iter().chain(ty_or_const) {
|
||||||
// FIXME: Remove this
|
|
||||||
// most of our lifetimes will be errors as we lack elision and inference
|
|
||||||
// so don't render them for now
|
|
||||||
if !cfg!(test)
|
|
||||||
&& matches!(
|
|
||||||
generic_arg.lifetime(Interner),
|
|
||||||
Some(l) if ***l.interned() == LifetimeData::Error
|
|
||||||
)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !mem::take(&mut first) {
|
if !mem::take(&mut first) {
|
||||||
write!(f, ", ")?;
|
write!(f, ", ")?;
|
||||||
}
|
}
|
||||||
@ -1872,7 +1860,13 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
|||||||
LifetimeData::BoundVar(idx) => idx.hir_fmt(f),
|
LifetimeData::BoundVar(idx) => idx.hir_fmt(f),
|
||||||
LifetimeData::InferenceVar(_) => write!(f, "_"),
|
LifetimeData::InferenceVar(_) => write!(f, "_"),
|
||||||
LifetimeData::Static => write!(f, "'static"),
|
LifetimeData::Static => write!(f, "'static"),
|
||||||
LifetimeData::Error => write!(f, "'?"),
|
LifetimeData::Error => {
|
||||||
|
if cfg!(test) {
|
||||||
|
write!(f, "'?")
|
||||||
|
} else {
|
||||||
|
write!(f, "'_")
|
||||||
|
}
|
||||||
|
}
|
||||||
LifetimeData::Erased => write!(f, "'<erased>"),
|
LifetimeData::Erased => write!(f, "'<erased>"),
|
||||||
LifetimeData::Phantom(void, _) => match *void {},
|
LifetimeData::Phantom(void, _) => match *void {},
|
||||||
}
|
}
|
||||||
|
@ -5649,7 +5649,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);
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
@ -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<{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<{unknown}, _>
|
st Foo<…> Foo<'_, {unknown}, _>
|
||||||
st Record Record
|
st Record Record
|
||||||
st Tuple Tuple
|
st Tuple Tuple
|
||||||
st Unit Unit
|
st Unit Unit
|
||||||
|
@ -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<{unknown}, _>
|
sp Self Foo<'_, {unknown}, _>
|
||||||
st Foo<…> Foo<{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<{unknown}, _>
|
sp Self Foo<'_, {unknown}, _>
|
||||||
st Foo<…> Foo<{unknown}, _>
|
st Foo<…> Foo<'_, {unknown}, _>
|
||||||
st Record Record
|
st Record Record
|
||||||
st Tuple Tuple
|
st Tuple Tuple
|
||||||
st Unit Unit
|
st Unit Unit
|
||||||
|
@ -342,7 +342,7 @@ fn f<'a>() {
|
|||||||
let x = S::<'static>;
|
let x = S::<'static>;
|
||||||
//^ S<'static>
|
//^ S<'static>
|
||||||
let y = S::<'_>;
|
let y = S::<'_>;
|
||||||
//^ S
|
//^ S<'_>
|
||||||
let z = S::<'a>;
|
let z = S::<'a>;
|
||||||
//^ S<'a>
|
//^ S<'a>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user