-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Expose more information with DefId in smir #115534
Conversation
This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino |
@@ -37,9 +37,14 @@ impl<'tcx> Context for Tables<'tcx> { | |||
}) | |||
} | |||
|
|||
fn name_of_def_id(&self, def_id: stable_mir::DefId) -> String { | |||
self.tcx.def_path_str(item_def_id(&CrateItem(def_id))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.tcx.def_path_str(item_def_id(&CrateItem(def_id))) | |
self.tcx.def_path_str(self[def_id]) |
pub struct DefId(pub(crate) usize); | ||
|
||
impl Debug for DefId { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
fmt::Debug::fmt(&format!("id:{} name:{}", self.0, with(|cx| cx.name_of_def_id(*self))), f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the Formatter
methods for printing structs and their fields.
@bors r+ rollup We'll need to do something similar for the other indexed types in the future |
Expose more information with DefId in smir Currently `Debug` for `DefId` doesn't provide enough information, this changes so that we get `usize` of the `DefId` and the name of it. r? `@oli-obk`
⌛ Testing commit 56d10a8 with merge 0a211da0d59a5a4b3df41ba6ce7783fd70099ab7... |
💔 Test failed - checks-actions |
@bors retry GitHub checkout issue |
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot)
|
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#115353 (Emit error instead of ICE when optimized MIR is missing) - rust-lang#115488 (Take `&mut Results` in `ResultsVisitor`) - rust-lang#115492 (Allow `large_assignments` for Box/Arc/Rc initialization) - rust-lang#115519 (Don't ICE on associated type projection without feature gate in new solver) - rust-lang#115534 (Expose more information with DefId in smir) r? `@ghost` `@rustbot` modify labels: rollup
Better Debug for `Ty` in smir Similar to what I did here rust-lang#115534. r? `@oli-obk`
Better Debug for `Ty` in smir Similar to what I did here rust-lang#115534. r? ``@oli-obk``
Currently
Debug
forDefId
doesn't provide enough information, this changes so that we getusize
of theDefId
and the name of it.r? @oli-obk