Skip to content
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

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

Merged
merged 4 commits into from
Mar 24, 2025

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Mar 18, 2025

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

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

This comment has been minimized.

@jieyouxu jieyouxu 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
@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Mar 18, 2025
@jieyouxu
Copy link
Member Author

@rustbot ready

@rustbot rustbot 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
@jieyouxu jieyouxu force-pushed the print-supported-crate-types branch from 9448784 to ef06252 Compare March 18, 2025 06:53
@jieyouxu jieyouxu added the A-print-requests Area: print requests (`--print=...`) label Mar 19, 2025
@weihanglo
Copy link
Member

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

@bors
Copy link
Contributor

bors commented Mar 21, 2025

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

@jieyouxu jieyouxu 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 jieyouxu force-pushed the print-supported-crate-types branch from ef06252 to 675bfeb Compare March 21, 2025 06:10
@jieyouxu
Copy link
Member Author

Reblessed tests due to extra help line.
@rustbot ready

@rustbot rustbot 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.

@jieyouxu jieyouxu 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
Member Author

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
Member Author

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.

@jieyouxu jieyouxu 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
Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

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

LGTM

@Urgau
Copy link
Member

Urgau commented Mar 21, 2025

r? Urgau
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 21, 2025

📌 Commit 405d1c4 has been approved by Urgau

It is now in the queue for this repository.

@bors bors 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
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
Member

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

@bors bors 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
Member Author

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

As an unstable print request.
- 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 jieyouxu force-pushed the print-supported-crate-types branch from 405d1c4 to f2cde8e Compare March 23, 2025 11:21
@jieyouxu
Copy link
Member Author

Fixed the llvm component name.
@bors r=Urgau

@bors
Copy link
Contributor

bors commented Mar 23, 2025

📌 Commit f2cde8e has been approved by Urgau

It is now in the queue for this repository.

@bors bors 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:master Mar 24, 2025
6 checks passed
@rustbot rustbot 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-print-requests Area: print requests (`--print=...`) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants