Skip to content

Commit 0436710

Browse files
committed
fix DepNode
Ideally, we'd have the `Ty` inserted directly in the dep-node, but since we can't do that yet, we extract the characteristic def-id of the type in question.
1 parent 9317d37 commit 0436710

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/librustc/ty/maps.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -942,22 +942,26 @@ fn relevant_trait_impls_for((def_id, _): (DefId, SimplifiedType)) -> DepNode<Def
942942
DepNode::TraitImpls(def_id)
943943
}
944944

945-
fn is_copy_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
946-
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
947-
DepNode::IsCopy(krate_def_id)
945+
fn is_copy_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
946+
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
947+
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
948+
DepNode::IsCopy(def_id)
948949
}
949950

950-
fn is_sized_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
951-
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
952-
DepNode::IsSized(krate_def_id)
951+
fn is_sized_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
952+
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
953+
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
954+
DepNode::IsSized(def_id)
953955
}
954956

955-
fn is_freeze_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
956-
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
957-
DepNode::IsSized(krate_def_id)
957+
fn is_freeze_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
958+
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
959+
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
960+
DepNode::IsFreeze(def_id)
958961
}
959962

960-
fn needs_drop_dep_node<'tcx>(_: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
961-
let krate_def_id = DefId::local(CRATE_DEF_INDEX);
962-
DepNode::NeedsDrop(krate_def_id)
963+
fn needs_drop_dep_node<'tcx>(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> DepNode<DefId> {
964+
let def_id = ty::item_path::characteristic_def_id_of_type(key.value)
965+
.unwrap_or(DefId::local(CRATE_DEF_INDEX));
966+
DepNode::NeedsDrop(def_id)
963967
}

0 commit comments

Comments
 (0)