about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/builder.rs2
-rw-r--r--src/bootstrap/config.rs2
-rw-r--r--src/bootstrap/flags.rs8
-rw-r--r--src/bootstrap/format.rs6
-rw-r--r--src/bootstrap/lib.rs4
-rw-r--r--src/bootstrap/native.rs8
-rw-r--r--src/bootstrap/setup.rs24
-rw-r--r--src/bootstrap/tool.rs20
-rw-r--r--src/bootstrap/util.rs2
-rw-r--r--src/librustdoc/html/static/.eslintrc.js9
-rw-r--r--src/librustdoc/html/static/js/main.js4
-rw-r--r--src/librustdoc/html/static/js/search.js8
-rw-r--r--src/test/ui/borrowck/issue-81899.rs13
-rw-r--r--src/test/ui/borrowck/issue-81899.stderr17
-rw-r--r--src/test/ui/derives/issue-97343.rs8
-rw-r--r--src/test/ui/derives/issue-97343.stderr13
16 files changed, 104 insertions, 44 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 0fb66e56a8c..b804cefd3fc 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -227,7 +227,7 @@ impl StepDescription {
 
     fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
         if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) {
-            eprintln!("Skipping {:?} because it is excluded", pathset);
+            println!("Skipping {:?} because it is excluded", pathset);
             return true;
         }
 
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 843d276cd7a..b82c1505b24 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -765,7 +765,7 @@ impl Config {
             {
                 Ok(table) => table,
                 Err(err) => {
-                    println!("failed to parse TOML configuration '{}': {}", file.display(), err);
+                    eprintln!("failed to parse TOML configuration '{}': {}", file.display(), err);
                     process::exit(2);
                 }
             }
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 4cd835ade64..9827a6c590b 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -367,8 +367,8 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
             }
         }
         if !pass_sanity_check {
-            println!("{}\n", subcommand_help);
-            println!(
+            eprintln!("{}\n", subcommand_help);
+            eprintln!(
                 "Sorry, I couldn't figure out which subcommand you were trying to specify.\n\
                  You may need to move some options to after the subcommand.\n"
             );
@@ -532,7 +532,7 @@ Arguments:
             Kind::Build => Subcommand::Build { paths },
             Kind::Check => {
                 if matches.opt_present("all-targets") {
-                    eprintln!(
+                    println!(
                         "Warning: --all-targets is now on by default and does not need to be passed explicitly."
                     );
                 }
@@ -606,7 +606,7 @@ Arguments:
             if matches.opt_str("keep-stage").is_some()
                 || matches.opt_str("keep-stage-std").is_some()
             {
-                println!("--keep-stage not yet supported for x.py check");
+                eprintln!("--keep-stage not yet supported for x.py check");
                 process::exit(1);
             }
         }
diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs
index 10b846e6db2..d1a450f1bff 100644
--- a/src/bootstrap/format.rs
+++ b/src/bootstrap/format.rs
@@ -96,7 +96,7 @@ pub fn format(build: &Build, check: bool, paths: &[PathBuf]) {
                     entry.split(' ').nth(1).expect("every git status entry should list a path")
                 });
             for untracked_path in untracked_paths {
-                eprintln!("skip untracked path {} during rustfmt invocations", untracked_path);
+                println!("skip untracked path {} during rustfmt invocations", untracked_path);
                 // The leading `/` makes it an exact match against the
                 // repository root, rather than a glob. Without that, if you
                 // have `foo.rs` in the repository root it will also match
@@ -105,10 +105,10 @@ pub fn format(build: &Build, check: bool, paths: &[PathBuf]) {
                 ignore_fmt.add(&format!("!/{}", untracked_path)).expect(&untracked_path);
             }
         } else {
-            eprintln!("Not in git tree. Skipping git-aware format checks");
+            println!("Not in git tree. Skipping git-aware format checks");
         }
     } else {
-        eprintln!("Could not find usable git. Skipping git-aware format checks");
+        println!("Could not find usable git. Skipping git-aware format checks");
     }
     let ignore_fmt = ignore_fmt.build().unwrap();
 
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 591f9a1ca50..0f0cf0762ab 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -689,9 +689,9 @@ impl Build {
         // Check for postponed failures from `test --no-fail-fast`.
         let failures = self.delayed_failures.borrow();
         if failures.len() > 0 {
-            println!("\n{} command(s) did not execute successfully:\n", failures.len());
+            eprintln!("\n{} command(s) did not execute successfully:\n", failures.len());
             for failure in failures.iter() {
-                println!("  - {}\n", failure);
+                eprintln!("  - {}\n", failure);
             }
             process::exit(1);
         }
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 09b8cbe9014..7bfcfcdef2c 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -138,10 +138,10 @@ pub(crate) fn maybe_download_ci_llvm(builder: &Builder<'_>) {
     let llvm_sha = llvm_sha.trim();
 
     if llvm_sha == "" {
-        println!("error: could not find commit hash for downloading LLVM");
-        println!("help: maybe your repository history is too shallow?");
-        println!("help: consider disabling `download-ci-llvm`");
-        println!("help: or fetch enough history to include one upstream commit");
+        eprintln!("error: could not find commit hash for downloading LLVM");
+        eprintln!("help: maybe your repository history is too shallow?");
+        eprintln!("help: consider disabling `download-ci-llvm`");
+        eprintln!("help: or fetch enough history to include one upstream commit");
         panic!();
     }
 
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index b730730854f..82f55440ce5 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -85,12 +85,12 @@ pub fn setup(config: &Config, profile: Profile) {
     let path = &config.config;
 
     if path.exists() {
-        println!(
+        eprintln!(
             "error: you asked `x.py` to setup a new config file, but one already exists at `{}`",
             path.display()
         );
-        println!("help: try adding `profile = \"{}\"` at the top of {}", profile, path.display());
-        println!(
+        eprintln!("help: try adding `profile = \"{}\"` at the top of {}", profile, path.display());
+        eprintln!(
             "note: this will use the configuration in {}",
             profile.include_path(&config.src).display()
         );
@@ -115,7 +115,7 @@ pub fn setup(config: &Config, profile: Profile) {
     println!();
 
     if !rustup_installed() && profile != Profile::User {
-        println!("`rustup` is not installed; cannot link `stage1` toolchain");
+        eprintln!("`rustup` is not installed; cannot link `stage1` toolchain");
     } else if stage_dir_exists(&stage_path[..]) {
         attempt_toolchain_link(&stage_path[..]);
     }
@@ -173,7 +173,7 @@ fn attempt_toolchain_link(stage_path: &str) {
     }
 
     if !ensure_stage1_toolchain_placeholder_exists(stage_path) {
-        println!(
+        eprintln!(
             "Failed to create a template for stage 1 toolchain or confirm that it already exists"
         );
         return;
@@ -184,8 +184,8 @@ fn attempt_toolchain_link(stage_path: &str) {
             "Added `stage1` rustup toolchain; try `cargo +stage1 build` on a separate rust project to run a newly-built toolchain"
         );
     } else {
-        println!("`rustup` failed to link stage 1 build to `stage1` toolchain");
-        println!(
+        eprintln!("`rustup` failed to link stage 1 build to `stage1` toolchain");
+        eprintln!(
             "To manually link stage 1 build to `stage1` toolchain, run:\n
             `rustup toolchain link stage1 {}`",
             &stage_path
@@ -292,8 +292,8 @@ pub fn interactive_path() -> io::Result<Profile> {
         break match parse_with_abbrev(&input) {
             Ok(profile) => profile,
             Err(err) => {
-                println!("error: {}", err);
-                println!("note: press Ctrl+C to exit");
+                eprintln!("error: {}", err);
+                eprintln!("note: press Ctrl+C to exit");
                 continue;
             }
         };
@@ -320,8 +320,8 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
             "y" | "yes" => true,
             "n" | "no" | "" => false,
             _ => {
-                println!("error: unrecognized option '{}'", input.trim());
-                println!("note: press Ctrl+C to exit");
+                eprintln!("error: unrecognized option '{}'", input.trim());
+                eprintln!("note: press Ctrl+C to exit");
                 continue;
             }
         };
@@ -337,7 +337,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
         ));
         let dst = git.join("hooks").join("pre-push");
         match fs::hard_link(src, &dst) {
-            Err(e) => println!(
+            Err(e) => eprintln!(
                 "error: could not create hook {}: do you already have the git hook installed?\n{}",
                 dst.display(),
                 e
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 2f4d07d77a5..f39cbb57b82 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -152,43 +152,43 @@ impl Step for ToolBuild {
         });
 
         if is_expected && !duplicates.is_empty() {
-            println!(
+            eprintln!(
                 "duplicate artifacts found when compiling a tool, this \
                       typically means that something was recompiled because \
                       a transitive dependency has different features activated \
                       than in a previous build:\n"
             );
-            println!(
+            eprintln!(
                 "the following dependencies are duplicated although they \
                       have the same features enabled:"
             );
             let (same, different): (Vec<_>, Vec<_>) =
                 duplicates.into_iter().partition(|(_, cur, prev)| cur.2 == prev.2);
             for (id, cur, prev) in same {
-                println!("  {}", id);
+                eprintln!("  {}", id);
                 // same features
-                println!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
+                eprintln!("    `{}` ({:?})\n    `{}` ({:?})", cur.0, cur.1, prev.0, prev.1);
             }
-            println!("the following dependencies have different features:");
+            eprintln!("the following dependencies have different features:");
             for (id, cur, prev) in different {
-                println!("  {}", id);
+                eprintln!("  {}", id);
                 let cur_features: HashSet<_> = cur.2.into_iter().collect();
                 let prev_features: HashSet<_> = prev.2.into_iter().collect();
-                println!(
+                eprintln!(
                     "    `{}` additionally enabled features {:?} at {:?}",
                     cur.0,
                     &cur_features - &prev_features,
                     cur.1
                 );
-                println!(
+                eprintln!(
                     "    `{}` additionally enabled features {:?} at {:?}",
                     prev.0,
                     &prev_features - &cur_features,
                     prev.1
                 );
             }
-            println!();
-            println!(
+            eprintln!();
+            eprintln!(
                 "to fix this you will probably want to edit the local \
                       src/tools/rustc-workspace-hack/Cargo.toml crate, as \
                       that will update the dependency graph to ensure that \
diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs
index 710b3588b84..848d9a7dc92 100644
--- a/src/bootstrap/util.rs
+++ b/src/bootstrap/util.rs
@@ -455,7 +455,7 @@ fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
 }
 
 fn fail(s: &str) -> ! {
-    println!("\n\n{}\n\n", s);
+    eprintln!("\n\n{}\n\n", s);
     std::process::exit(1);
 }
 
diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js
index 7afd09b34d3..997def1657f 100644
--- a/src/librustdoc/html/static/.eslintrc.js
+++ b/src/librustdoc/html/static/.eslintrc.js
@@ -54,5 +54,14 @@ module.exports = {
         "comma-style": ["error", "last"],
         "max-len": ["error", { "code": 100, "tabWidth": 4 }],
         "eol-last": ["error", "always"],
+        "arrow-parens": ["error", "as-needed"],
+        "no-unused-vars": [
+            "error",
+            {
+                "argsIgnorePattern": "^_",
+                "varsIgnorePattern": "^_"
+            }
+        ],
+        "eqeqeq": "error",
     }
 };
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 0fbc2d0e33c..548aeedd033 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -97,12 +97,12 @@ function showMain() {
 //
 // So I guess you could say things are getting pretty interoperable.
 function getVirtualKey(ev) {
-    if ("key" in ev && typeof ev.key != "undefined") {
+    if ("key" in ev && typeof ev.key !== "undefined") {
         return ev.key;
     }
 
     const c = ev.charCode || ev.keyCode;
-    if (c == 27) {
+    if (c === 27) {
         return "Escape";
     }
     return String.fromCharCode(c);
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index c784d69dcd6..c726aeeff47 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -70,7 +70,7 @@ function printTab(nb) {
     });
     if (foundCurrentTab && foundCurrentResultSet) {
         searchState.currentTab = nb;
-    } else if (nb != 0) {
+    } else if (nb !== 0) {
         printTab(0);
     }
 }
@@ -200,7 +200,7 @@ function initSearch(rawSearchIndex) {
      * @return {boolean}
      */
     function isPathStart(parserState) {
-        return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) == "::";
+        return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) === "::";
     }
 
     /**
@@ -211,7 +211,7 @@ function initSearch(rawSearchIndex) {
      * @return {boolean}
      */
     function isReturnArrow(parserState) {
-        return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) == "->";
+        return parserState.userQuery.slice(parserState.pos, parserState.pos + 2) === "->";
     }
 
     /**
@@ -1726,7 +1726,7 @@ function initSearch(rawSearchIndex) {
             crates = " in <select id=\"crate-search\"><option value=\"All crates\">" +
                 "All crates</option>";
             for (const c of window.ALL_CRATES) {
-                crates += `<option value="${c}" ${c == filterCrates && "selected"}>${c}</option>`;
+                crates += `<option value="${c}" ${c === filterCrates && "selected"}>${c}</option>`;
             }
             crates += "</select>";
         }
diff --git a/src/test/ui/borrowck/issue-81899.rs b/src/test/ui/borrowck/issue-81899.rs
new file mode 100644
index 00000000000..356517745ff
--- /dev/null
+++ b/src/test/ui/borrowck/issue-81899.rs
@@ -0,0 +1,13 @@
+// Regression test for #81899.
+// The `panic!()` below is important to trigger the fixed ICE.
+
+const _CONST: &[u8] = &f(&[], |_| {});
+
+const fn f<F>(_: &[u8], _: F) -> &[u8]
+where
+    F: FnMut(&u8),
+{
+    panic!() //~ ERROR: evaluation of constant value failed
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-81899.stderr b/src/test/ui/borrowck/issue-81899.stderr
new file mode 100644
index 00000000000..59bf00d0012
--- /dev/null
+++ b/src/test/ui/borrowck/issue-81899.stderr
@@ -0,0 +1,17 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/issue-81899.rs:10:5
+   |
+LL | const _CONST: &[u8] = &f(&[], |_| {});
+   |                        -------------- inside `_CONST` at $DIR/issue-81899.rs:4:24
+...
+LL |     panic!()
+   |     ^^^^^^^^
+   |     |
+   |     the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:10:5
+   |     inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/derives/issue-97343.rs b/src/test/ui/derives/issue-97343.rs
new file mode 100644
index 00000000000..adec6c7a5c5
--- /dev/null
+++ b/src/test/ui/derives/issue-97343.rs
@@ -0,0 +1,8 @@
+use std::fmt::Debug;
+
+#[derive(Debug)]
+pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed for this type
+    irrelevant: Irrelevant,
+}
+
+fn main() {}
diff --git a/src/test/ui/derives/issue-97343.stderr b/src/test/ui/derives/issue-97343.stderr
new file mode 100644
index 00000000000..eedd54f1e9f
--- /dev/null
+++ b/src/test/ui/derives/issue-97343.stderr
@@ -0,0 +1,13 @@
+error[E0109]: type arguments are not allowed for this type
+  --> $DIR/issue-97343.rs:4:23
+   |
+LL | #[derive(Debug)]
+   |          ----- in this derive macro expansion
+LL | pub struct Irrelevant<Irrelevant> {
+   |                       ^^^^^^^^^^ type argument not allowed
+   |
+   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0109`.