1
Fork 0

Prevent potential bug resulting from changing crate_hash query name

This commit is contained in:
Tyson Nottingham 2021-01-11 13:31:43 -08:00
parent 0962e5eba9
commit 8e7cbc28a6
2 changed files with 4 additions and 1 deletions

View file

@ -47,7 +47,8 @@ macro_rules! provide {
// 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);
}