Skip to content

Merge mir query analysis invocations #140856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
let span = tcx.def_span(impl_did);
let trait_name = "DispatchFromDyn";

let dispatch_from_dyn_trait = tcx.require_lang_item(LangItem::DispatchFromDyn, Some(span));

let source = trait_ref.self_ty();
let target = {
assert_eq!(trait_ref.def_id, dispatch_from_dyn_trait);
assert!(tcx.is_lang_item(trait_ref.def_id, LangItem::DispatchFromDyn));

trait_ref.args.type_at(1)
};
Expand Down Expand Up @@ -339,7 +337,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
tcx,
cause.clone(),
param_env,
ty::TraitRef::new(tcx, dispatch_from_dyn_trait, [ty_a, ty_b]),
ty::TraitRef::new(tcx, trait_ref.def_id, [ty_a, ty_b]),
));
let errors = ocx.select_all_or_error();
if !errors.is_empty() {
Expand Down
22 changes: 11 additions & 11 deletions compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,6 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
let _: R = tcx.ensure_ok().crate_inherent_impls_overlap_check(());
});

if tcx.features().rustc_attrs() {
tcx.sess.time("dumping_rustc_attr_data", || {
outlives::dump::inferred_outlives(tcx);
variance::dump::variances(tcx);
collect::dump::opaque_hidden_types(tcx);
collect::dump::predicates_and_item_bounds(tcx);
collect::dump::def_parents(tcx);
collect::dump::vtables(tcx);
});
}

// Make sure we evaluate all static and (non-associated) const items, even if unused.
// If any of these fail to evaluate, we do not want this crate to pass compilation.
tcx.par_hir_body_owners(|item_def_id| {
Expand Down Expand Up @@ -233,6 +222,17 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
}
});

if tcx.features().rustc_attrs() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dump attrs stuff later? I'm not opposed, just there's no motivation given.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make space there to merge the parallel blocks before and after

tcx.sess.time("dumping_rustc_attr_data", || {
outlives::dump::inferred_outlives(tcx);
variance::dump::variances(tcx);
collect::dump::opaque_hidden_types(tcx);
collect::dump::predicates_and_item_bounds(tcx);
collect::dump::def_parents(tcx);
collect::dump::vtables(tcx);
});
}

tcx.ensure_ok().check_unused_traits(());
}

Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir_typeck/src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1080,15 +1080,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

// Check that this is a projection from the `Future` trait.
let trait_def_id = predicate.projection_term.trait_def_id(self.tcx);
let future_trait = self.tcx.require_lang_item(LangItem::Future, Some(cause_span));
if trait_def_id != future_trait {
if !self.tcx.is_lang_item(trait_def_id, LangItem::Future) {
debug!("deduce_future_output_from_projection: not a future");
return None;
}

// The `Future` trait has only one associated item, `Output`,
// so check that this is what we see.
let output_assoc_item = self.tcx.associated_item_def_ids(future_trait)[0];
let output_assoc_item = self.tcx.associated_item_def_ids(trait_def_id)[0];
if output_assoc_item != predicate.projection_term.def_id {
span_bug!(
cause_span,
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,10 +1002,6 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
if !tcx.is_typeck_child(def_id.to_def_id()) {
tcx.ensure_ok().mir_borrowck(def_id)
}
});
});
sess.time("MIR_effect_checking", || {
tcx.par_hir_body_owners(|def_id| {
tcx.ensure_ok().has_ffi_unwind_calls(def_id);

// If we need to codegen, ensure that we emit all errors from
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,7 @@ impl<'tcx> Ty<'tcx> {
return true;
};
alloc.expect_ty().ty_adt_def().is_some_and(|alloc_adt| {
let global_alloc = tcx.require_lang_item(LangItem::GlobalAlloc, None);
alloc_adt.did() == global_alloc
tcx.is_lang_item(alloc_adt.did(), LangItem::GlobalAlloc)
})
}
_ => false,
Expand Down
Loading