Skip to content

Add unstable --print=supported-crate-types option - #138641

Merged
bors merged 4 commits into
rust-lang:masterfrom
jieyouxu:print-supported-crate-types
Mar 24, 2025
Merged

Add unstable --print=supported-crate-types option#138641
bors merged 4 commits into
rust-lang:masterfrom
jieyouxu:print-supported-crate-types

Conversation

@jieyouxu

@jieyouxujieyouxu commented Mar 18, 2025

Copy link
Copy Markdown
Member

MCP: rust-lang/compiler-team#836
Tracking issue: #138640

Test coverage

Two tests:

  1. tests/ui/print-request/stability.rs to check that --print=supported-crate-types is -Zunstable-options-gated
  2. tests/ui/print-request/supported-crate-types.rs is added as a basic smoke test. Observe that the compiler stdout corresponds to the below Example output section (e.g. proc-macro is unsupported on wasm32-unknown-unknown currently).

Example output

For `x86_64-unknown-linux-gnu`

Notice the presence of {c,}dylib and proc-macro:

bin
cdylib
dylib
lib
proc-macro
rlib
staticlib
For `wasm32-unknown-unknown`

Notice the absence of dylib and proc-macro:

bin
cdylib
lib
rlib
staticlib
For `x86_64-unknown-linux-musl`

Notice the absence of {c,}dylib but presence of proc-macro:

bin
lib
proc-macro
rlib
staticlib

Documentation

I added an entry in the unstable book's print request section to document this supported-crate-types print request.

Unresolved questions

  • (Name bikeshedding) is supported-crate-types a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time.

Stability

This print request being added is unstable in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time.

Review remarks

Best reviewed commit-by-commit.

r? compiler

@rustbotrustbot 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 Mar 18, 2025
@rust-log-analyzer

This comment has been minimized.

@jieyouxujieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 18, 2025
@rustbotrustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Mar 18, 2025
@jieyouxu

Copy link
Copy Markdown
MemberAuthor

@rustbot ready

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 18, 2025
Comment threadsrc/doc/rustc/src/command-line-arguments.md Outdated
@jieyouxu
jieyouxuforce-pushed the print-supported-crate-types branch from 9448784 to ef06252CompareMarch 18, 2025 06:53
@jieyouxujieyouxu added the A-print-requests Area: print requests (`--print=...`) label Mar 19, 2025
@weihanglo

Copy link
Copy Markdown
Member

Really looking forward to using this in Cargo. Thank you folks!

@bors

bors commented Mar 21, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #138747) made this pull request unmergeable. Please resolve the merge conflicts.

@jieyouxujieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 21, 2025
@jieyouxu
jieyouxuforce-pushed the print-supported-crate-types branch from ef06252 to 675bfebCompareMarch 21, 2025 06:10
@jieyouxu

Copy link
Copy Markdown
MemberAuthor

Reblessed tests due to extra help line.
@rustbot ready

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 21, 2025
@rust-log-analyzer

This comment has been minimized.

@jieyouxujieyouxu added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 21, 2025
Comment on lines -1 to -2
//@ check-fail
//@ compile-flags: /dev/null --print lints

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I was a bit confused by this test, it turns out we are checking for the -Whelp suggestion if the invalid print request --print=lints was specified.

Comment on lines +5 to +7
//@ error-pattern: error: unknown print request: `lints`
//@ error-pattern: help: use `-Whelp` to print a list of lints
//@ error-pattern: help: for more information, see the rustc book

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ensure that the test intention can't be accidentally blessed away as easily.

@jieyouxujieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 21, 2025

@UrgauUrgau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Urgau

Copy link
Copy Markdown
Member

r? Urgau
@bors r+ rollup

@bors

bors commented Mar 21, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 405d1c4 has been approved by Urgau

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 21, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Mar 23, 2025
…es, r=Urgau
Add unstable `--print=supported-crate-types` option
MCP: rust-lang/compiler-team#836
Tracking issue: rust-lang#138640
### Test coverage
Two tests:
1. `tests/ui/print-request/stability.rs` to check that `--print=supported-crate-types` is `-Zunstable-options`-gated
2. `tests/ui/print-request/supported-crate-types.rs` is added as a basic smoke test. Observe that the compiler stdout corresponds to the below *Example output* section (e.g. `proc-macro` is unsupported on `wasm32-unknown-unknown` currently).
### Example output
<details>
<summary>For `x86_64-unknown-linux-gnu`</summary>
Notice the presence of `{c,}dylib` and `proc-macro`:
```
bin
cdylib
dylib
lib
proc-macro
rlib
staticlib
```
</details>
<details>
<summary>For `wasm32-unknown-unknown`</summary>
Notice the absence of `dylib` and `proc-macro`:
```
bin
cdylib
lib
rlib
staticlib
```
</details>
<details>
<summary>For `x86_64-unknown-linux-musl`</summary>
Notice the absence of `{c,}dylib` but presence of `proc-macro`:
```
bin
lib
proc-macro
rlib
staticlib
```
</details>
### Documentation
I added an entry in the unstable book's print request section to document this `supported-crate-types` print request.
### Unresolved questions
- [ ] (Name bikeshedding) is `supported-crate-types` a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time.
### Stability
This print request being added is *unstable* in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time.
### Review remarks
Best reviewed commit-by-commit.
r? compiler
@jieyouxujieyouxu mentioned this pull request Mar 23, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2025
Rollup of 9 pull requests
Successful merges:
- rust-lang#138236 (uefi: Add OwnedEvent abstraction)
- rust-lang#138293 (rustdoc: Gate unstable `doc(cfg())` predicates)
- rust-lang#138509 (Add test to ensure no index out of bounds panic (rust-lang#135474))
- rust-lang#138602 (Slim `rustc_parse_format` dependencies down)
- rust-lang#138631 (Update test for SGX now implementing `read_buf`)
- rust-lang#138641 (Add unstable `--print=supported-crate-types` option)
- rust-lang#138662 (Implement some basics in UEFI fs)
- rust-lang#138837 (resolve: Avoid remaining unstable iteration)
- rust-lang#138849 (doc: rename reference #create-a-configtoml to #create-a-bootstraptoml)
Failed merges:
- rust-lang#138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)
r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r-
guess this failed here
#138853 (comment)

@borsbors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 23, 2025
@jieyouxu

Copy link
Copy Markdown
MemberAuthor

Yes, it's because I wrote needs-llvm-components: wasm instead of needs-llvm-components: webassembly.

- Document test intent to check for `-Whelp` suggestion if
`--print=lints` was specified.
- Move this test under `tests/ui/print-request/` and rename it to
`print-lints-help.rs` to better reflect what it is checking.
@jieyouxu
jieyouxuforce-pushed the print-supported-crate-types branch from 405d1c4 to f2cde8eCompareMarch 23, 2025 11:21
@jieyouxu

Copy link
Copy Markdown
MemberAuthor

Fixed the llvm component name.
@bors r=Urgau

@bors

