Skip to content

Commit 99292c9

Browse files
Remove logic in one_bound in astconv that prefers non-const bounds
1 parent 6203fca commit 99292c9

File tree

1 file changed

+2
-33
lines changed
  • compiler/rustc_hir_analysis/src/astconv

1 file changed

+2
-33
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

+2-33
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
10321032
self.trait_defines_associated_item_named(r.def_id(), assoc_kind, assoc_name)
10331033
});
10341034

1035-
let Some(mut bound) = matching_candidates.next() else {
1035+
let Some(bound) = matching_candidates.next() else {
10361036
let reported = self.complain_about_assoc_item_not_found(
10371037
all_candidates,
10381038
&ty_param_name.to_string(),
@@ -1046,38 +1046,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
10461046
};
10471047
debug!(?bound);
10481048

1049-
// look for a candidate that is not the same as our first bound, disregarding
1050-
// whether the bound is const.
1051-
let mut next_cand = matching_candidates.next();
1052-
while let Some(mut bound2) = next_cand {
1053-
debug!(?bound2);
1054-
if bound2.bound_vars() != bound.bound_vars() {
1055-
break;
1056-
}
1057-
1058-
let generics = tcx.generics_of(bound.def_id());
1059-
let Some(host_index) = generics.host_effect_index else { break };
1060-
1061-
// always return the bound that contains the host param.
1062-
if let ty::ConstKind::Param(_) = bound2.skip_binder().args.const_at(host_index).kind() {
1063-
(bound, bound2) = (bound2, bound);
1064-
}
1065-
1066-
let unconsted_args = bound
1067-
.skip_binder()
1068-
.args
1069-
.iter()
1070-
.enumerate()
1071-
.map(|(n, arg)| if host_index == n { tcx.consts.true_.into() } else { arg });
1072-
1073-
if unconsted_args.eq(bound2.skip_binder().args.iter()) {
1074-
next_cand = matching_candidates.next();
1075-
} else {
1076-
break;
1077-
}
1078-
}
1079-
1080-
if let Some(bound2) = next_cand {
1049+
if let Some(bound2) = matching_candidates.next() {
10811050
debug!(?bound2);
10821051

10831052
let assoc_kind_str = assoc_kind_str(assoc_kind);

0 commit comments

Comments
 (0)