Skip to content

Commit

Permalink
Auto merge of rust-lang#120771 - oli-obk:useless_non_ensure_query_cal…
Browse files Browse the repository at this point in the history
…l, r=<try>

Use `ensure` when the result of the query is not needed beyond its `Result`ness

while I would like to just remove the `tcx` methods for ensure-only queries, that is hard to do without another query annotation or by turning the `define_callbacks` macro into a proc macro to get more control

should fix perf regression of rust-lang#120558
  • Loading branch information
bors committed Feb 8, 2024
2 parents 870a01a + aa6f45e commit 07e49d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/callee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn check_legal_trait_for_method_call(
};
return Err(tcx.dcx().emit_err(errors::ExplicitDestructorCall { span, sugg }));
}
tcx.coherent_trait(trait_id)
tcx.ensure().coherent_trait(trait_id)
}

#[derive(Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ fn report_conflicting_impls<'tcx>(
match used_to_be_allowed {
None => {
let reported = if overlap.with_impl.is_local()
|| tcx.orphan_check_impl(impl_def_id).is_ok()
|| tcx.ensure().orphan_check_impl(impl_def_id).is_ok()
{
let mut err = tcx.dcx().struct_span_err(impl_span, msg);
err.code(E0119);
Expand Down

0 comments on commit 07e49d4

Please sign in to comment.