Skip to content
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

Make unconditional_recursion work across function boundaries #75067

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/librustc_middle/query/mod.rs
Expand Up @@ -221,6 +221,16 @@ rustc_queries! {
}
}

/// Finds call targets in `key`s MIR body that are guaranteed to be called when the function
/// is entered.
query inevitable_calls(key: DefId) -> &'tcx [(DefId, SubstsRef<'tcx>, &'tcx [Span])] {
desc {
|tcx| "computing call targets of `{}`",
tcx.def_path_str(key),
}
no_hash
}

/// Fetch the MIR for a given `DefId` right after it's built - this includes
/// unreachable code.
query mir_built(key: ty::WithOptConstParam<LocalDefId>) -> &'tcx Steal<mir::Body<'tcx>> {
Expand All @@ -233,7 +243,7 @@ rustc_queries! {
/// See the README for the `mir` module for details.
query mir_const(key: ty::WithOptConstParam<LocalDefId>) -> &'tcx Steal<mir::Body<'tcx>> {
desc {
|tcx| "processing MIR for {}`{}`",
|tcx| "const-processing MIR for {}`{}`",
if key.const_param_did.is_some() { "the const argument " } else { "" },
tcx.def_path_str(key.did.to_def_id()),
}
Expand All @@ -254,7 +264,7 @@ rustc_queries! {
) {
no_hash
desc {
|tcx| "processing {}`{}`",
|tcx| "validating MIR for {}`{}`",
if key.const_param_did.is_some() { "the const argument " } else { "" },
tcx.def_path_str(key.did.to_def_id()),
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/steal.rs
Expand Up @@ -39,6 +39,6 @@ impl<T> Steal<T> {
pub fn steal(&self) -> T {
let value_ref = &mut *self.value.try_write().expect("stealing value which is locked");
let value = value_ref.take();
value.expect("attempt to read from stolen value")
value.expect("attempt to steal stolen value again")
}
lcnr marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 2 additions & 0 deletions src/librustc_mir/lib.rs
Expand Up @@ -38,6 +38,7 @@ mod borrow_check;
pub mod const_eval;
pub mod dataflow;
pub mod interpret;
mod lints;
pub mod monomorphize;
mod shim;
pub mod transform;
Expand All @@ -59,4 +60,5 @@ pub fn provide(providers: &mut Providers) {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::destructure_const(tcx, param_env, value)
};
providers.inevitable_calls = lints::inevitable_calls;
}