Skip to content

Commit 5d9c694

Browse files
authored
Unrolled build for #156148
Rollup merge of #156148 - oli-obk:all_impls, r=lqd Use `all_impls` instead of handrolling it just found this while looking at other things
2 parents e95e732 + 6865172 commit 5d9c694

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

  • compiler/rustc_trait_selection/src/error_reporting/traits

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,27 +3642,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
36423642
already implement it",
36433643
with_no_trimmed_paths!(tcx.def_path_str(def_id)),
36443644
));
3645-
let impls_of = tcx.trait_impls_of(def_id);
3646-
let impls = impls_of
3647-
.non_blanket_impls()
3648-
.values()
3649-
.flatten()
3650-
.chain(impls_of.blanket_impls().iter())
3645+
let mut types = tcx
3646+
.all_impls(def_id)
3647+
.map(|t| {
3648+
with_no_trimmed_paths!(format!(
3649+
" {}",
3650+
tcx.type_of(t).instantiate_identity().skip_norm_wip(),
3651+
))
3652+
})
36513653
.collect::<Vec<_>>();
3652-
if !impls.is_empty() {
3653-
let len = impls.len();
3654-
let mut types = impls
3655-
.iter()
3656-
.map(|&&t| {
3657-
with_no_trimmed_paths!(format!(
3658-
" {}",
3659-
tcx.type_of(t)
3660-
.instantiate_identity()
3661-
.skip_norm_wip(),
3662-
))
3663-
})
3664-
.collect::<Vec<_>>();
3665-
let post = if types.len() > 9 {
3654+
if !types.is_empty() {
3655+
let len = types.len();
3656+
let post = if len > 9 {
36663657
types.truncate(8);
36673658
format!("\nand {} others", len - 8)
36683659
} else {

0 commit comments

Comments
 (0)