Auto merge of #120771 - oli-obk:useless_non_ensure_query_call, r=davidtwco

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 https://github.com/rust-lang/rust/pull/120558
This commit is contained in:
bors 2024-02-10 09:27:14 +00:00
commit 232919c33a
2 changed files with 2 additions and 2 deletions

View File

@ -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)]

View File

@ -446,7 +446,7 @@ fn decorate<'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);