Skip to content

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Sep 4, 2023

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 4, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2023

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)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Contributor

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.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 4, 2023

@bors r+ rollup

We'll need to do something similar for the other indexed types in the future

@bors
Copy link
Collaborator

bors commented Sep 4, 2023

📌 Commit 56d10a8 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 4, 2023
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`
@bors
Copy link
Collaborator

bors commented Sep 5, 2023

⌛ Testing commit 56d10a8 with merge 0a211da0d59a5a4b3df41ba6ce7783fd70099ab7...

@bors
Copy link
Collaborator

bors commented Sep 5, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 5, 2023
@ehuss
Copy link
Contributor

ehuss commented Sep 5, 2023

@bors retry

GitHub checkout issue

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2023
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744)
##[error]Can't use 'tar -xzf' extract archive file: /gha/_work/_actions/_temp_272903c4-8b81-4f48-8af1-3259f0174c3a/1cfb9426-47aa-4dda-b07f-79a746757996.tar.gz. return code: 2.

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 5, 2023
…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
@bors bors merged commit 03853d5 into rust-lang:master Sep 5, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 5, 2023
@ouz-a ouz-a deleted the smir_def branch September 6, 2023 09:55
fmease added a commit to fmease/rust that referenced this pull request Sep 6, 2023
Better Debug for `Ty` in smir

Similar to what I did here rust-lang#115534.

r? `@oli-obk`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 6, 2023
Better Debug for `Ty` in smir

Similar to what I did here rust-lang#115534.

r? ``@oli-obk``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants