1
Fork 0
rust/compiler/rustc_session/src
Matthias Krüger b1d1e99c22
Rollup merge of #113780 - dtolnay:printkindpath, r=b-naber
Support `--print KIND=PATH` command line syntax

As is already done for `--emit KIND=PATH` and `-L KIND=PATH`.

In the discussion of #110785, it was pointed out that `--print KIND=PATH` is nicer than trying to apply the single global `-o` path to `--print`'s output, because in general there can be multiple print requests within a single rustc invocation, and anyway `-o` would already be used for a different meaning in the case of `link-args` and `native-static-libs`.

I am interested in using `--print cfg=PATH` in Buck2. Currently Buck2 works around the lack of support for `--print KIND=PATH` by [indirecting through a Python wrapper script](d43cf3a51a/prelude/rust/tools/get_rustc_cfg.py) to redirect rustc's stdout into the location dictated by the build system.

From skimming Cargo's usages of `--print`, it definitely seems like it would benefit from `--print KIND=PATH` too. Currently it is working around the lack of this by inserting `--crate-name=___ --print=crate-name` so that it can look for a line containing `___` as a delimiter between the 2 other `--print` informations it actually cares about. This is commented as a "HACK" and "abuse". 31eda6f7c3/src/cargo/core/compiler/build_context/target_info.rs (L242) (FYI `@weihanglo` as you dealt with this recently in https://github.com/rust-lang/cargo/pull/11633.)

Mentioning reviewers active in #110785: `@fee1-dead` `@jyn514` `@bjorn3`
2023-07-21 06:52:28 +02:00
..
config Change process spawning to inherit the parent's signal mask by default 2022-10-20 14:53:38 -07:00
cgu_reuse_tracker.rs Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
code_stats.rs Tweak the sort of vtable sizes 2023-06-13 12:39:59 +00:00
config.rs Move OutFileName writing into rustc_session 2023-07-20 11:04:31 -07:00
cstore.rs Do not fetch HIR in native_libs. 2023-07-17 07:37:03 +00:00
errors.rs Move OutFileName writing into rustc_session 2023-07-20 11:04:31 -07:00
filesearch.rs bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
lib.rs Collect VTable stats & add -Zprint-vtable-sizes 2023-06-12 15:58:35 +00:00
options.rs print on rustc_codegen_llvm and rename malloc and cpy c_char 2023-07-17 00:37:52 +09:00
output.rs Write to stdout if - is given as output file 2023-06-06 17:53:29 -04:00
parse.rs On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
search_paths.rs Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
session.rs Rollup merge of #113723 - khei4:khei4/llvm-stats, r=oli-obk,nikic 2023-07-21 06:52:27 +02:00
utils.rs Rollup merge of #109231 - Zoxc:fs-non-canon, r=eholk 2023-03-23 19:55:45 +01:00