Rename panic_strategy
query to required_panic_strategy
This commit is contained in:
parent
9e6c044ee6
commit
14d155a3dc
8 changed files with 13 additions and 14 deletions
|
@ -744,7 +744,7 @@ impl<'a> CrateLoader<'a> {
|
||||||
if !data.is_panic_runtime() {
|
if !data.is_panic_runtime() {
|
||||||
self.sess.err(&format!("the crate `{}` is not a panic runtime", name));
|
self.sess.err(&format!("the crate `{}` is not a panic runtime", name));
|
||||||
}
|
}
|
||||||
if data.panic_strategy() != Some(desired_strategy) {
|
if data.required_panic_strategy() != Some(desired_strategy) {
|
||||||
self.sess.err(&format!(
|
self.sess.err(&format!(
|
||||||
"the crate `{}` does not have the panic \
|
"the crate `{}` does not have the panic \
|
||||||
strategy `{}`",
|
strategy `{}`",
|
||||||
|
|
|
@ -368,7 +368,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
|
||||||
}
|
}
|
||||||
panic_runtime = Some((
|
panic_runtime = Some((
|
||||||
cnum,
|
cnum,
|
||||||
tcx.panic_strategy(cnum).unwrap_or_else(|| {
|
tcx.required_panic_strategy(cnum).unwrap_or_else(|| {
|
||||||
bug!("cannot determine panic strategy of a panic runtime");
|
bug!("cannot determine panic strategy of a panic runtime");
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
|
@ -406,7 +406,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(found_strategy) = tcx.panic_strategy(cnum) && desired_strategy != found_strategy {
|
if let Some(found_strategy) = tcx.required_panic_strategy(cnum) && desired_strategy != found_strategy {
|
||||||
sess.err(&format!(
|
sess.err(&format!(
|
||||||
"the crate `{}` requires \
|
"the crate `{}` requires \
|
||||||
panic strategy `{}` which is \
|
panic strategy `{}` which is \
|
||||||
|
|
|
@ -1759,8 +1759,8 @@ impl CrateMetadata {
|
||||||
self.dep_kind.with_lock(|dep_kind| *dep_kind = f(*dep_kind))
|
self.dep_kind.with_lock(|dep_kind| *dep_kind = f(*dep_kind))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn panic_strategy(&self) -> Option<PanicStrategy> {
|
pub(crate) fn required_panic_strategy(&self) -> Option<PanicStrategy> {
|
||||||
self.root.panic_strategy
|
self.root.required_panic_strategy
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn needs_panic_runtime(&self) -> bool {
|
pub(crate) fn needs_panic_runtime(&self) -> bool {
|
||||||
|
|
|
@ -246,7 +246,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
||||||
has_global_allocator => { cdata.root.has_global_allocator }
|
has_global_allocator => { cdata.root.has_global_allocator }
|
||||||
has_panic_handler => { cdata.root.has_panic_handler }
|
has_panic_handler => { cdata.root.has_panic_handler }
|
||||||
is_profiler_runtime => { cdata.root.profiler_runtime }
|
is_profiler_runtime => { cdata.root.profiler_runtime }
|
||||||
panic_strategy => { cdata.root.panic_strategy }
|
required_panic_strategy => { cdata.root.required_panic_strategy }
|
||||||
panic_in_drop_strategy => { cdata.root.panic_in_drop_strategy }
|
panic_in_drop_strategy => { cdata.root.panic_in_drop_strategy }
|
||||||
extern_crate => {
|
extern_crate => {
|
||||||
let r = *cdata.extern_crate.lock();
|
let r = *cdata.extern_crate.lock();
|
||||||
|
|
|
@ -665,7 +665,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||||
triple: tcx.sess.opts.target_triple.clone(),
|
triple: tcx.sess.opts.target_triple.clone(),
|
||||||
hash: tcx.crate_hash(LOCAL_CRATE),
|
hash: tcx.crate_hash(LOCAL_CRATE),
|
||||||
stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(),
|
stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(),
|
||||||
panic_strategy: tcx.required_panic_strategy(()),
|
required_panic_strategy: tcx.required_panic_strategy(LOCAL_CRATE),
|
||||||
panic_in_drop_strategy: tcx.sess.opts.debugging_opts.panic_in_drop,
|
panic_in_drop_strategy: tcx.sess.opts.debugging_opts.panic_in_drop,
|
||||||
edition: tcx.sess.edition(),
|
edition: tcx.sess.edition(),
|
||||||
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
|
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
|
||||||
|
|
|
@ -217,7 +217,7 @@ pub(crate) struct CrateRoot {
|
||||||
extra_filename: String,
|
extra_filename: String,
|
||||||
hash: Svh,
|
hash: Svh,
|
||||||
stable_crate_id: StableCrateId,
|
stable_crate_id: StableCrateId,
|
||||||
panic_strategy: Option<PanicStrategy>,
|
required_panic_strategy: Option<PanicStrategy>,
|
||||||
panic_in_drop_strategy: PanicStrategy,
|
panic_in_drop_strategy: PanicStrategy,
|
||||||
edition: Edition,
|
edition: Edition,
|
||||||
has_global_allocator: bool,
|
has_global_allocator: bool,
|
||||||
|
|
|
@ -1369,10 +1369,7 @@ rustc_queries! {
|
||||||
desc { |tcx| "check if `{}` contains FFI-unwind calls", tcx.def_path_str(key.to_def_id()) }
|
desc { |tcx| "check if `{}` contains FFI-unwind calls", tcx.def_path_str(key.to_def_id()) }
|
||||||
cache_on_disk_if { true }
|
cache_on_disk_if { true }
|
||||||
}
|
}
|
||||||
query required_panic_strategy(_: ()) -> Option<PanicStrategy> {
|
query required_panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
|
||||||
desc { "compute the required panic strategy for the current crate" }
|
|
||||||
}
|
|
||||||
query panic_strategy(_: CrateNum) -> Option<PanicStrategy> {
|
|
||||||
fatal_cycle
|
fatal_cycle
|
||||||
desc { "query a crate's required panic strategy" }
|
desc { "query a crate's required panic strategy" }
|
||||||
separate_provide_extern
|
separate_provide_extern
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
|
use rustc_hir::def_id::{CrateNum, LocalDefId, LOCAL_CRATE};
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::layout;
|
use rustc_middle::ty::layout;
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
|
@ -123,7 +123,9 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
|
||||||
tainted
|
tainted
|
||||||
}
|
}
|
||||||
|
|
||||||
fn required_panic_strategy(tcx: TyCtxt<'_>, (): ()) -> Option<PanicStrategy> {
|
fn required_panic_strategy(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<PanicStrategy> {
|
||||||
|
assert_eq!(cnum, LOCAL_CRATE);
|
||||||
|
|
||||||
if tcx.is_panic_runtime(LOCAL_CRATE) {
|
if tcx.is_panic_runtime(LOCAL_CRATE) {
|
||||||
return Some(tcx.sess.panic_strategy());
|
return Some(tcx.sess.panic_strategy());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue