-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc: Improve the dep-info experience #28768
Conversation
Currently the compiler supports the ability to emit multiple output types as part of one compilation (e.g. asm, LLVM IR, bytecode, link, dep-info, etc). It does not, however, support the ability to customize the output filename for each of these output types. The `-o` flag is ignored if multiple emit types are specified (and the compiler emits a warning about this). Normally this doesn't matter too much, but in the case of `dep-info` it can lead to a number of problems (e.g. see rust-lang#28716). By allowing customization of the output filename for each emit type we're able to solve the problems in that issue. This commit adds support for the `--emit` option to the compiler to look like: rustc foo.rs --emit dep-info=.deps/foo.d,link This indicates that the `dep-info` output type will be placed at `.deps/foo.d` and the `link` output type will otherwise be determined via the `--out-dir` and `-o` flags. Closes rust-lang#28716
r? @brson cc @rust-lang/tools -- changes to CLI flags here. |
r? @Aatch (rust_highfive has picked a reviewer for you, use r? to override) |
cc @froydnj @rillian @apasel422 Hopefully a gecko engineer will give this a look. |
r=me when you decide the phony issue and one of the gecko devs checks in. |
Whether the targets are 'phony' in the make-specific sense depends on whether the file is present or not. 'dummy target' might be a better term. In any case, we don't want these included in a .PHONY tells make to always run the rule for the specified targets, whether a file with the name of that target is present or not. This avoids files shadowing invocation targets like 'clean' or 'doc' which are intended to never be considered up-to-date, which is not the case we have here. gcc doesn't emit any .PHONY rules either. |
The GCC documentation calls them "phony" targets, which, as @rillian pointed out, has nothing to do with |
This helps protect against files being deleted to ensure that `make` won't emit errors. Closes rust-lang#28735
610152c
to
1741962
Compare
This PR closes out #28716 and #28735 by making two changes to the compiler: 1. The `--emit` flag to the compiler now supports the ability to specify the output file name of a partuclar emit type. For example `--emit dep-info=bar.d,asm=foo.s,link` is now accepted. 2. The dep-info emission now emits a dummy target for all input file names to protect against deleted files.
This PR closes out #28716 and #28735 by making two changes to the compiler:
--emit
flag to the compiler now supports the ability to specify the output file name of a partuclar emit type. For example--emit dep-info=bar.d,asm=foo.s,link
is now accepted.