Add unstable --print=supported-crate-types option by jieyouxu · Pull Request #138641 · rust-lang/rust (original) (raw)

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

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