bors commented Mar 23, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit f2cde8e has been approved by Urgau

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2025
…mpiler-errors
Rollup of 12 pull requests
Successful merges:
- rust-lang#136040 (Remove unused trait BoundedSize)
- rust-lang#138236 (uefi: Add OwnedEvent abstraction)
- rust-lang#138293 (rustdoc: Gate unstable `doc(cfg())` predicates)
- rust-lang#138509 (Add test to ensure no index out of bounds panic (rust-lang#135474))
- rust-lang#138545 (Add MIR pre-codegen tests to track rust-lang#138544)
- rust-lang#138631 (Update test for SGX now implementing `read_buf`)
- rust-lang#138641 (Add unstable `--print=supported-crate-types` option)
- rust-lang#138667 (std: uefi: fs: Implement mkdir)
- rust-lang#138849 (doc: rename reference #create-a-configtoml to #create-a-bootstraptoml)
- rust-lang#138854 (Fix ICE rust-lang#138415 for invalid extern function body)
- rust-lang#138858 (Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertion)
- rust-lang#138861 (Tweak type flags, fix missing flags from coroutine kind ty)
Failed merges:
- rust-lang#138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2025
…mpiler-errors
Rollup of 12 pull requests
Successful merges:
- rust-lang#136040 (Remove unused trait BoundedSize)
- rust-lang#138236 (uefi: Add OwnedEvent abstraction)
- rust-lang#138293 (rustdoc: Gate unstable `doc(cfg())` predicates)
- rust-lang#138509 (Add test to ensure no index out of bounds panic (rust-lang#135474))
- rust-lang#138545 (Add MIR pre-codegen tests to track rust-lang#138544)
- rust-lang#138631 (Update test for SGX now implementing `read_buf`)
- rust-lang#138641 (Add unstable `--print=supported-crate-types` option)
- rust-lang#138667 (std: uefi: fs: Implement mkdir)
- rust-lang#138849 (doc: rename reference #create-a-configtoml to #create-a-bootstraptoml)
- rust-lang#138854 (Fix ICE rust-lang#138415 for invalid extern function body)
- rust-lang#138858 (Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertion)
- rust-lang#138861 (Tweak type flags, fix missing flags from coroutine kind ty)
Failed merges:
- rust-lang#138755 ([rustdoc] Remove duplicated loop when computing doc cfgs)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 21cdebc into rust-lang:masterMar 24, 2025
@rustbotrustbot added this to the 1.87.0 milestone Mar 24, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 24, 2025
Rollup merge of rust-lang#138641 - jieyouxu:print-supported-crate-types, r=Urgau
Add unstable `--print=supported-crate-types` option
MCP: rust-lang/compiler-team#836
Tracking issue: rust-lang#138640
### Test coverage
Two tests:
1. `tests/ui/print-request/stability.rs` to check that `--print=supported-crate-types` is `-Zunstable-options`-gated
2. `tests/ui/print-request/supported-crate-types.rs` is added as a basic smoke test. Observe that the compiler stdout corresponds to the below *Example output* section (e.g. `proc-macro` is unsupported on `wasm32-unknown-unknown` currently).
### Example output
<details>
<summary>For `x86_64-unknown-linux-gnu`</summary>
Notice the presence of `{c,}dylib` and `proc-macro`:
```
bin
cdylib
dylib
lib
proc-macro
rlib
staticlib
```
</details>
<details>
<summary>For `wasm32-unknown-unknown`</summary>
Notice the absence of `dylib` and `proc-macro`:
```
bin
cdylib
lib
rlib
staticlib
```
</details>
<details>
<summary>For `x86_64-unknown-linux-musl`</summary>
Notice the absence of `{c,}dylib` but presence of `proc-macro`:
```
bin
lib
proc-macro
rlib
staticlib
```
</details>
### Documentation
I added an entry in the unstable book's print request section to document this `supported-crate-types` print request.
### Unresolved questions
- [ ] (Name bikeshedding) is `supported-crate-types` a good name for the print request? I'm inclined to say it's good enough for an unstable print request, but may be worth revisiting at stabilization time.
### Stability
This print request being added is *unstable* in this PR. A separate stabilization PR following the usual compiler flag stabilization procedure should be filed for stabilization after some baking time.
### Review remarks
Best reviewed commit-by-commit.
r? compiler
@jieyouxu
jieyouxu deleted the print-supported-crate-types branch March 24, 2025 01:15
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-print-requestsArea: print requests (`--print=...`)A-run-makeArea: port run-make Makefiles to rmake.rsS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

8 participants

@jieyouxu@rust-log-analyzer@weihanglo@bors@Urgau@matthiaskrgr@fee1-dead@rustbot