1
Fork 0

Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr

Remove unnecessary impl sorting in queries and metadata

Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838

r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆

fixes #120371
This commit is contained in:
bors 2024-07-21 22:43:47 +00:00
commit 0f8534e79e
10 changed files with 75 additions and 95 deletions

View file

@ -177,13 +177,12 @@ pub fn report_object_safety_error<'tcx>(
)));
}
impls => {
let mut types = impls
let 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 \