Add --emit=nothing
to tell rustc not to emit any files (even if --crate-type=lib
)
#52661
Labels
A-driver
Area: rustc_driver that ties everything together into the `rustc` compiler
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In order to only check if a program is well-formed (think
cargo check
), one would like to callrustc
without emitting any files.cargo check
uses--emit=metadata -Z no-codegen
because the metadata is needed to check dependent crates.However, it seems like it's impossible to tell the compiler to not write any files in the case of
--crate-type=lib
. For the default--crate-type=bin
it works:rustc -Z no-codegen foo.rs
does not emit any files. But again, forrustc -Z no-codegen --crate-type=lib foo.rs
it emits an.rlib
file.In case this isn't a bug, would it be possible to add an
--emit=nothing
or equivalent option?(Related question on StackOverflow)
The text was updated successfully, but these errors were encountered: