rust/compiler/rustc_session/src
bors f06b7c59a3 Auto merge of #114183 - Urgau:stabilize-print-with-path, r=oli-obk
Stabilize `PATH` option for `--print KIND=PATH`

This PR propose stabilizing the `PATH` option for `--print KIND=PATH`. This option was previously added in https://github.com/rust-lang/rust/pull/113780 (as insta-stable before being un-stablized in https://github.com/rust-lang/rust/pull/114139).

Description of the `PATH` option:
> A filepath may optionally be specified for each requested information kind, in the format `--print KIND=PATH`, just like for `--emit`. When a path is specified, information will be written there instead of to stdout.

------

Description of the original PR [\[link\]](https://github.com/rust-lang/rust/pull/113780#issue-1807080607):
> **Support --print KIND=PATH command line syntax**
>
> As is already done for `--emit KIND=PATH` and `-L KIND=PATH`.
>
> In the discussion of https://github.com/rust-lang/rust/pull/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)

-----

cc `@dtolnay`
r? `@jackh726`
2023-09-07 14:24:46 +00: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 fix couple of clippy findings: 2023-07-23 10:50:14 +02:00
config.rs Stabilize PATH option for --print KIND=PATH 2023-09-07 15:07:30 +02:00
cstore.rs Rename Freeze to FreezeLock 2023-09-02 08:14:06 +02:00
errors.rs unknown unstable lint command line 2023-08-22 18:58:39 +08:00
filesearch.rs bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
lib.rs Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
options.rs Add an (perma-)unstable option to disable vtable vptr 2023-08-18 17:44:04 +01:00
output.rs Add help for crate arg when crate name is invalid 2023-07-26 00:05:00 +08:00
parse.rs unknown unstable lint command line 2023-08-22 18:58:39 +08:00
search_paths.rs Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
session.rs Use conditional synchronization for Lock 2023-08-30 06:10:02 +02:00
utils.rs Move extra_compiler_flags() to rustc_session 2023-08-24 06:31:11 +02:00