Skip to content

Commit 07e49d4

Browse files
committed
Auto merge of rust-lang#120771 - oli-obk:useless_non_ensure_query_call, 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
2 parents 870a01a + aa6f45e commit 07e49d4

File tree

2 files changed

+2
-2
lines changed
  • compiler
    • rustc_hir_typeck/src
    • rustc_trait_selection/src/traits/specialize

2 files changed

+2
-2
lines changed

compiler/rustc_hir_typeck/src/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn check_legal_trait_for_method_call(
5353
};
5454
return Err(tcx.dcx().emit_err(errors::ExplicitDestructorCall { span, sugg }));
5555
}
56-
tcx.coherent_trait(trait_id)
56+
tcx.ensure().coherent_trait(trait_id)
5757
}
5858

5959
#[derive(Debug)]

compiler/rustc_trait_selection/src/traits/specialize/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ fn report_conflicting_impls<'tcx>(
446446
match used_to_be_allowed {
447447
None => {
448448
let reported = if overlap.with_impl.is_local()
449-
|| tcx.orphan_check_impl(impl_def_id).is_ok()
449+
|| tcx.ensure().orphan_check_impl(impl_def_id).is_ok()
450450
{
451451
let mut err = tcx.dcx().struct_span_err(impl_span, msg);
452452
err.code(E0119);

0 commit comments

Comments
 (0)