Skip to content

Better print ScalarPair when it is tuple or slice #144686

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xizheyin
Copy link
Contributor

I found (seemingly) no existing tests with it, so I comment it for internal debugging as you requested.

r? @oli-obk

@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2025

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2025

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@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 Jul 30, 2025
Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! However, I am not sure this is a good idea -- we don't want to have a ton of pretty-printing code in the interpreter that's rarely ever used. Why do you even care about the internal debug output of ImmTy?

If anything, we should instead try to make better use of the existing pretty-printing code for MIR constants. But I don't know if we have any logic for ScalarPair there...

Also, ScalarPair is a very complicated representation, as demonstrated by your code not always treating it correctly.

@xizheyin
Copy link
Contributor Author

Thanks for the reply, I came across this FIXME while reading the code and wondered if I could fix it along the way. Since the tuple is so complex, I removed the code against the tuple. Of course, I will close this PR if it is not so necessary. :)

@RalfJung
Copy link
Member

Oh, that FIXME was probably more of an off-the-cuff remark, and it is many years old.^^ It is always better to ask before just working on a random FIXME in the code. :)

@xizheyin
Copy link
Contributor Author

Yes, I noticed that it was submitted five years ago. I asked oli on zulip before submitting, thus I made this pr. 😊

p(cx, b, tcx.types.usize)
})?;

write!(f, "&[{}; {}]: {}", ptr_str, len_str, ty)?;
Copy link
Member

Choose a reason for hiding this comment

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

Do you have an example of what this looks like in the end?

It seems like it'll print something like &[ptr; 128] which is confusing because it looks like a slice repeating the pointer 128 times, when actually it is a slice of that length starting at ptr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants