Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ICE in Definitions::create_def #99340

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion compiler/rustc_hir/src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,12 @@ impl Definitions {

/// Adds a definition with a parent definition.
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()`.
assert!(data != DefPathData::CrateRoot);
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,11 +1459,11 @@ impl<'tcx> TyCtxt<'tcx> {
};

format!(
"{}[{}]{}",
"{}[{:04x}]{}",
crate_name,
// Don't print the whole stable crate id. That's just
// 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()
)
}
Expand Down