Show lifetime args if there are only error ones

This commit is contained in:
Aleksei Trifonov 2024-08-26 03:06:49 +03:00
parent 9dad25a7cb
commit 9d4fdc0157

View File

@ -1438,17 +1438,7 @@ fn hir_fmt_generics(
let parameters_to_write = generic_args_sans_defaults(f, generic_def, parameters);
// FIXME: Remote this
// most of our lifetimes will be errors as we lack elision and inference
// so don't render them for now
let only_err_lifetimes = !cfg!(test)
&& parameters_to_write.iter().all(|arg| {
matches!(
arg.data(Interner),
chalk_ir::GenericArgData::Lifetime(it) if *it.data(Interner) == LifetimeData::Error
)
});
if !parameters_to_write.is_empty() && !only_err_lifetimes {
if !parameters_to_write.is_empty() {
write!(f, "<")?;
hir_fmt_generic_arguments(f, parameters_to_write, self_)?;
write!(f, ">")?;
@ -1881,7 +1871,7 @@ fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
wc.hir_fmt(f)?;
write!(f, ")")?;
}
_ => write!(f, "?")?,
_ => write!(f, "_")?,
}
Ok(())
}