-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl. #66907
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
if did.index == CRATE_DEF_INDEX { | ||
write!(f, "BrNamed({})", name) | ||
} else { | ||
write!(f, "BrNamed({:?}, {})", did, name) |
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.
Not sure if this is easily done, but can you eliminate the Defid(foobar)
wrapping? Just the content seems fine since this is already wrapped in a BrNamed
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.
It's rare enough that I don't want to touch that right now.
Ideally this would print a proper path, and it still probably could using ty::tls::with
or w/e, but also DefId
printout could be better in general.
r? @oli-obk |
@bors r+ |
📌 Commit 9034efe has been approved by |
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl. Context: these `fmt::Debug` impls only get used with `-Z verbose` (which some tests use). I was going to print the path like in rust-lang#66850 (or rather, use `DefId`'s `fmt::Debug`, which is close but not as nice), but then I realized that most of the `DefId`s were `crate0:DefIndex(0)`, i.e. the crate root. As the crate root is not a lifetime, they're clearly dummies of some sort, and we don't have to print anything other than the name for them. This means that out of all the tests, there's only 5 instances of `BrNamed` that now print the full path to the lifetime parameter, and everything else is shorter instead, which doesn't feel too bad. cc @nikomatsakis
Rollup of 7 pull requests Successful merges: - #66346 (Replace .unwrap() with ? in std::os::unix::net) - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.) - #66822 (libunwind_panic: adjust miri panic hack) - #66827 (handle diverging functions forwarding their return place) - #66828 (Less minification) - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.) - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.) Failed merges: - #66874 (Miri engine: proper support for `Assert` MIR terminators) r? @ghost
Rollup of 7 pull requests Successful merges: - #66346 (Replace .unwrap() with ? in std::os::unix::net) - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.) - #66822 (libunwind_panic: adjust miri panic hack) - #66827 (handle diverging functions forwarding their return place) - #66828 (Less minification) - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.) - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.) Failed merges: - #66874 (Miri engine: proper support for `Assert` MIR terminators) r? @ghost
rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl. Context: these `fmt::Debug` impls only get used with `-Z verbose` (which some tests use). I was going to print the path like in rust-lang#66850 (or rather, use `DefId`'s `fmt::Debug`, which is close but not as nice), but then I realized that most of the `DefId`s were `crate0:DefIndex(0)`, i.e. the crate root. As the crate root is not a lifetime, they're clearly dummies of some sort, and we don't have to print anything other than the name for them. This means that out of all the tests, there's only 5 instances of `BrNamed` that now print the full path to the lifetime parameter, and everything else is shorter instead, which doesn't feel too bad. cc @nikomatsakis
Rollup of 7 pull requests Successful merges: - #66346 (Replace .unwrap() with ? in std::os::unix::net) - #66789 (rustc: move mir::SourceScopeLocalData to a field of SourceScopeData.) - #66850 (rustc: hide HirId's fmt::Debug output from -Z span_free_formats.) - #66905 (rustc_plugin: Remove some remaining plugin features) - #66907 (rustc: don't just show raw DefIndex's in BrNamed's fmt::Debug impl.) - #66918 (Add crc and crypto to target feature whitelist on arm) - #66926 (add reusable MachineStop variant to Miri engine error enum) Failed merges: r? @ghost
☔ The latest upstream changes (presumably #66944) made this pull request unmergeable. Please resolve the merge conflicts. |
…wjasper rustc_mir: use nicer path printing for #[rustc_regions] NLL tests. Similar to rust-lang#66850, spotted while working on rust-lang#66907. r? @matthewjasper
rustc_mir: use nicer path printing for #[rustc_regions] NLL tests. Similar to #66850, spotted while working on #66907. r? @matthewjasper
Context: these
fmt::Debug
impls only get used with-Z verbose
(which some tests use).I was going to print the path like in #66850 (or rather, use
DefId
'sfmt::Debug
, which is close but not as nice), but then I realized that most of theDefId
s werecrate0:DefIndex(0)
, i.e. the crate root.As the crate root is not a lifetime, they're clearly dummies of some sort, and we don't have to print anything other than the name for them.
This means that out of all the tests, there's only 5 instances of
BrNamed
that now print the full path to the lifetime parameter, and everything else is shorter instead, which doesn't feel too bad.cc @nikomatsakis