Skip to content

Commit a38e3d4

Browse files
authored
Rollup merge of #150825 - move-items, r=JonathanBrouwer
Query associated_item_def_ids when needed This commit moves a query to `associated_item_defs` from above an error condition caused independently of it to below it. It looks generally cleaner and might potentially save some runtime in case the error condition is met, rendering `items` to be left unused, yet still queried.
2 parents 4f4aaf6 + 1eb605f commit a38e3d4

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,12 @@ impl<'tcx> InherentCollect<'tcx> {
7979
}
8080

8181
if self.tcx.features().rustc_attrs() {
82-
let items = self.tcx.associated_item_def_ids(impl_def_id);
83-
8482
if !self.tcx.has_attr(ty_def_id, sym::rustc_has_incoherent_inherent_impls) {
8583
let impl_span = self.tcx.def_span(impl_def_id);
8684
return Err(self.tcx.dcx().emit_err(errors::InherentTyOutside { span: impl_span }));
8785
}
8886

87+
let items = self.tcx.associated_item_def_ids(impl_def_id);
8988
for &impl_item in items {
9089
if !find_attr!(
9190
self.tcx.get_all_attrs(impl_item),

0 commit comments

Comments
 (0)