-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Format fat pointers as (addr, meta) for better insight. #84927
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
brb trying to reproduce that CI failure locally... |
This comment has been minimized.
This comment has been minimized.
huh. I guess that's what I get for messing with lang items... |
@SimonSapin can I bug you with help with this one? I must've upset the metadata/ EDIT: Ok my best guess is when compiling the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9d04180
to
9b08851
Compare
This comment has been minimized.
This comment has been minimized.
Hmm I don’t know what to do about this ICE. I don’t find the
Can you reproduce with Implementation bugs aside, @rust-lang/libs what do you think of this change? In particular:
|
@SimonSapin I was unable to reproduce the ICE locally. But I found the line at the commit the beta compiler is based off and it's in ty::Instance::resolve_for_vtable(
tcx,
ty::ParamEnv::reveal_all(),
def_id,
substs,
)
.unwrap() |
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.
what do you think of this change? In particular:
- The compatibility of changing the output of
Debug
for raw pointers- Adding a new bound to the
Pointee::Metadata
associated type
I am on board with these.
I would consider a format like:
{0x0000560e5f2fe005, metadata: 4}
which gives some better guidance what the person is even looking at when seeing this in debug output, versus the current (0x0000560e5f2fe005, 4)
.
I love it
I see no problems with it, given our stability policy for
I also see no problems here. Since this is still an unstable API and like @vojtechkral said the existing types already all implemented
seconding this |
@yaahc I've also changed |
That should be fine, as far as I know that |
@vojtechkral , any luck tracking down that ICE? |
@bstrie No and honestly I haven't worked on this PR in a while. But I plan to come back to it an re-try 🙂 |
Changing Also, with the current implementation in this PR, |
Use the new ptr::metadata() fn to improve debug prints of fat pointers. Pointee::Metadata gets an additional Debug bound, impls already implemented it anyway.
9b08851
to
0bca351
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
@vojtechkral Ping from triage, CI is still red, mind fixing it? |
@crlf0710 Sorry, I'm not doing great in the free time departement at the moment :-( |
superseded by #93544 |
Now that we have
ptr::metadata()
I thought it would be nice to be able to see the meta part of fat ptrs in debug prints.In past I'd run into a couple of situations where I needed to see the second part as well and this
is curretly kind of cumbersome / requiresActually, withunsafe
transmutes IIRCmetadata()
this is a lot easier now, but still, having this inDebug
is IMO better...cc #81513 - I've added the
Debug
constrain toPointee::Metadata
(impls already implement it).Not sure if there's a backcompat concern?
I really do hope people don't rely on debug prints of pointers, but one never knows...
Let me know what you think 🙂