-
Notifications
You must be signed in to change notification settings - Fork 2.6k
test: avoid hardcoded target spec json #15880
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
Conversation
Instead of having a specific target json file would an option be to ask rustc for the target json file of an existing target and just remove the is-builtim flag before passing it back to cargo? That way it will remain correct even if the target json spec format changes in any way other than renaming the is-builtin field. |
@bjorn3 good idea, though where is the $ rustc +nightly --print target-spec-json -Zunstable-options --target wasm32-unknown-unknown
{
"arch": "wasm32",
"binary-format": "wasm",
"crt-objects-fallback": "true",
"data-layout": "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20",
"dll-prefix": "",
"dll-suffix": ".wasm",
"dynamic-linking": true,
"eh-frame-header": false,
"emit-debug-gdb-scripts": false,
"exe-suffix": ".wasm",
"generate-arange-section": false,
"has-thread-local": true,
"is-like-wasm": true,
"limit-rdylib-exports": false,
"linker": "rust-lld",
"linker-flavor": "wasm-lld",
"linker-is-gnu": false,
"lld-flavor": "wasm",
"llvm-target": "wasm32-unknown-unknown",
"max-atomic-width": 64,
"metadata": {
"description": "WebAssembly",
"host_tools": false,
"std": true,
"tier": 2
},
"only-cdylib": true,
"os": "unknown",
"panic-strategy": "abort",
"pre-link-args": {
"wasm-lld": [
"-z",
"stack-size=1048576",
"--stack-first",
"--allow-undefined",
"--no-demangle",
"--no-entry"
],
"wasm-lld-cc": [
"-Wl,-z",
"-Wl,stack-size=1048576",
"-Wl,--stack-first",
"-Wl,--allow-undefined",
"-Wl,--no-demangle",
"--target=wasm32-unknown-unknown",
"-Wl,--no-entry"
]
},
"relocation-model": "static",
"singlethread": true,
"target-family": [
"wasm"
],
"target-pointer-width": "32",
"tls-model": "local-exec"
} |
e42c164
to
5c706e8
Compare
I should go ahead and remove _all" hardcoded target spec jsons. |
5c706e8
to
6b907f0
Compare
Read a real target spec JSON so we no longer need to hardcode a target spec JSON here. Cargo itself should not care about the spec schema. Let's stop bothering compiler contributors.
6b907f0
to
56f44bb
Compare
I guess rustc itself nowadays already filters out the is-builtin field before printing. |
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.
This matches the changes that I did locally (i.e. it fixes all the places that I fixed).
Retried an succeeded. Merging. |
Update cargo submodule 3 commits in 623d536836b4cde09ce38609232a024d5b25da81..a6c58d43051d01d83f55a3e61ef5f5b2b0dd6bd9 2025-08-22 19:05:52 +0000 to 2025-08-26 23:05:12 +0000 - test: avoid hardcoded target spec json (rust-lang/cargo#15880) - test(add): Cover some frontmatter corner cases (rust-lang/cargo#15886) - Add more context to publish-failed error message (rust-lang/cargo#15879) r? ghost
Update cargo submodule 3 commits in 623d536836b4cde09ce38609232a024d5b25da81..a6c58d43051d01d83f55a3e61ef5f5b2b0dd6bd9 2025-08-22 19:05:52 +0000 to 2025-08-26 23:05:12 +0000 - test: avoid hardcoded target spec json (rust-lang/cargo#15880) - test(add): Cover some frontmatter corner cases (rust-lang/cargo#15886) - Add more context to publish-failed error message (rust-lang/cargo#15879) r? ghost
Update cargo submodule 3 commits in 623d536836b4cde09ce38609232a024d5b25da81..a6c58d43051d01d83f55a3e61ef5f5b2b0dd6bd9 2025-08-22 19:05:52 +0000 to 2025-08-26 23:05:12 +0000 - test: avoid hardcoded target spec json (rust-lang/cargo#15880) - test(add): Cover some frontmatter corner cases (rust-lang/cargo#15886) - Add more context to publish-failed error message (rust-lang/cargo#15879) r? ghost
Read a real target spec JSON so we no longer need to hardcode
a target spec JSON here.
Cargo itself should not care about the spec schema.
Let's stop bothering compiler contributors.