Skip to content
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

Rollup of 4 pull requests #114144

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2152,6 +2152,12 @@ fn collect_print_requests(
prints.extend(matches.opt_strs("print").into_iter().map(|req| {
let (req, out) = split_out_file_name(&req);

if out.is_some() && !unstable_opts.unstable_options {
handler.early_error(
"the `-Z unstable-options` flag must also be passed to \
enable the path print option",
);
}
let kind = match PRINT_KINDS.iter().find(|&&(name, _)| name == req) {
Some((_, PrintKind::TargetSpec)) => {
if unstable_opts.unstable_options {
Expand Down
4 changes: 0 additions & 4 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ The valid types of print values are:
This returns rustc's minimum supported deployment target if no `*_DEPLOYMENT_TARGET` variable
is present in the environment, or otherwise returns the variable's parsed value.

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.

[conditional compilation]: ../reference/conditional-compilation.html
[deployment target]: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html

Expand Down
11 changes: 11 additions & 0 deletions src/doc/unstable-book/src/compiler-flags/path-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `--print` Options

The behavior of the `--print` flag can be modified by optionally be specifiying a filepath
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.

This is unstable feature, so you have to provide `-Zunstable-options` to enable it.

## Examples

`rustc main.rs -Z unstable-options --print cfg=cfgs.txt`
Loading