mirror of
https://github.com/rust-lang/rust
synced 2024-10-22 00:14:09 +00:00
Prevent potential bug resulting from changing crate_hash query name
This commit is contained in:
parent
0962e5eba9
commit
8e7cbc28a6
|
@ -47,7 +47,8 @@ pub fn provide_extern(providers: &mut Providers) {
|
|||
// External query providers call `crate_hash` in order to register a dependency
|
||||
// on the crate metadata. The exception is `crate_hash` itself, which obviously
|
||||
// doesn't need to do this (and can't, as it would cause a query cycle).
|
||||
if stringify!($name) != "crate_hash" && $tcx.dep_graph.is_fully_enabled() {
|
||||
use rustc_middle::dep_graph::DepKind;
|
||||
if DepKind::$name != DepKind::crate_hash && $tcx.dep_graph.is_fully_enabled() {
|
||||
$tcx.ensure().crate_hash($def_id.krate);
|
||||
}
|
||||
|
||||
|
|
|
@ -1220,6 +1220,8 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
|
|||
eval_always
|
||||
desc { "looking up the disambiguator a crate" }
|
||||
}
|
||||
// The macro which defines `rustc_metadata::provide_extern` depends on this query's name.
|
||||
// Changing the name should cause a compiler error, but in case that changes, be aware.
|
||||
query crate_hash(_: CrateNum) -> Svh {
|
||||
eval_always
|
||||
desc { "looking up the hash a crate" }
|
||||
|
|
Loading…
Reference in a new issue