fix ICE in Definitions::create_def
This commit is contained in:
parent
e5a7d8f945
commit
d9f28b7b70
@ -338,7 +338,12 @@ pub fn new(stable_crate_id: StableCrateId) -> Definitions {
|
|||||||
|
|
||||||
/// Adds a definition with a parent definition.
|
/// Adds a definition with a parent definition.
|
||||||
pub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId {
|
pub fn create_def(&mut self, parent: LocalDefId, data: DefPathData) -> LocalDefId {
|
||||||
debug!("create_def(parent={:?}, data={:?})", parent, data);
|
// We can't use `Debug` implementation for `LocalDefId` here, since it tries to acquire a
|
||||||
|
// reference to `Definitions` and we're already holding a mutable reference.
|
||||||
|
debug!(
|
||||||
|
"create_def(parent={}, data={data:?})",
|
||||||
|
self.def_path(parent).to_string_no_crate_verbose(),
|
||||||
|
);
|
||||||
|
|
||||||
// The root node must be created with `create_root_def()`.
|
// The root node must be created with `create_root_def()`.
|
||||||
assert!(data != DefPathData::CrateRoot);
|
assert!(data != DefPathData::CrateRoot);
|
||||||
|
@ -1459,11 +1459,11 @@ pub fn def_path_debug_str(self, def_id: DefId) -> String {
|
|||||||
};
|
};
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
"{}[{}]{}",
|
"{}[{:04x}]{}",
|
||||||
crate_name,
|
crate_name,
|
||||||
// Don't print the whole stable crate id. That's just
|
// Don't print the whole stable crate id. That's just
|
||||||
// annoying in debug output.
|
// annoying in debug output.
|
||||||
&(format!("{:08x}", stable_crate_id.to_u64()))[..4],
|
stable_crate_id.to_u64() >> 8 * 6,
|
||||||
self.def_path(def_id).to_string_no_crate_verbose()
|
self.def_path(def_id).to_string_no_crate_verbose()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user