1
Fork 0

sort suggestions for object diagnostic

This commit is contained in:
Michael Goulet 2024-02-08 18:56:52 +00:00
parent 9322882ade
commit 540be28f6c
4 changed files with 7 additions and 6 deletions

View file

@ -178,12 +178,13 @@ pub fn report_object_safety_error<'tcx>(
)));
}
impls => {
let types = impls
let mut types = impls
.iter()
.map(|t| {
with_no_trimmed_paths!(format!(" {}", tcx.type_of(*t).instantiate_identity(),))
})
.collect::<Vec<_>>();
types.sort();
err.help(format!(
"the following types implement the trait, consider defining an enum where each \
variant holds one of these types, implementing `{}` for this new enum and using \