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 7ea4241afa
commit f1b4a9cfb0

View file

@ -1438,17 +1438,7 @@ fn hir_fmt_generics(
let parameters_to_write = generic_args_sans_defaults(f, generic_def, parameters); let parameters_to_write = generic_args_sans_defaults(f, generic_def, parameters);
// FIXME: Remote this if !parameters_to_write.is_empty() {
// 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 {
write!(f, "<")?; write!(f, "<")?;
hir_fmt_generic_arguments(f, parameters_to_write, self_)?; hir_fmt_generic_arguments(f, parameters_to_write, self_)?;
write!(f, ">")?; write!(f, ">")?;
@ -1881,7 +1871,7 @@ impl HirDisplay for DomainGoal {
wc.hir_fmt(f)?; wc.hir_fmt(f)?;
write!(f, ")")?; write!(f, ")")?;
} }
_ => write!(f, "?")?, _ => write!(f, "_")?,
} }
Ok(()) Ok(())
} }