Auto merge of #114144 - workingjubilee:rollup-jkmtgdo, r=workingjubilee
Rollup of 4 pull requests Successful merges: - #97571 (Add documentation on v0 symbol mangling.) - #114122 (tests/ui/hello_world/main.rs: Remove FIXME (#62277)) - #114133 (Revert "add tidy check that forbids issue ui test filenames") - #114139 (Make `--print` with path unstable) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
500647fd81
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
11
src/doc/unstable-book/src/compiler-flags/path-options.md
Normal file
11
src/doc/unstable-book/src/compiler-flags/path-options.md
Normal file
@ -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`
|
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,7 @@
|
||||
//! - there are no stray `.stderr` files
|
||||
|
||||
use ignore::Walk;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
@ -90,12 +88,6 @@ fn check_entries(tests_path: &Path, bad: &mut bool) {
|
||||
|
||||
pub fn check(path: &Path, bad: &mut bool) {
|
||||
check_entries(&path, bad);
|
||||
|
||||
// the list of files in ui tests that are allowed to start with `issue-XXXX`
|
||||
let mut allowed_issue_filenames: HashSet<String> = HashSet::from(
|
||||
include!("issues.txt").map(|path| path.replace("/", std::path::MAIN_SEPARATOR_STR)),
|
||||
);
|
||||
|
||||
let (ui, ui_fulldeps) = (path.join("ui"), path.join("ui-fulldeps"));
|
||||
let paths = [ui.as_path(), ui_fulldeps.as_path()];
|
||||
crate::walk::walk_no_read(&paths, |_, _| false, &mut |entry| {
|
||||
@ -108,11 +100,6 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
{
|
||||
tidy_error!(bad, "file {} has unexpected extension {}", file_path.display(), ext);
|
||||
}
|
||||
|
||||
// NB: We do not use file_stem() as some file names have multiple `.`s and we
|
||||
// must strip all of them.
|
||||
let testname =
|
||||
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
|
||||
if ext == "stderr" || ext == "stdout" {
|
||||
// Test output filenames have one of the formats:
|
||||
// ```
|
||||
@ -124,7 +111,11 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
//
|
||||
// For now, just make sure that there is a corresponding
|
||||
// `$testname.rs` file.
|
||||
|
||||
//
|
||||
// NB: We do not use file_stem() as some file names have multiple `.`s and we
|
||||
// must strip all of them.
|
||||
let testname =
|
||||
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
|
||||
if !file_path.with_file_name(testname).with_extension("rs").exists()
|
||||
&& !testname.contains("ignore-tidy")
|
||||
{
|
||||
@ -137,38 +128,6 @@ pub fn check(path: &Path, bad: &mut bool) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ext == "rs" {
|
||||
lazy_static! {
|
||||
static ref ISSUE_NAME_REGEX: Regex =
|
||||
Regex::new(r"^issues?[-_]?\d{3,}").unwrap();
|
||||
}
|
||||
|
||||
if ISSUE_NAME_REGEX.is_match(testname) {
|
||||
// these paths are always relative to the passed `path` and always UTF8
|
||||
let stripped_path = file_path.strip_prefix(path).unwrap().to_str().unwrap();
|
||||
if !allowed_issue_filenames.remove(stripped_path) {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"UI test `{}` should use a name that describes the test and link the issue in a comment instead.",
|
||||
file_path.display(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// if an excluded file is renamed, it must be removed from this list
|
||||
if allowed_issue_filenames.len() > 0 {
|
||||
for file_name in allowed_issue_filenames {
|
||||
let mut p = PathBuf::from(path);
|
||||
p.push(file_name);
|
||||
tidy_error!(
|
||||
bad,
|
||||
"file `{}` no longer exists and should be removed from the exclusions in `src/tools/tidy/src/issues.txt`",
|
||||
p.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,19 +13,19 @@ all: default output_to_file
|
||||
|
||||
output_to_file:
|
||||
# Backend-independent, printed by rustc_driver_impl/src/lib.rs
|
||||
$(RUSTC) --target x86_64-pc-windows-gnu --print cfg=$(TMPDIR)/cfg.txt
|
||||
$(RUSTC) --target x86_64-pc-windows-gnu --print cfg=$(TMPDIR)/cfg.txt -Z unstable-options
|
||||
$(CGREP) windows < $(TMPDIR)/cfg.txt
|
||||
|
||||
# Printed from CodegenBackend trait impl in rustc_codegen_llvm/src/lib.rs
|
||||
$(RUSTC) --print relocation-models=$(TMPDIR)/relocation-models.txt
|
||||
$(RUSTC) --print relocation-models=$(TMPDIR)/relocation-models.txt -Z unstable-options
|
||||
$(CGREP) dynamic-no-pic < $(TMPDIR)/relocation-models.txt
|
||||
|
||||
# Printed by compiler/rustc_codegen_llvm/src/llvm_util.rs
|
||||
$(RUSTC) --target wasm32-unknown-unknown --print target-features=$(TMPDIR)/target-features.txt
|
||||
$(RUSTC) --target wasm32-unknown-unknown --print target-features=$(TMPDIR)/target-features.txt -Z unstable-options
|
||||
$(CGREP) reference-types < $(TMPDIR)/target-features.txt
|
||||
|
||||
# Printed by C++ code in rustc_llvm/llvm-wrapper/PassWrapper.cpp
|
||||
$(RUSTC) --target wasm32-unknown-unknown --print target-cpus=$(TMPDIR)/target-cpus.txt
|
||||
$(RUSTC) --target wasm32-unknown-unknown --print target-cpus=$(TMPDIR)/target-cpus.txt -Z unstable-options
|
||||
$(CGREP) generic < $(TMPDIR)/target-cpus.txt
|
||||
|
||||
ifdef IS_WINDOWS
|
||||
|
2
tests/ui/feature-gates/print-with-path.cfg.stderr
Normal file
2
tests/ui/feature-gates/print-with-path.cfg.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the path print option
|
||||
|
7
tests/ui/feature-gates/print-with-path.rs
Normal file
7
tests/ui/feature-gates/print-with-path.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// check-fail
|
||||
// revisions: cfg target-features target-cpus
|
||||
// [cfg]compile-flags: --print cfg=cfg.txt
|
||||
// [target-cpus]compile-flags: --print target-cpu=target_cpu.txt
|
||||
// [target-features]compile-flags: --print target-features=target_features.txt
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,2 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the path print option
|
||||
|
@ -0,0 +1,2 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the path print option
|
||||
|
@ -1,4 +1,4 @@
|
||||
// build-pass (FIXME(62277): could be check-pass?)
|
||||
// build-pass
|
||||
|
||||
// Test that compiling hello world succeeds with no output of any kind.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user