Skip to content

Make target pointer width in target json an integer#144443

Merged
bors merged 5 commits intorust-lang:masterfrom
WaffleLapkin:integer-target-pointer-width
Aug 31, 2025
Merged

Make target pointer width in target json an integer#144443
bors merged 5 commits intorust-lang:masterfrom
WaffleLapkin:integer-target-pointer-width

Conversation

@WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented Jul 25, 2025

r? Noratrieb
cc @RalfJung (https://github.com/rust-lang/rust/pull/142352/files#r2230380120)

try-job: x86_64-rust-for-linux

@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2025

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

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 25, 2025

This PR modifies run-make tests.

cc @jieyouxu

These commits modify compiler targets.
(See the Target Tier Policy.)

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

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

I'm unsure if it's worth breaking everyone over such a minor improvement.. maybe? maybe not?

@rust-log-analyzer

This comment has been minimized.

@Noratrieb
Copy link
Member

Noratrieb commented Jul 25, 2025

I'm inclined to say yes, but it would probably be good to get this merged today so it can be in the same nightly as the other breaking change instead of two consecutive nightlies (it would also be fine to do that, but less cool)

@RalfJung
Copy link
Member

I'm unsure if it's worth breaking everyone over such a minor improvement.. maybe? maybe not?

We already did that with #144443... the current state is just inconsistent.

But, no strong opinion.

@WaffleLapkin WaffleLapkin force-pushed the integer-target-pointer-width branch from bb5b5c5 to 283f21b Compare July 25, 2025 11:55
@WaffleLapkin
Copy link
Member Author

@Noratrieb what's the other breaking change? #142352 has been merged for over a month..

@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin force-pushed the integer-target-pointer-width branch from 283f21b to 267f0bd Compare July 25, 2025 12:35
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

RalfJung commented Jul 25, 2025

@Noratrieb what's the other breaking change? #142352 has been merged for over a month..

Uh, but then why did Miri CI only start failing today?

Something changed in 9748d87...b56aaec.

@WaffleLapkin WaffleLapkin force-pushed the integer-target-pointer-width branch from b64ab4a to b2871e5 Compare July 25, 2025 13:33
@RalfJung
Copy link
Member

RalfJung commented Jul 25, 2025

The breaking change was probably #144218.

@WaffleLapkin
Copy link
Member Author

The only relevant change I see is #144218, but that doesn't explain anything, it should have been failing with #142352, I don't see how it could have accepted c-int-width being a string...

@RalfJung
Copy link
Member

It might be that the field of wrong type just got ignored, which is exactly why Nora ported this to serde.

@WaffleLapkin
Copy link
Member Author

You are right indeed. The code in #142352:

                if let Some(s) = obj.remove(name).and_then(|b| b.as_u64()) {
                    base.$key_name = s as $int_ty;
                }

and_then(|b| b.as_u64()) makes it so non-integers are ignored.

@rust-log-analyzer

This comment has been minimized.

WaffleLapkin and others added 5 commits August 27, 2025 23:44
To unblock the Rust CI in PR [1], use a temporary commit from Rust for
Linux that supports the future target spec format.

Link: rust-lang#144443 [1]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
@WaffleLapkin WaffleLapkin force-pushed the integer-target-pointer-width branch from fe01e35 to 2d8cb59 Compare August 27, 2025 21:49
@rustbot
Copy link
Collaborator

rustbot commented Aug 27, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@WaffleLapkin
Copy link
Member Author

#145909 got merged, so this should be good to go. I can't imagine what else can break ^^'

@ojeda
Copy link
Contributor

ojeda commented Aug 29, 2025

@WaffleLapkin It seems to be on S-waiting-on-author

@WaffleLapkin
Copy link
Member Author

@bors r=Noratrieb

@bors
Copy link
Collaborator

bors commented Aug 31, 2025

📌 Commit 2d8cb59 has been approved by Noratrieb

It is now in the queue for this repository.

@WaffleLapkin
Copy link
Member Author

yay :3

@koute
Copy link
Contributor

koute commented Oct 9, 2025

Just wanted to say, I'm really disappointed that such a trivial breaking charge was merged without any deprecation period and without making it just accept both forms for compatibility (which also would have been trivial), which would save a lot of pain for a lot of people. Not everyone wants to live on the bleeding edge of MSRV, and some people care that their software works on a wide range of rustc versions.

@RalfJung
Copy link
Member

RalfJung commented Oct 9, 2025 via email

@koute
Copy link
Contributor

koute commented Oct 9, 2025

Be that as it may, this is just pretty much an aesthetic change with no real practical benefit besides "it's nicer this way", it was "stable" and worked for years (even if not officially stabilized), there's no non-nightly alternative so those who need it are forced to use it, and many people depend on it. Doesn't the cost-benefit ratio here seem very skewed to you here? Sure, it would be extra work to make it temporarily accept both forms and add a lint for a few releases, but that extra work wasn't eliminated, just multiplied and pushed somewhere else, because now everyone who uses this and doesn't want to require a bleeding edge MSRV will now have to do the extra work to autodetect the compiler and support both.

Anyway, I apologize if I may seem blunt; I know you're doing a thankless job. I just wish this would have been handled better; I suppose it's too late now to do anything about it?

@RalfJung
Copy link
Member

I suppose it's too late now to do anything about it?

Someone could make a PR to accept both forms, if you still think that's useful. I think that'd be the first time we do a compatibility transition for the target JSON format so the compiler team would have to discuss whether they consider that precedent a good idea.

@Darksonn
Copy link
Member

Darksonn commented Oct 10, 2025

The target.json format changes pretty often. Three changes come to mind for me:

  • The data-layout string sometimes needs to be updated.
  • We needed to specify rustc-abi for x86 targets recently.
  • And this change with the target-pointer-width field.

So anyone using target.json with multiple compiler versions will have to use some sort of conditional logic when generating it, or just have multiple copies of it, and that's just how it is.

If this particular case is the first time it happened for you, then I understand that it seems frivolous, and if it otherwise never changed in practice I might agree. But it changes often enough that I don't think this kind of thing makes sense.

@RalfJung
Copy link
Member

Another recent change is that c_int_width was changed from a string to an integer -- that's in fact what motivated this change. (However, apparently JSON targets in the wild don't often set c_int_width so this didn't cause much fallout.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-compiler-builtins Area: compiler-builtins (https://github.com/rust-lang/compiler-builtins) A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rust-for-linux Relevant for the Rust-for-Linux project A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.