From dbb22d247f201d9e2a3f07fa75f90db39e966ff7 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Thu, 10 Mar 2022 16:59:08 -0800 Subject: [PATCH 1/9] update library tracking issue template --- .github/ISSUE_TEMPLATE/library_tracking_issue.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/library_tracking_issue.md b/.github/ISSUE_TEMPLATE/library_tracking_issue.md index 32fccfcfb1696..91c06402ca10a 100644 --- a/.github/ISSUE_TEMPLATE/library_tracking_issue.md +++ b/.github/ISSUE_TEMPLATE/library_tracking_issue.md @@ -50,7 +50,7 @@ If the feature is changed later, please add those PRs here as well. --> - [ ] Implementation: #... -- [ ] Final comment period (FCP) +- [ ] Final comment period (FCP)[^1] - [ ] Stabilization PR - None yet. + +[^1]: https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html From 0e58792cd99af4721067aaa7aae68c40dfe1df7e Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 26 Jun 2022 04:39:46 -0500 Subject: [PATCH 2/9] Allow using `download-ci-llvm = true` outside the git checkout @bjorn3 noticed that this is already allowed today when download-llvm is disabled, but breaks with it enabled: ``` $ ./rust2/x.py build fatal: not a git repository (or any of the parent directories): .git thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/home/jnelson/rust-lang/rust2/src/llvm-project" "/home/jnelson/rust-lang/rust2/src/bootstrap/download-ci-llvm-stamp" "/home/jnelson/rust-lang/rust2/src/version" expected success, got: exit status: 128', src/bootstrap/native.rs:134:20 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Support it too for consistency. It's unclear to me when anyone would need to use this, but @bjorn3 feels we should support it, and it's not much additional effort to get it working. This also updates a bunch of other git commands that were similarly depending on the current directory. --- src/bootstrap/config.rs | 30 +++++++++++++++++------------ src/bootstrap/format.rs | 9 ++++----- src/bootstrap/lib.rs | 9 +++++---- src/bootstrap/native.rs | 2 +- src/bootstrap/setup.rs | 13 ++++++------- src/bootstrap/toolstate.rs | 39 ++++++++++++++++++-------------------- 6 files changed, 52 insertions(+), 50 deletions(-) diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 14607741932ea..6ec66ff9afd82 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1128,11 +1128,7 @@ impl Config { config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config); config.rust_profile_use = flags.rust_profile_use.or(rust.profile_use); config.rust_profile_generate = flags.rust_profile_generate.or(rust.profile_generate); - config.download_rustc_commit = download_ci_rustc_commit( - &config.stage0_metadata, - rust.download_rustc, - config.verbose > 0, - ); + config.download_rustc_commit = download_ci_rustc_commit(&config, rust.download_rustc); } else { config.rust_profile_use = flags.rust_profile_use; config.rust_profile_generate = flags.rust_profile_generate; @@ -1304,6 +1300,15 @@ impl Config { config } + /// A git invocation which runs inside the source directory. + /// + /// Use this rather than `Command::new("git")` in order to support out-of-tree builds. + pub(crate) fn git(&self) -> Command { + let mut git = Command::new("git"); + git.current_dir(&self.src); + git + } + /// Try to find the relative path of `bindir`, otherwise return it in full. pub fn bindir_relative(&self) -> &Path { let bindir = &self.bindir; @@ -1453,9 +1458,8 @@ fn threads_from_config(v: u32) -> u32 { /// Returns the commit to download, or `None` if we shouldn't download CI artifacts. fn download_ci_rustc_commit( - stage0_metadata: &Stage0Metadata, + config: &Config, download_rustc: Option, - verbose: bool, ) -> Option { // If `download-rustc` is not set, default to rebuilding. let if_unchanged = match download_rustc { @@ -1468,7 +1472,7 @@ fn download_ci_rustc_commit( }; // Handle running from a directory other than the top level - let top_level = output(Command::new("git").args(&["rev-parse", "--show-toplevel"])); + let top_level = output(config.git().args(&["rev-parse", "--show-toplevel"])); let top_level = top_level.trim_end(); let compiler = format!("{top_level}/compiler/"); let library = format!("{top_level}/library/"); @@ -1476,9 +1480,10 @@ fn download_ci_rustc_commit( // Look for a version to compare to based on the current commit. // Only commits merged by bors will have CI artifacts. let merge_base = output( - Command::new("git") + config + .git() .arg("rev-list") - .arg(format!("--author={}", stage0_metadata.config.git_merge_commit_email)) + .arg(format!("--author={}", config.stage0_metadata.config.git_merge_commit_email)) .args(&["-n1", "--first-parent", "HEAD"]), ); let commit = merge_base.trim_end(); @@ -1491,13 +1496,14 @@ fn download_ci_rustc_commit( } // Warn if there were changes to the compiler or standard library since the ancestor commit. - let has_changes = !t!(Command::new("git") + let has_changes = !t!(config + .git() .args(&["diff-index", "--quiet", &commit, "--", &compiler, &library]) .status()) .success(); if has_changes { if if_unchanged { - if verbose { + if config.verbose > 0 { println!( "warning: saw changes to compiler/ or library/ since {commit}; \ ignoring `download-rustc`" diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index 60a53c28686b0..4923ddc225437 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -72,7 +72,9 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) { Err(_) => false, }; if git_available { - let in_working_tree = match Command::new("git") + let in_working_tree = match build + .config + .git() .arg("rev-parse") .arg("--is-inside-work-tree") .stdout(Stdio::null()) @@ -84,10 +86,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) { }; if in_working_tree { let untracked_paths_output = output( - Command::new("git") - .arg("status") - .arg("--porcelain") - .arg("--untracked-files=normal"), + build.config.git().arg("status").arg("--porcelain").arg("--untracked-files=normal"), ); let untracked_paths = untracked_paths_output .lines() diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 4ac857b470e80..b6c3fc1503fb5 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -634,7 +634,8 @@ impl Build { return; } let output = output( - Command::new("git") + self.config + .git() .args(&["config", "--file"]) .arg(&self.config.src.join(".gitmodules")) .args(&["--get-regexp", "path"]), @@ -1271,12 +1272,12 @@ impl Build { // That's our beta number! // (Note that we use a `..` range, not the `...` symmetric difference.) let count = output( - Command::new("git") + self.config + .git() .arg("rev-list") .arg("--count") .arg("--merges") - .arg("refs/remotes/origin/master..HEAD") - .current_dir(&self.src), + .arg("refs/remotes/origin/master..HEAD"), ); let n = count.trim().parse().unwrap(); self.prerelease_version.set(Some(n)); diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 329bb68672ee6..88c6b7002886d 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -118,7 +118,7 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) { if !config.llvm_from_ci { return; } - let mut rev_list = Command::new("git"); + let mut rev_list = config.git(); rev_list.args(&[ PathBuf::from("rev-list"), format!("--author={}", builder.config.stage0_metadata.config.git_merge_commit_email).into(), diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index 82f55440ce50c..e6f6460729af6 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -136,7 +136,7 @@ pub fn setup(config: &Config, profile: Profile) { println!(); - t!(install_git_hook_maybe(&config.src)); + t!(install_git_hook_maybe(&config)); println!(); @@ -302,7 +302,7 @@ pub fn interactive_path() -> io::Result { } // install a git hook to automatically run tidy --bless, if they want -fn install_git_hook_maybe(src_path: &Path) -> io::Result<()> { +fn install_git_hook_maybe(config: &Config) -> io::Result<()> { let mut input = String::new(); println!( "Rust's CI will automatically fail if it doesn't pass `tidy`, the internal tool for ensuring code quality. @@ -328,13 +328,12 @@ undesirable, simply delete the `pre-push` file from .git/hooks." }; if should_install { - let src = src_path.join("src").join("etc").join("pre-push.sh"); - let git = t!(Command::new("git").args(&["rev-parse", "--git-common-dir"]).output().map( - |output| { + let src = config.src.join("src").join("etc").join("pre-push.sh"); + let git = + t!(config.git().args(&["rev-parse", "--git-common-dir"]).output().map(|output| { assert!(output.status.success(), "failed to run `git`"); PathBuf::from(t!(String::from_utf8(output.stdout)).trim()) - } - )); + })); let dst = git.join("hooks").join("pre-push"); match fs::hard_link(src, &dst) { Err(e) => eprintln!( diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index 3ee6a42d987a0..328a0bf11c2af 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -1,5 +1,6 @@ use crate::builder::{Builder, RunConfig, ShouldRun, Step}; use crate::util::t; +use crate::Config; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::env; @@ -96,14 +97,9 @@ fn print_error(tool: &str, submodule: &str) { std::process::exit(3); } -fn check_changed_files(toolstates: &HashMap, ToolState>) { +fn check_changed_files(toolstates: &HashMap, ToolState>, config: &Config) { // Changed files - let output = std::process::Command::new("git") - .arg("diff") - .arg("--name-status") - .arg("HEAD") - .arg("HEAD^") - .output(); + let output = config.git().arg("diff").arg("--name-status").arg("HEAD").arg("HEAD^").output(); let output = match output { Ok(o) => o, Err(e) => { @@ -182,8 +178,8 @@ impl Step for ToolStateCheck { std::process::exit(1); } - check_changed_files(&toolstates); - checkout_toolstate_repo(); + check_changed_files(&toolstates, &builder.config); + checkout_toolstate_repo(&builder.config); let old_toolstate = read_old_toolstate(); for (tool, _) in STABLE_TOOLS.iter() { @@ -229,7 +225,7 @@ impl Step for ToolStateCheck { } if builder.config.channel == "nightly" && env::var_os("TOOLSTATE_PUBLISH").is_some() { - commit_toolstate_change(&toolstates); + commit_toolstate_change(&toolstates, &builder.config); } } @@ -302,16 +298,17 @@ fn toolstate_repo() -> String { const TOOLSTATE_DIR: &str = "rust-toolstate"; /// Checks out the toolstate repo into `TOOLSTATE_DIR`. -fn checkout_toolstate_repo() { +fn checkout_toolstate_repo(config: &Config) { if let Ok(token) = env::var("TOOLSTATE_REPO_ACCESS_TOKEN") { - prepare_toolstate_config(&token); + prepare_toolstate_config(&token, config); } if Path::new(TOOLSTATE_DIR).exists() { eprintln!("Cleaning old toolstate directory..."); t!(fs::remove_dir_all(TOOLSTATE_DIR)); } - let status = Command::new("git") + let status = config + .git() .arg("clone") .arg("--depth=1") .arg(toolstate_repo()) @@ -327,9 +324,9 @@ fn checkout_toolstate_repo() { } /// Sets up config and authentication for modifying the toolstate repo. -fn prepare_toolstate_config(token: &str) { - fn git_config(key: &str, value: &str) { - let status = Command::new("git").arg("config").arg("--global").arg(key).arg(value).status(); +fn prepare_toolstate_config(token: &str, config: &Config) { + let git_config = |key: &str, value: &str| { + let status = config.git().arg("config").arg("--global").arg(key).arg(value).status(); let success = match status { Ok(s) => s.success(), Err(_) => false, @@ -337,7 +334,7 @@ fn prepare_toolstate_config(token: &str) { if !success { panic!("git config key={} value={} failed (status: {:?})", key, value, status); } - } + }; // If changing anything here, then please check that `src/ci/publish_toolstate.sh` is up to date // as well. @@ -383,14 +380,14 @@ fn read_old_toolstate() -> Vec { /// /// * See /// if a private email by GitHub is wanted. -fn commit_toolstate_change(current_toolstate: &ToolstateData) { +fn commit_toolstate_change(current_toolstate: &ToolstateData, config: &Config) { let message = format!("({} CI update)", OS.expect("linux/windows only")); let mut success = false; for _ in 1..=5 { // Upload the test results (the new commit-to-toolstate mapping) to the toolstate repo. // This does *not* change the "current toolstate"; that only happens post-landing // via `src/ci/docker/publish_toolstate.sh`. - publish_test_results(¤t_toolstate); + publish_test_results(¤t_toolstate, config); // `git commit` failing means nothing to commit. let status = t!(Command::new("git") @@ -444,8 +441,8 @@ fn commit_toolstate_change(current_toolstate: &ToolstateData) { /// These results will later be promoted to `latest.json` by the /// `publish_toolstate.py` script if the PR passes all tests and is merged to /// master. -fn publish_test_results(current_toolstate: &ToolstateData) { - let commit = t!(std::process::Command::new("git").arg("rev-parse").arg("HEAD").output()); +fn publish_test_results(current_toolstate: &ToolstateData, config: &Config) { + let commit = t!(config.git().arg("rev-parse").arg("HEAD").output()); let commit = t!(String::from_utf8(commit.stdout)); let toolstate_serialized = t!(serde_json::to_string(¤t_toolstate)); From 2852443f4877115c1c629d462cd83dae0baa7109 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 1 Jul 2022 10:33:06 -0700 Subject: [PATCH 3/9] rustdoc: use
tag for the source code sidebar This fixes the extremely poor accessibility of the old system, making it possible to navigate the sidebar by keyboard, and also implicitly gives the sidebar items the correct ARIA roles. --- src/librustdoc/html/static/css/rustdoc.css | 35 ++++------------ src/librustdoc/html/static/css/themes/ayu.css | 3 +- .../html/static/css/themes/dark.css | 3 +- .../html/static/css/themes/light.css | 3 +- .../html/static/js/source-script.js | 29 +++++-------- .../sidebar-source-code-display.goml | 42 +++++++++---------- src/test/rustdoc-gui/source-code-page.goml | 20 ++++----- 7 files changed, 53 insertions(+), 82 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 532b98d9bb9f6..7d5318a194c7d 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1528,38 +1528,19 @@ kbd { margin-bottom: 1em; } -div.children { - padding-left: 27px; - display: none; -} -div.name { +details.dir-entry > summary { + margin: 0 0 0 13px; + list-style-position: outside; cursor: pointer; - position: relative; - margin-left: 16px; } -div.files > a { - display: block; - padding: 0 3px; -} -div.files > a:hover, div.name:hover { - background-color: #a14b4b; + +details.dir-entry div.folders, details.dir-entry div.files { + padding-left: 27px; } -div.name.expand + .children { + +details.dir-entry a { display: block; } -div.name::before { - content: "\25B6"; - padding-left: 4px; - font-size: 0.625rem; - position: absolute; - left: -16px; - top: 4px; -} -div.name.expand::before { - transform: rotate(90deg); - left: -15px; - top: 2px; -} /* The hideme class is used on summary tags that contain a span with placeholder text shown only when the toggle is closed. For instance, diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index b7d0db1f0020f..a78ac5da7490b 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -630,7 +630,8 @@ kbd { color: #fff; border-bottom-color: #5c6773; } -#source-sidebar div.files > a:hover, div.name:hover { +#source-sidebar div.files > a:hover, details.dir-entry summary:hover, +#source-sidebar div.files > a:focus, details.dir-entry summary:focus { background-color: #14191f; color: #ffb44c; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index eb64ef3e7710b..a2abd53fa02bc 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -500,7 +500,8 @@ kbd { #source-sidebar > .title { border-bottom-color: #ccc; } -#source-sidebar div.files > a:hover, div.name:hover { +#source-sidebar div.files > a:hover, details.dir-entry summary:hover, +#source-sidebar div.files > a:focus, details.dir-entry summary:focus { background-color: #444; } #source-sidebar div.files > .selected { diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 00cdf83589716..c4510ad6ae66b 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -484,7 +484,8 @@ kbd { #source-sidebar > .title { border-bottom-color: #ccc; } -#source-sidebar div.files > a:hover, div.name:hover { +#source-sidebar div.files > a:hover, details.dir-entry summary:hover, +#source-sidebar div.files > a:focus, details.dir-entry summary:focus { background-color: #E0E0E0; } #source-sidebar div.files > .selected { diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index acb1d8d7b5c8d..21c3609279075 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -13,33 +13,27 @@ const rootPath = document.getElementById("rustdoc-vars").attributes["data-root-p let oldScrollPosition = 0; function createDirEntry(elem, parent, fullPath, hasFoundFile) { - const name = document.createElement("div"); - name.className = "name"; + const dirEntry = document.createElement("details"); + const summary = document.createElement("summary"); + + dirEntry.className = "dir-entry"; fullPath += elem["name"] + "/"; - name.onclick = ev => { - if (hasClass(ev.target, "expand")) { - removeClass(ev.target, "expand"); - } else { - addClass(ev.target, "expand"); - } - }; - name.innerText = elem["name"]; + summary.innerText = elem["name"]; + dirEntry.appendChild(summary); - const children = document.createElement("div"); - children.className = "children"; const folders = document.createElement("div"); folders.className = "folders"; if (elem.dirs) { for (const dir of elem.dirs) { if (createDirEntry(dir, folders, fullPath, hasFoundFile)) { - addClass(name, "expand"); + dirEntry.open = true; hasFoundFile = true; } } } - children.appendChild(folders); + dirEntry.appendChild(folders); const files = document.createElement("div"); files.className = "files"; @@ -51,15 +45,14 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) { const w = window.location.href.split("#")[0]; if (!hasFoundFile && w === file.href) { file.className = "selected"; - addClass(name, "expand"); + dirEntry.open = true; hasFoundFile = true; } files.appendChild(file); } } - children.appendChild(files); - parent.appendChild(name); - parent.appendChild(children); + dirEntry.appendChild(files); + parent.appendChild(dirEntry); return hasFoundFile; } diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index c441f84a82135..1d8cc22100c3d 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -27,29 +27,29 @@ reload: // Waiting for the sidebar to be displayed... wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) assert-css: ( - "#source-sidebar .expand + .children a.selected", + "#source-sidebar details[open] > .files a.selected", {"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)" +move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children .folders .name" +move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"}, ) @@ -59,29 +59,29 @@ reload: // Waiting for the sidebar to be displayed... wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) assert-css: ( - "#source-sidebar .expand + .children a.selected", + "#source-sidebar details[open] > .files > a.selected", {"color": "rgb(221, 221, 221)", "background-color": "rgb(51, 51, 51)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files > a:not(.selected)", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)" +move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children .folders .name" +move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"}, ) @@ -91,29 +91,29 @@ reload: // Waiting for the sidebar to be displayed... wait-for-css: ("#sidebar-toggle", {"visibility": "visible", "opacity": 1}) assert-css: ( - "#source-sidebar .expand + .children a.selected", + "#source-sidebar details[open] > .files a.selected", {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children > .files a:not(.selected)" +move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( - "#source-sidebar .expand + .children > .files a:not(.selected)", + "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, ) // Without hover. assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ) // With hover. -move-cursor-to: "#source-sidebar .expand + .children .folders .name" +move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( - "#source-sidebar .expand + .children .folders .name", + "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, ) diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml index b45512601f208..05b0e809bca69 100644 --- a/src/test/rustdoc-gui/source-code-page.goml +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -34,19 +34,13 @@ assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH) click: "#sidebar-toggle" assert: ".source-sidebar-expanded" -// We check that the first entry of the sidebar is collapsed (which, for whatever reason, -// is number 2 and not 1...). -assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name"}) -assert-text: ("#source-sidebar .name:nth-child(2)", "implementors") -// We also check its children are hidden too. -assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "none"}) +// We check that the first entry of the sidebar is collapsed +assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) +assert-text: ("#source-sidebar details:first-of-type > summary", "implementors") // We now click on it. -click: "#source-sidebar .name:nth-child(2)" -assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name expand"}) -// Checking that its children are displayed as well. -assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "block"}) +click: "#source-sidebar details:first-of-type > summary" +assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) // And now we collapse it again. -click: "#source-sidebar .name:nth-child(2)" -assert-attribute: ("#source-sidebar .name:nth-child(2)", {"class": "name"}) -assert-css: ("#source-sidebar .name:nth-child(2) + .children", {"display": "none"}) +click: "#source-sidebar details:first-of-type > summary" +assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) From 1f621fba2d7ef850b5d1920ef2bf37c7fa89570c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 1 Jul 2022 11:27:09 -0700 Subject: [PATCH 4/9] rustdoc cleanup: remove unused function --- src/librustdoc/html/static/css/themes/ayu.css | 2 +- src/librustdoc/html/static/css/themes/dark.css | 2 +- src/librustdoc/html/static/css/themes/light.css | 3 +-- src/librustdoc/html/static/js/source-script.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index a78ac5da7490b..63f64dc69e893 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -635,7 +635,7 @@ kbd { background-color: #14191f; color: #ffb44c; } -#source-sidebar div.files > .selected { +#source-sidebar div.files > a.selected { background-color: #14191f; color: #ffb44c; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index a2abd53fa02bc..d1f79b5b08219 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -504,7 +504,7 @@ kbd { #source-sidebar div.files > a:focus, details.dir-entry summary:focus { background-color: #444; } -#source-sidebar div.files > .selected { +#source-sidebar div.files > a.selected { background-color: #333; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index c4510ad6ae66b..e09b1f7a5e2e4 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -488,10 +488,9 @@ kbd { #source-sidebar div.files > a:focus, details.dir-entry summary:focus { background-color: #E0E0E0; } -#source-sidebar div.files > .selected { +#source-sidebar div.files > a.selected { background-color: #fff; } - .scraped-example-list .scrape-help { border-color: #555; color: #333; diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js index 21c3609279075..9173e93e7c804 100644 --- a/src/librustdoc/html/static/js/source-script.js +++ b/src/librustdoc/html/static/js/source-script.js @@ -2,7 +2,7 @@ /* global sourcesIndex */ // Local js definitions: -/* global addClass, getCurrentValue, hasClass, onEachLazy, removeClass, browserSupportsHistoryApi */ +/* global addClass, getCurrentValue, onEachLazy, removeClass, browserSupportsHistoryApi */ /* global updateLocalStorage */ "use strict"; From 180f83605afbd8abe58e79df475df0e0958401b3 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 1 Jul 2022 15:29:47 -0700 Subject: [PATCH 5/9] rustdoc: add spacing to the source view sidebar https://user-images.githubusercontent.com/1593513/176974336-20cecdc3-1885-402a-a6d5-81a8dd03a45d.png --- src/librustdoc/html/static/css/rustdoc.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 7d5318a194c7d..4e9b75eba6a4e 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1528,6 +1528,10 @@ kbd { margin-bottom: 1em; } +details.dir-entry { + padding-left: 4px; +} + details.dir-entry > summary { margin: 0 0 0 13px; list-style-position: outside; @@ -1535,7 +1539,7 @@ details.dir-entry > summary { } details.dir-entry div.folders, details.dir-entry div.files { - padding-left: 27px; + padding-left: 23px; } details.dir-entry a { From b80979416d3eb7aa55c3f01b107f17f0363bf92e Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 1 Jul 2022 16:16:03 -0700 Subject: [PATCH 6/9] rustdoc: add test cases for :focus on sidebar details elements --- .../sidebar-source-code-display.goml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/test/rustdoc-gui/sidebar-source-code-display.goml b/src/test/rustdoc-gui/sidebar-source-code-display.goml index 1d8cc22100c3d..edcd98dfd937f 100644 --- a/src/test/rustdoc-gui/sidebar-source-code-display.goml +++ b/src/test/rustdoc-gui/sidebar-source-code-display.goml @@ -35,6 +35,13 @@ assert-css: ( "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .files a:not(.selected)" +wait-for-css: ( + "#source-sidebar details[open] > .files a:not(.selected)", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( @@ -46,6 +53,13 @@ assert-css: ( "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .folders > details > summary" +wait-for-css: ( + "#source-sidebar details[open] > .folders > details > summary", + {"color": "rgb(0, 0, 0)", "background-color": "rgb(224, 224, 224)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( @@ -67,6 +81,13 @@ assert-css: ( "#source-sidebar details[open] > .files > a:not(.selected)", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .files a:not(.selected)" +wait-for-css: ( + "#source-sidebar details[open] > .files a:not(.selected)", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( @@ -78,6 +99,13 @@ assert-css: ( "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .folders > details > summary" +wait-for-css: ( + "#source-sidebar details[open] > .folders > details > summary", + {"color": "rgb(221, 221, 221)", "background-color": "rgb(68, 68, 68)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( @@ -99,6 +127,13 @@ assert-css: ( "#source-sidebar details[open] > .files a:not(.selected)", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .files a:not(.selected)" +wait-for-css: ( + "#source-sidebar details[open] > .files a:not(.selected)", + {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .files a:not(.selected)" assert-css: ( @@ -110,6 +145,13 @@ assert-css: ( "#source-sidebar details[open] > .folders > details > summary", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ) +// With focus. +focus: "#source-sidebar details[open] > .folders > details > summary" +wait-for-css: ( + "#source-sidebar details[open] > .folders > details > summary", + {"color": "rgb(255, 180, 76)", "background-color": "rgb(20, 25, 31)"}, +) +focus: ".search-input" // With hover. move-cursor-to: "#source-sidebar details[open] > .folders > details > summary" assert-css: ( From 17da4e06f20a47a68fe0a71607a66d7f9a4c850b Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 2 Jul 2022 00:54:05 -0500 Subject: [PATCH 7/9] Fix bug in `rustdoc -Whelp` Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints - Remove duplicate run-make test --- compiler/rustc_driver/src/lib.rs | 20 +- src/librustdoc/config.rs | 22 +- src/librustdoc/lib.rs | 25 +- .../run-make/issue-88756-opt-help/Makefile | 4 - .../run-make/issue-88756-opt-help/README.md | 1 - .../output-default.stdout | 193 ---------------- src/test/run-make/issue-88756-opt-help/x.rs | 1 - .../rustdoc-ui/issue-83883-describe-lints.rs | 4 +- .../issue-83883-describe-lints.stdout | 215 ++---------------- src/tools/compiletest/src/runtest.rs | 6 +- 10 files changed, 69 insertions(+), 422 deletions(-) delete mode 100644 src/test/run-make/issue-88756-opt-help/Makefile delete mode 100644 src/test/run-make/issue-88756-opt-help/README.md delete mode 100644 src/test/run-make/issue-88756-opt-help/output-default.stdout delete mode 100644 src/test/run-make/issue-88756-opt-help/x.rs diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 3096af90d4770..b71cdad718a27 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -849,10 +849,10 @@ Available lint options: }; println!("Lint checks provided by rustc:\n"); - println!(" {} {:7.7} {}", padded("name"), "default", "meaning"); - println!(" {} {:7.7} {}", padded("----"), "-------", "-------"); let print_lints = |lints: Vec<&Lint>| { + println!(" {} {:7.7} {}", padded("name"), "default", "meaning"); + println!(" {} {:7.7} {}", padded("----"), "-------", "-------"); for lint in lints { let name = lint.name_lower().replace('_', "-"); println!( @@ -884,11 +884,15 @@ Available lint options: }; println!("Lint groups provided by rustc:\n"); - println!(" {} sub-lints", padded("name")); - println!(" {} ---------", padded("----")); - println!(" {} all lints that are set to issue warnings", padded("warnings")); - let print_lint_groups = |lints: Vec<(&'static str, Vec)>| { + let print_lint_groups = |lints: Vec<(&'static str, Vec)>, all_warnings| { + println!(" {} sub-lints", padded("name")); + println!(" {} ---------", padded("----")); + + if all_warnings { + println!(" {} all lints that are set to issue warnings", padded("warnings")); + } + for (name, to) in lints { let name = name.to_lowercase().replace('_', "-"); let desc = to @@ -901,7 +905,7 @@ Available lint options: println!("\n"); }; - print_lint_groups(builtin_groups); + print_lint_groups(builtin_groups, true); match (loaded_plugins, plugin.len(), plugin_groups.len()) { (false, 0, _) | (false, _, 0) => { @@ -916,7 +920,7 @@ Available lint options: } if g > 0 { println!("Lint groups provided by plugins loaded by this crate:\n"); - print_lint_groups(plugin_groups); + print_lint_groups(plugin_groups, false); } } } diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 50d154dd278a1..04638aa1af62b 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -353,11 +353,7 @@ impl Options { print_flag_list("-C", config::CG_OPTIONS); return Err(0); } - let w_flags = matches.opt_strs("W"); - if w_flags.iter().any(|x| *x == "help") { - print_flag_list("-W", config::DB_OPTIONS); - return Err(0); - } + if matches.opt_strs("passes") == ["list"] { println!("Available passes for running rustdoc:"); for pass in passes::PASSES { @@ -439,15 +435,19 @@ impl Options { return Err(0); } - if matches.free.is_empty() { + let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); + + let input = PathBuf::from(if describe_lints { + "" // dummy, this won't be used + } else if matches.free.is_empty() { diag.struct_err("missing file operand").emit(); return Err(1); - } - if matches.free.len() > 1 { + } else if matches.free.len() > 1 { diag.struct_err("too many file operands").emit(); return Err(1); - } - let input = PathBuf::from(&matches.free[0]); + } else { + &matches.free[0] + }); let libs = matches .opt_strs("L") @@ -698,8 +698,6 @@ impl Options { let with_examples = matches.opt_strs("with-examples"); let call_locations = crate::scrape_examples::load_call_locations(with_examples, &diag)?; - let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); - Ok(Options { input, proc_macro_crate, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index db4c3d1023700..1854a1ffb90d3 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -76,7 +76,7 @@ use std::env::{self, VarError}; use std::io; use std::process; -use rustc_driver::{abort_on_err, describe_lints}; +use rustc_driver::abort_on_err; use rustc_errors::ErrorGuaranteed; use rustc_interface::interface; use rustc_middle::ty::TyCtxt; @@ -771,15 +771,24 @@ fn main_options(options: config::Options) -> MainResult { let config = core::create_config(options); interface::create_compiler_and_run(config, |compiler| { - compiler.enter(|queries| { - let sess = compiler.session(); + let sess = compiler.session(); - if sess.opts.describe_lints { - let (_, lint_store) = &*queries.register_plugins()?.peek(); - describe_lints(sess, lint_store, true); - return Ok(()); - } + if sess.opts.describe_lints { + let mut lint_store = rustc_lint::new_lint_store( + sess.opts.debugging_opts.no_interleave_lints, + sess.unstable_options(), + ); + let registered_lints = if let Some(register_lints) = compiler.register_lints() { + register_lints(sess, &mut lint_store); + true + } else { + false + }; + rustc_driver::describe_lints(sess, &lint_store, registered_lints); + return Ok(()); + } + compiler.enter(|queries| { // We need to hold on to the complete resolver, so we cause everything to be // cloned for the analysis passes to use. Suboptimal, but necessary in the // current architecture. diff --git a/src/test/run-make/issue-88756-opt-help/Makefile b/src/test/run-make/issue-88756-opt-help/Makefile deleted file mode 100644 index 8ababbf5b4ebd..0000000000000 --- a/src/test/run-make/issue-88756-opt-help/Makefile +++ /dev/null @@ -1,4 +0,0 @@ --include ../../run-make-fulldeps/tools.mk - -all: - $(RUSTDOC) -W help 2>&1 | diff - output-default.stdout diff --git a/src/test/run-make/issue-88756-opt-help/README.md b/src/test/run-make/issue-88756-opt-help/README.md deleted file mode 100644 index 9b742753f25b6..0000000000000 --- a/src/test/run-make/issue-88756-opt-help/README.md +++ /dev/null @@ -1 +0,0 @@ -This is a test to verify that `rustdoc` behaves the same as rustc and prints out help output for its options like -W (#88756). diff --git a/src/test/run-make/issue-88756-opt-help/output-default.stdout b/src/test/run-make/issue-88756-opt-help/output-default.stdout deleted file mode 100644 index 5cb7ecb649a96..0000000000000 --- a/src/test/run-make/issue-88756-opt-help/output-default.stdout +++ /dev/null @@ -1,193 +0,0 @@ - -W allow-features=val -- only allow the listed language features to be enabled in code (space separated) - -W always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no) - -W assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no) - -W asm-comments=val -- generate comments into the assembly (may change behavior) (default: no) - -W assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`. - -W binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no) - -W branch-protection=val -- set options for branch target identification and pointer authentication on AArch64 - -W cf-protection=val -- instrument control-flow architecture protection - -W cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use - -W chalk=val -- enable the experimental Chalk-based trait solving engine - -W codegen-backend=val -- the backend to use - -W combine-cgu=val -- combine CGUs into a single one - -W crate-attr=val -- inject the given attribute in the crate - -W debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO - -W debug-macros=val -- emit line numbers debug info inside macros (default: no) - -W deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes) - -W dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no) - -W dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no) - -W dlltool=val -- import library generation tool (windows-gnu only) - -W dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no) - -W drop-tracking=val -- enables drop tracking in generators (default: no) - -W dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no) - -W dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no) - -W dump-mir=val -- dump MIR state to file. - `val` is used to select which passes and functions to dump. For example: - `all` matches all passes and functions, - `foo` matches all passes for functions whose name contains 'foo', - `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', - `foo | bar` all passes for function names containing 'foo' or 'bar'. - -W dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no) - -W dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`) - -W dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no) - -W dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no) - -W dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans. - -W emit-stack-sizes=val -- emit a section containing stack size metadata (default: no) - -W fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no) - -W force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no) - -W fuel=val -- set the optimization fuel quota for a crate - -W function-sections=val -- whether each function should go in its own section - -W future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no) - -W gcc-ld=val -- implementation of ld used by cc - -W graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no) - -W graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`) - -W hir-stats=val -- print some statistics about AST and HIR (default: no) - -W human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no) - -W identify-regions=val -- display unnamed regions as `'`, using a non-ident unique id (default: no) - -W incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no) - -W incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no) - -W incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no) - -W incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no) - -W inline-mir=val -- enable MIR inlining (default: no) - -W inline-mir-threshold=val -- a default MIR inlining threshold (default: 50) - -W inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100) - -W inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs - -W input-stats=val -- gather statistics about the input (default: no) - -W instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are: - `=all` (implicit value) - `=except-unused-generics` - `=except-unused-functions` - `=off` (default) - -W instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no) - -W keep-hygiene-data=val -- keep hygiene data after analysis (default: no) - -W link-native-libraries=val -- link native libraries in the linker invocation (default: yes) - -W link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no) - -W llvm-plugins=val -- a list LLVM plugins to enable (space separated) - -W llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no) - -W location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all) - -W ls=val -- list the symbols defined by a library crate (default: no) - -W macro-backtrace=val -- show macro backtraces (default: no) - -W merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name - -W meta-stats=val -- gather metadata statistics (default: no) - -W mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no) - -W mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual. - -W mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds) - -W move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted - -W mutable-noalias=val -- emit noalias metadata for mutable references (default: yes) - -W new-llvm-pass-manager=val -- use new LLVM pass manager (default: no) - -W nll-facts=val -- dump facts from NLL analysis into side files (default: no) - -W nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`) - -W no-analysis=val -- parse and expand the source, but run no analysis - -W no-codegen=val -- run all passes except codegen; no output - -W no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups - -W no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints - -W no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests - -W no-link=val -- compile without linking - -W no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) - -W no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used - -W no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate - -W normalize-docs=val -- normalize associated items in rustdoc when generating documentation - -W oom=val -- panic strategy for out-of-memory handling - -W osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no) - -W panic-abort-tests=val -- support compiling tests with panic=abort (default: no) - -W panic-in-drop=val -- panic strategy for panics in drops - -W parse-only=val -- parse only; do not compile, assemble, or link (default: no) - -W perf-stats=val -- print some performance-related statistics (default: no) - -W pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes) - -W plt=val -- whether to use the PLT when calling into shared libraries; - only has effect for PIC code on systems with ELF binaries - (default: PLT is disabled if full relro is enabled) - -W polonius=val -- enable polonius-based borrow-checker (default: no) - -W polymorphize=val -- perform polymorphization analysis - -W pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times) - -W pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated) - -W precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551. - -W print-fuel=val -- make rustc print the total optimization fuel used by a crate - -W print-llvm-passes=val -- print the LLVM optimization passes being run (default: no) - -W print-mono-items=val -- print the result of the monomorphization collection pass - -W print-type-sizes=val -- print layout information for each type encountered (default: no) - -W proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no) - -W profile=val -- insert profiling code (default: no) - -W profile-closures=val -- profile size of closures - -W profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path) - -W profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`) - -W profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO) - -W query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no) - -W randomize-layout=val -- randomize the layout of types (default: no) - -W layout-seed=val -- seed layout randomization - -W relax-elf-relocations=val -- whether ELF relocations can be relaxed - -W relro-level=val -- choose which RELRO level to use - -W remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix - -W simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes - -W report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no) - -W sanitizer=val -- use a sanitizer - -W sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer - -W sanitizer-recover=val -- enable recovery for selected sanitizers - -W saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes) - -W save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no) - -W self-profile=val -- run the self profiler and output the raw event data - -W self-profile-events=val -- specify the events recorded by the self profiler; - for example: `-Z self-profile-events=default,query-keys` - all options: none, all, default, generic-activity, query-provider, query-cache-hit - query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes - -W self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of: - `wall-time` (monotonic clock, i.e. `std::time::Instant`) - `instructions:u` (retired instructions, userspace-only) - `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy) - -W share-generics=val -- make the current crate share its generic instantiations - -W show-span=val -- show spans for compiler debugging (expr|pat|ty) - -W span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span` - -W span-free-formats=val -- exclude spans when debug-printing compiler state (default: no) - -W src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`) - -W stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details) - -W strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB - -W strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`) - -W split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) - (default: `split`) - - `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) - file which is ignored by the linker - `single`: sections which do not require relocation are written into object file but ignored - by the linker - -W split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF - -W symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0') - -W teach=val -- show extended diagnostic help (default: no) - -W temps-dir=val -- the directory the intermediate files are written to - -W terminal-width=val -- set the current terminal width - -W translate-lang=val -- language identifier for diagnostic output - -W translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation) - -W translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics - -W tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details) - -W thinlto=val -- enable ThinLTO when possible - -W thir-unsafeck=val -- use the THIR unsafety checker (default: no) - -W threads=val -- use a thread pool with N threads - -W time=val -- measure time of rustc processes (default: no) - -W time-llvm-passes=val -- measure time of each LLVM pass (default: no) - -W time-passes=val -- measure time of each rustc pass (default: no) - -W tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details) - -W trace-macros=val -- for every macro invocation, print its name and arguments (default: no) - -W translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes) - -W trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes) - -W treat-err-as-bug=val -- treat error number `val` that occurs as bug - -W trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items - -W ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no) - -W uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16) - -W unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no) - -W unpretty=val -- present the input source, unstable (and less-pretty) variants; - `normal`, `identified`, - `expanded`, `expanded,identified`, - `expanded,hygiene` (with internal representations), - `ast-tree` (raw AST before expansion), - `ast-tree,expanded` (raw AST after expansion), - `hir` (the HIR), `hir,identified`, - `hir,typed` (HIR with types for each node), - `hir-tree` (dump the raw HIR), - `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR) - -W unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no) - -W unstable-options=val -- adds unstable command line options to rustc interface (default: no) - -W use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array - -W validate-mir=val -- validate MIR after each transformation - -W verbose=val -- in general, enable more debug printouts (default: no) - -W verify-llvm-ir=val -- verify LLVM IR (default: no) - -W virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]` - -W wasi-exec-model=val -- whether to build a wasi command or reactor diff --git a/src/test/run-make/issue-88756-opt-help/x.rs b/src/test/run-make/issue-88756-opt-help/x.rs deleted file mode 100644 index 5df7576133a68..0000000000000 --- a/src/test/run-make/issue-88756-opt-help/x.rs +++ /dev/null @@ -1 +0,0 @@ -// nothing to see here diff --git a/src/test/rustdoc-ui/issue-83883-describe-lints.rs b/src/test/rustdoc-ui/issue-83883-describe-lints.rs index a261b782d4859..0474d6c143e92 100644 --- a/src/test/rustdoc-ui/issue-83883-describe-lints.rs +++ b/src/test/rustdoc-ui/issue-83883-describe-lints.rs @@ -1,8 +1,10 @@ // compile-flags: -W help // check-pass +// check-stdout +// error-pattern:Lint checks provided +// error-pattern:rustdoc::broken-intra-doc-links // // ignore-tidy-linelength // // normalize-stdout-test: "( +name default meaning\n +---- ------- -------\n)?( *[[:word:]:-]+ (allow |warn |deny |forbid ) [^\n]+\n)+" -> " $$NAMES $$LEVELS $$MEANINGS" // normalize-stdout-test: " +name sub-lints\n +---- ---------\n( *[[:word:]:-]+ [^\n]+\n)+" -> " $$NAMES $$SUB_LINTS" -// normalize-stdout-test: " +rustdoc::all( (rustdoc::[[:word:]-]+, )*rustdoc::[[:word:]-]+)?" -> " rustdoc::all $$GROUPS$4" diff --git a/src/test/rustdoc-ui/issue-83883-describe-lints.stdout b/src/test/rustdoc-ui/issue-83883-describe-lints.stdout index 5cb7ecb649a96..bbf66a31583d2 100644 --- a/src/test/rustdoc-ui/issue-83883-describe-lints.stdout +++ b/src/test/rustdoc-ui/issue-83883-describe-lints.stdout @@ -1,193 +1,24 @@ - -W allow-features=val -- only allow the listed language features to be enabled in code (space separated) - -W always-encode-mir=val -- encode MIR of all functions into the crate metadata (default: no) - -W assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no) - -W asm-comments=val -- generate comments into the assembly (may change behavior) (default: no) - -W assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`. - -W binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no) - -W branch-protection=val -- set options for branch target identification and pointer authentication on AArch64 - -W cf-protection=val -- instrument control-flow architecture protection - -W cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use - -W chalk=val -- enable the experimental Chalk-based trait solving engine - -W codegen-backend=val -- the backend to use - -W combine-cgu=val -- combine CGUs into a single one - -W crate-attr=val -- inject the given attribute in the crate - -W debug-info-for-profiling=val -- emit discriminators and other data necessary for AutoFDO - -W debug-macros=val -- emit line numbers debug info inside macros (default: no) - -W deduplicate-diagnostics=val -- deduplicate identical diagnostics (default: yes) - -W dep-info-omit-d-target=val -- in dep-info output, omit targets for tracking dependencies of the dep-info files themselves (default: no) - -W dep-tasks=val -- print tasks that execute and the color their dep node gets (requires debug build) (default: no) - -W dlltool=val -- import library generation tool (windows-gnu only) - -W dont-buffer-diagnostics=val -- emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) (default: no) - -W drop-tracking=val -- enables drop tracking in generators (default: no) - -W dual-proc-macros=val -- load proc macros for both target and host, but only link to the target (default: no) - -W dump-dep-graph=val -- dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) (default: no) - -W dump-mir=val -- dump MIR state to file. - `val` is used to select which passes and functions to dump. For example: - `all` matches all passes and functions, - `foo` matches all passes for functions whose name contains 'foo', - `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', - `foo | bar` all passes for function names containing 'foo' or 'bar'. - -W dump-mir-dataflow=val -- in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no) - -W dump-mir-dir=val -- the directory the MIR is dumped into (default: `mir_dump`) - -W dump-mir-exclude-pass-number=val -- exclude the pass number when dumping MIR (used in tests) (default: no) - -W dump-mir-graphviz=val -- in addition to `.mir` files, create graphviz `.dot` files (and with `-Z instrument-coverage`, also create a `.dot` file for the MIR-derived coverage graph) (default: no) - -W dump-mir-spanview=val -- in addition to `.mir` files, create `.html` files to view spans for all `statement`s (including terminators), only `terminator` spans, or computed `block` spans (one span encompassing a block's terminator and all statements). If `-Z instrument-coverage` is also enabled, create an additional `.html` file showing the computed coverage spans. - -W emit-stack-sizes=val -- emit a section containing stack size metadata (default: no) - -W fewer-names=val -- reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) (default: no) - -W force-unstable-if-unmarked=val -- force all crates to be `rustc_private` unstable (default: no) - -W fuel=val -- set the optimization fuel quota for a crate - -W function-sections=val -- whether each function should go in its own section - -W future-incompat-test=val -- forces all lints to be future incompatible, used for internal testing (default: no) - -W gcc-ld=val -- implementation of ld used by cc - -W graphviz-dark-mode=val -- use dark-themed colors in graphviz output (default: no) - -W graphviz-font=val -- use the given `fontname` in graphviz output; can be overridden by setting environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`) - -W hir-stats=val -- print some statistics about AST and HIR (default: no) - -W human-readable-cgu-names=val -- generate human-readable, predictable names for codegen units (default: no) - -W identify-regions=val -- display unnamed regions as `'`, using a non-ident unique id (default: no) - -W incremental-ignore-spans=val -- ignore spans during ICH computation -- used for testing (default: no) - -W incremental-info=val -- print high-level information about incremental reuse (or the lack thereof) (default: no) - -W incremental-relative-spans=val -- hash spans relative to their parent item for incr. comp. (default: no) - -W incremental-verify-ich=val -- verify incr. comp. hashes of green query instances (default: no) - -W inline-mir=val -- enable MIR inlining (default: no) - -W inline-mir-threshold=val -- a default MIR inlining threshold (default: 50) - -W inline-mir-hint-threshold=val -- inlining threshold for functions with inline hint (default: 100) - -W inline-in-all-cgus=val -- control whether `#[inline]` functions are in all CGUs - -W input-stats=val -- gather statistics about the input (default: no) - -W instrument-coverage=val -- instrument the generated code to support LLVM source-based code coverage reports (note, the compiler build config must include `profiler = true`); implies `-C symbol-mangling-version=v0`. Optional values are: - `=all` (implicit value) - `=except-unused-generics` - `=except-unused-functions` - `=off` (default) - -W instrument-mcount=val -- insert function instrument code for mcount-based tracing (default: no) - -W keep-hygiene-data=val -- keep hygiene data after analysis (default: no) - -W link-native-libraries=val -- link native libraries in the linker invocation (default: yes) - -W link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no) - -W llvm-plugins=val -- a list LLVM plugins to enable (space separated) - -W llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no) - -W location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all) - -W ls=val -- list the symbols defined by a library crate (default: no) - -W macro-backtrace=val -- show macro backtraces (default: no) - -W merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name - -W meta-stats=val -- gather metadata statistics (default: no) - -W mir-emit-retag=val -- emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 (default: no) - -W mir-enable-passes=val -- use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be enabled, overriding all other checks. Passes that are not specified are enabled or disabled by other flags as usual. - -W mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds) - -W move-size-limit=val -- the size at which the `large_assignments` lint starts to be emitted - -W mutable-noalias=val -- emit noalias metadata for mutable references (default: yes) - -W new-llvm-pass-manager=val -- use new LLVM pass manager (default: no) - -W nll-facts=val -- dump facts from NLL analysis into side files (default: no) - -W nll-facts-dir=val -- the directory the NLL facts are dumped into (default: `nll-facts`) - -W no-analysis=val -- parse and expand the source, but run no analysis - -W no-codegen=val -- run all passes except codegen; no output - -W no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups - -W no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints - -W no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests - -W no-link=val -- compile without linking - -W no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) - -W no-unique-section-names=val -- do not use unique names for text and data sections when -Z function-sections is used - -W no-profiler-runtime=val -- prevent automatic injection of the profiler_builtins crate - -W normalize-docs=val -- normalize associated items in rustdoc when generating documentation - -W oom=val -- panic strategy for out-of-memory handling - -W osx-rpath-install-name=val -- pass `-install_name @rpath/...` to the macOS linker (default: no) - -W panic-abort-tests=val -- support compiling tests with panic=abort (default: no) - -W panic-in-drop=val -- panic strategy for panics in drops - -W parse-only=val -- parse only; do not compile, assemble, or link (default: no) - -W perf-stats=val -- print some performance-related statistics (default: no) - -W pick-stable-methods-before-any-unstable=val -- try to pick stable methods first before picking any unstable methods (default: yes) - -W plt=val -- whether to use the PLT when calling into shared libraries; - only has effect for PIC code on systems with ELF binaries - (default: PLT is disabled if full relro is enabled) - -W polonius=val -- enable polonius-based borrow-checker (default: no) - -W polymorphize=val -- perform polymorphization analysis - -W pre-link-arg=val -- a single extra argument to prepend the linker invocation (can be used several times) - -W pre-link-args=val -- extra arguments to prepend to the linker invocation (space separated) - -W precise-enum-drop-elaboration=val -- use a more precise version of drop elaboration for matches on enums (default: yes). This results in better codegen, but has caused miscompilations on some tier 2 platforms. See #77382 and #74551. - -W print-fuel=val -- make rustc print the total optimization fuel used by a crate - -W print-llvm-passes=val -- print the LLVM optimization passes being run (default: no) - -W print-mono-items=val -- print the result of the monomorphization collection pass - -W print-type-sizes=val -- print layout information for each type encountered (default: no) - -W proc-macro-backtrace=val -- show backtraces for panics during proc-macro execution (default: no) - -W profile=val -- insert profiling code (default: no) - -W profile-closures=val -- profile size of closures - -W profile-emit=val -- file path to emit profiling data at runtime when using 'profile' (default based on relative source path) - -W profiler-runtime=val -- name of the profiler runtime crate to automatically inject (default: `profiler_builtins`) - -W profile-sample-use=val -- use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO) - -W query-dep-graph=val -- enable queries of the dependency graph for regression testing (default: no) - -W randomize-layout=val -- randomize the layout of types (default: no) - -W layout-seed=val -- seed layout randomization - -W relax-elf-relocations=val -- whether ELF relocations can be relaxed - -W relro-level=val -- choose which RELRO level to use - -W remap-cwd-prefix=val -- remap paths under the current working directory to this path prefix - -W simulate-remapped-rust-src-base=val -- simulate the effect of remap-debuginfo = true at bootstrapping by remapping path to rust's source base directory. only meant for testing purposes - -W report-delayed-bugs=val -- immediately print bugs registered with `delay_span_bug` (default: no) - -W sanitizer=val -- use a sanitizer - -W sanitizer-memory-track-origins=val -- enable origins tracking in MemorySanitizer - -W sanitizer-recover=val -- enable recovery for selected sanitizers - -W saturating-float-casts=val -- make float->int casts UB-free: numbers outside the integer type's range are clipped to the max/min integer respectively, and NaN is mapped to 0 (default: yes) - -W save-analysis=val -- write syntax and type analysis (in JSON format) information, in addition to normal output (default: no) - -W self-profile=val -- run the self profiler and output the raw event data - -W self-profile-events=val -- specify the events recorded by the self profiler; - for example: `-Z self-profile-events=default,query-keys` - all options: none, all, default, generic-activity, query-provider, query-cache-hit - query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes - -W self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of: - `wall-time` (monotonic clock, i.e. `std::time::Instant`) - `instructions:u` (retired instructions, userspace-only) - `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy) - -W share-generics=val -- make the current crate share its generic instantiations - -W show-span=val -- show spans for compiler debugging (expr|pat|ty) - -W span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span` - -W span-free-formats=val -- exclude spans when debug-printing compiler state (default: no) - -W src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`) - -W stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details) - -W strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB - -W strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`) - -W split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) - (default: `split`) - `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) - file which is ignored by the linker - `single`: sections which do not require relocation are written into object file but ignored - by the linker - -W split-dwarf-inlining=val -- provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF - -W symbol-mangling-version=val -- which mangling version to use for symbol names ('legacy' (default) or 'v0') - -W teach=val -- show extended diagnostic help (default: no) - -W temps-dir=val -- the directory the intermediate files are written to - -W terminal-width=val -- set the current terminal width - -W translate-lang=val -- language identifier for diagnostic output - -W translate-additional-ftl=val -- additional fluent translation to preferentially use (for testing translation) - -W translate-directionality-markers=val -- emit directionality isolation markers in translated diagnostics - -W tune-cpu=val -- select processor to schedule for (`rustc --print target-cpus` for details) - -W thinlto=val -- enable ThinLTO when possible - -W thir-unsafeck=val -- use the THIR unsafety checker (default: no) - -W threads=val -- use a thread pool with N threads - -W time=val -- measure time of rustc processes (default: no) - -W time-llvm-passes=val -- measure time of each LLVM pass (default: no) - -W time-passes=val -- measure time of each rustc pass (default: no) - -W tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details) - -W trace-macros=val -- for every macro invocation, print its name and arguments (default: no) - -W translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes) - -W trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes) - -W treat-err-as-bug=val -- treat error number `val` that occurs as bug - -W trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items - -W ui-testing=val -- emit compiler diagnostics in a form suitable for UI testing (default: no) - -W uninit-const-chunk-threshold=val -- allow generating const initializers with mixed init/uninit chunks, and set the maximum number of chunks for which this is allowed (default: 16) - -W unleash-the-miri-inside-of-you=val -- take the brakes off const evaluation. NOTE: this is unsound (default: no) - -W unpretty=val -- present the input source, unstable (and less-pretty) variants; - `normal`, `identified`, - `expanded`, `expanded,identified`, - `expanded,hygiene` (with internal representations), - `ast-tree` (raw AST before expansion), - `ast-tree,expanded` (raw AST after expansion), - `hir` (the HIR), `hir,identified`, - `hir,typed` (HIR with types for each node), - `hir-tree` (dump the raw HIR), - `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR) - -W unsound-mir-opts=val -- enable unsound and buggy MIR optimizations (default: no) - -W unstable-options=val -- adds unstable command line options to rustc interface (default: no) - -W use-ctors-section=val -- use legacy .ctors section for initializers rather than .init_array - -W validate-mir=val -- validate MIR after each transformation - -W verbose=val -- in general, enable more debug printouts (default: no) - -W verify-llvm-ir=val -- verify LLVM IR (default: no) - -W virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]` - -W wasi-exec-model=val -- whether to build a wasi command or reactor +Available lint options: + -W Warn about + -A Allow + -D Deny + -F Forbid (deny and all attempts to override) + + +Lint checks provided by rustc: + + $NAMES $LEVELS $MEANINGS + +Lint groups provided by rustc: + + $NAMES $SUB_LINTS + +Lint checks provided by plugins loaded by this crate: + + $NAMES $LEVELS $MEANINGS + +Lint groups provided by plugins loaded by this crate: + + $NAMES $SUB_LINTS + diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 160b9785d975f..075d75a1d6cea 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3245,7 +3245,8 @@ impl<'test> TestCx<'test> { if !self.props.error_patterns.is_empty() { // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res, pm); + let output_to_check = self.get_output(&proc_res); + self.check_error_patterns(&output_to_check, &proc_res, pm); } } @@ -3266,7 +3267,8 @@ impl<'test> TestCx<'test> { if check_patterns { // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res, pm); + let output_to_check = self.get_output(&proc_res); + self.check_error_patterns(&output_to_check, &proc_res, pm); } if check_annotations { From e710ac12fac9d650fb53b27259332cabdc9416f5 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sat, 2 Jul 2022 09:42:49 -0700 Subject: [PATCH 8/9] rustdoc: add test case for source sidebar spacing --- src/test/rustdoc-gui/source-code-page.goml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/rustdoc-gui/source-code-page.goml b/src/test/rustdoc-gui/source-code-page.goml index 05b0e809bca69..581f826a3d94d 100644 --- a/src/test/rustdoc-gui/source-code-page.goml +++ b/src/test/rustdoc-gui/source-code-page.goml @@ -44,3 +44,6 @@ assert-property: ("#source-sidebar details:first-of-type", {"open": "true"}) // And now we collapse it again. click: "#source-sidebar details:first-of-type > summary" assert-property: ("#source-sidebar details:first-of-type", {"open": "false"}) + +// Check the spacing. +assert-css: ("#source-sidebar > details.dir-entry", {"padding-left": "4px"}) From 34063199d8fc40a9e97c1409d5077b153cf32fab Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 2 Jul 2022 21:40:33 +0000 Subject: [PATCH 9/9] Fix rust-call ICE in mir-inliner --- compiler/rustc_mir_transform/src/inline.rs | 14 +++++++++----- src/test/ui/abi/rustcall-generic.rs | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index ce387cb4453c1..12f5764152e56 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -180,16 +180,20 @@ impl<'tcx> Inliner<'tcx> { return Err("failed to normalize return type"); } if callsite.fn_sig.abi() == Abi::RustCall { - let mut args = args.into_iter(); - let _ = args.next(); // Skip `self` argument. - let arg_tuple_ty = args.next().unwrap().ty(&caller_body.local_decls, self.tcx); - assert!(args.next().is_none()); + let (arg_tuple, skipped_args) = match &args[..] { + [arg_tuple] => (arg_tuple, 0), + [_, arg_tuple] => (arg_tuple, 1), + _ => bug!("Expected `rust-call` to have 1 or 2 args"), + }; + let arg_tuple_ty = arg_tuple.ty(&caller_body.local_decls, self.tcx); let ty::Tuple(arg_tuple_tys) = arg_tuple_ty.kind() else { bug!("Closure arguments are not passed as a tuple"); }; - for (arg_ty, input) in arg_tuple_tys.iter().zip(callee_body.args_iter().skip(1)) { + for (arg_ty, input) in + arg_tuple_tys.iter().zip(callee_body.args_iter().skip(skipped_args)) + { let input_type = callee_body.local_decls[input].ty; if !equal_up_to_regions(self.tcx, self.param_env, arg_ty, input_type) { trace!(?arg_ty, ?input_type); diff --git a/src/test/ui/abi/rustcall-generic.rs b/src/test/ui/abi/rustcall-generic.rs index 2fa41a7e35a74..411c98e10313d 100644 --- a/src/test/ui/abi/rustcall-generic.rs +++ b/src/test/ui/abi/rustcall-generic.rs @@ -1,4 +1,7 @@ +// revisions: normal opt // check-pass +//[opt] compile-flags: -Zmir-opt-level=3 + #![feature(unboxed_closures)] extern "rust-call" fn foo(_: T) {}