diff options
| author | bors <bors@rust-lang.org> | 2021-08-23 20:10:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-23 20:10:29 +0000 |
| commit | a49e38e672c60da788360e088f00ad12353e3913 (patch) | |
| tree | 4fa9f598720e53ebe4efbe6499c6d61dcf120326 /src | |
| parent | 9583fd1bdd0127328e25e5b8c24dff575ec2c86b (diff) | |
| parent | e7101326160ebf6642339a5099d22f6502bf2ae4 (diff) | |
| download | rust-a49e38e672c60da788360e088f00ad12353e3913.tar.gz rust-a49e38e672c60da788360e088f00ad12353e3913.zip | |
Auto merge of #88265 - m-ou-se:rollup-soymv20, r=m-ou-se
Rollup of 6 pull requests Successful merges: - #87976 (Account for tabs when highlighting multiline code suggestions) - #88174 (Clarify some wording in Rust 2021 lint docs) - #88188 (Greatly improve limitation handling on parallel rustdoc GUI test run) - #88230 (Fix typos “a”→“an”) - #88232 (Add notes to macro-not-found diagnostics to point out how things with the same name were not a match.) - #88259 (Do not mark `-Z thir-unsafeck` as unsound anymore) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
45 files changed, 256 insertions, 51 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index d45f277a0a8..1830909d944 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -22,7 +22,7 @@ use crate::html::render::IndexItem; /// /// This structure purposefully does not implement `Clone` because it's intended /// to be a fairly large and expensive structure to clone. Instead this adheres -/// to `Send` so it may be stored in a `Arc` instance and shared among the various +/// to `Send` so it may be stored in an `Arc` instance and shared among the various /// rendering threads. #[derive(Default)] crate struct Cache { diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 76e7295bce3..5eb545f7582 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1331,7 +1331,7 @@ window.initSearch = function(rawSearchIndex) { // an array of [(Number) item type, // (String) name] var paths = rawSearchIndex[crate].p; - // a array of [(String) alias name + // an array of [(String) alias name // [Number] index to items] var aliases = rawSearchIndex[crate].a; diff --git a/src/test/incremental/thinlto/cgu_invalidated_when_import_removed.rs b/src/test/incremental/thinlto/cgu_invalidated_when_import_removed.rs index 1214e37f982..fc53acf75cb 100644 --- a/src/test/incremental/thinlto/cgu_invalidated_when_import_removed.rs +++ b/src/test/incremental/thinlto/cgu_invalidated_when_import_removed.rs @@ -8,7 +8,7 @@ // functions and the modules are enclosed in `[]`) // // In our specific instance, the earlier compilations were inlining the call -// to`B` into `A`; thus `A` ended up with a external reference to the symbol `D` +// to`B` into `A`; thus `A` ended up with an external reference to the symbol `D` // in its object code, to be resolved at subsequent link time. The LTO import // information provided by LLVM for those runs reflected that information: it // explicitly says during those runs, `B` definition and `D` declaration were diff --git a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs index 41796247789..a5fb0f640b2 100644 --- a/src/test/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/src/test/mir-opt/dest-prop/copy_propagation_arg.rs @@ -7,7 +7,7 @@ fn dummy(x: u8) -> u8 { // EMIT_MIR copy_propagation_arg.foo.DestinationPropagation.diff fn foo(mut x: u8) { - // calling `dummy` to make an use of `x` that copyprop cannot eliminate + // calling `dummy` to make a use of `x` that copyprop cannot eliminate x = dummy(x); // this will assign a local to `x` } diff --git a/src/test/rustdoc-ui/coverage/allow_missing_docs.rs b/src/test/rustdoc-ui/coverage/allow_missing_docs.rs index c077be31b20..c771c09da88 100644 --- a/src/test/rustdoc-ui/coverage/allow_missing_docs.rs +++ b/src/test/rustdoc-ui/coverage/allow_missing_docs.rs @@ -8,7 +8,7 @@ pub mod mod_foo { pub struct Bar; } -/// This is a struct with a `#[allow(missing_docs)]` +/// This is a struct with an `#[allow(missing_docs)]` pub struct AllowTheMissingDocs { #[allow(missing_docs)] pub empty_str: String, diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs index 25f6490aa35..48b140d9174 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs @@ -1,6 +1,6 @@ // compile-flags: -Z unstable-options // NOTE: This test doesn't actually require `fulldeps` -// so we could instead use it as an `ui` test. +// so we could instead use it as a `ui` test. // // Considering that all other `internal-lints` are tested here // this seems like the cleaner solution though. diff --git a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs b/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs index 4ec43708584..edfecb91036 100644 --- a/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs +++ b/src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs @@ -10,7 +10,7 @@ // Test the drop order for parameters relative to local variables and // temporaries created in the tail return expression of the function // body. In particular, check that this drop order is the same between -// a `async fn` and an ordinary `fn`. See #64512. +// an `async fn` and an ordinary `fn`. See #64512. extern crate arc_wake; diff --git a/src/test/ui/async-await/issues/issue-53249.rs b/src/test/ui/async-await/issues/issue-53249.rs index e9079bfdd85..3a33af2d2ee 100644 --- a/src/test/ui/async-await/issues/issue-53249.rs +++ b/src/test/ui/async-await/issues/issue-53249.rs @@ -8,7 +8,7 @@ use std::future::Future; use std::marker::Unpin; use std::pin::Pin; -// This is a regression test for a ICE/unbounded recursion issue relating to async-await. +// This is a regression test for an ICE/unbounded recursion issue relating to async-await. #[derive(Debug)] #[must_use = "futures do nothing unless polled"] diff --git a/src/test/ui/async-await/issues/issue-69307.rs b/src/test/ui/async-await/issues/issue-69307.rs index 4dae96ec8a6..59309a7f288 100644 --- a/src/test/ui/async-await/issues/issue-69307.rs +++ b/src/test/ui/async-await/issues/issue-69307.rs @@ -1,6 +1,6 @@ // Regression test for #69307 // -// Having a `async { .. foo.await .. }` block appear inside of a `+=` +// Having an `async { .. foo.await .. }` block appear inside of a `+=` // expression was causing an ICE due to a failure to save/restore // state in the AST numbering pass when entering a nested body. // diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed index 982407e2e25..c82bc369f43 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.fixed @@ -3,7 +3,7 @@ #![deny(rust_2021_incompatible_closure_captures)] //~^ NOTE: the lint level is defined here -// Test cases for types that implement a insignificant drop (stlib defined) +// Test cases for types that implement an insignificant drop (stlib defined) // `t` needs Drop because one of its elements needs drop, // therefore precise capture might affect drop ordering diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs index 1ac034959cb..57ab15ae8f2 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs @@ -3,7 +3,7 @@ #![deny(rust_2021_incompatible_closure_captures)] //~^ NOTE: the lint level is defined here -// Test cases for types that implement a insignificant drop (stlib defined) +// Test cases for types that implement an insignificant drop (stlib defined) // `t` needs Drop because one of its elements needs drop, // therefore precise capture might affect drop ordering diff --git a/src/test/ui/consts/cast-discriminant-zst-enum.rs b/src/test/ui/consts/cast-discriminant-zst-enum.rs index 66b76627c02..e59ae297da1 100644 --- a/src/test/ui/consts/cast-discriminant-zst-enum.rs +++ b/src/test/ui/consts/cast-discriminant-zst-enum.rs @@ -1,5 +1,5 @@ // run-pass -// Test a ZST enum whose dicriminant is ~0i128. This caused an ICE when casting to a i32. +// Test a ZST enum whose dicriminant is ~0i128. This caused an ICE when casting to an i32. #![feature(bench_black_box)] use std::hint::black_box; diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs b/src/test/ui/hrtb/hrtb-exists-forall-fn.rs index 828331cb950..56780237618 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.rs @@ -1,4 +1,4 @@ -// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! // // In particular, we test this pattern in trait solving, where it is not connected // to any part of the source code. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs index b1b7ec6bcf1..9b9e4496a87 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs @@ -1,4 +1,4 @@ -// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! // // In particular, we test this pattern in trait solving, where it is not connected // to any part of the source code. diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr index f021943da32..84746ca2c88 100644 --- a/src/test/ui/issues/issue-11692-2.stderr +++ b/src/test/ui/issues/issue-11692-2.stderr @@ -3,6 +3,8 @@ error: cannot find macro `test` in this scope | LL | concat!(test!()); | ^^^^ + | + = note: `test` is in scope, but it is an attribute: `#[test]` error: aborting due to previous error diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs index 527d0ea9432..7c45c099304 100644 --- a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs +++ b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs @@ -30,7 +30,7 @@ struct 对__否; struct ヒ__χ; //~^ ERROR type `ヒ__χ` should have an upper camel case name -// also cannot have lowercase letter next to a underscore. +// also cannot have lowercase letter next to an underscore. // so this triggers the lint: struct Hello_你好; diff --git a/src/test/ui/macros/issue-88206.rs b/src/test/ui/macros/issue-88206.rs new file mode 100644 index 00000000000..14e2f66068b --- /dev/null +++ b/src/test/ui/macros/issue-88206.rs @@ -0,0 +1,66 @@ +// compile-flags: -Z deduplicate-diagnostics=yes + +#![warn(unused_imports)] + +use std::str::*; +//~^ NOTE `from_utf8` is imported here, but it is a function +//~| NOTE `from_utf8_mut` is imported here, but it is a function +//~| NOTE `from_utf8_unchecked` is imported here, but it is a function + +mod hey { + pub trait Serialize {} + pub trait Deserialize {} + + pub struct X(i32); +} + +use hey::{Serialize, Deserialize, X}; +//~^ NOTE `Serialize` is imported here, but it is only a trait, without a derive macro +//~| NOTE `Deserialize` is imported here, but it is a trait +//~| NOTE `X` is imported here, but it is a struct + +#[derive(Serialize)] +//~^ ERROR cannot find derive macro `Serialize` +struct A; + +#[derive(from_utf8_mut)] +//~^ ERROR cannot find derive macro `from_utf8_mut` +struct B; + +#[derive(println)] +//~^ ERROR cannot find derive macro `println` +//~| NOTE `println` is in scope, but it is a function-like macro +struct C; + +#[Deserialize] +//~^ ERROR cannot find attribute `Deserialize` +struct D; + +#[from_utf8_unchecked] +//~^ ERROR cannot find attribute `from_utf8_unchecked` +struct E; + +#[println] +//~^ ERROR cannot find attribute `println` +//~| NOTE `println` is in scope, but it is a function-like macro +struct F; + +fn main() { + from_utf8!(); + //~^ ERROR cannot find macro `from_utf8` + + Box!(); + //~^ ERROR cannot find macro `Box` + //~| NOTE `Box` is in scope, but it is a struct + + Copy!(); + //~^ ERROR cannot find macro `Copy` + //~| NOTE `Copy` is in scope, but it is a derive macro + + test!(); + //~^ ERROR cannot find macro `test` + //~| NOTE `test` is in scope, but it is an attribute + + X!(); + //~^ ERROR cannot find macro `X` +} diff --git a/src/test/ui/macros/issue-88206.stderr b/src/test/ui/macros/issue-88206.stderr new file mode 100644 index 00000000000..f7f5b564880 --- /dev/null +++ b/src/test/ui/macros/issue-88206.stderr @@ -0,0 +1,114 @@ +error: cannot find macro `X` in this scope + --> $DIR/issue-88206.rs:64:5 + | +LL | X!(); + | ^ + | +note: `X` is imported here, but it is a struct, not a macro + --> $DIR/issue-88206.rs:17:35 + | +LL | use hey::{Serialize, Deserialize, X}; + | ^ + +error: cannot find macro `test` in this scope + --> $DIR/issue-88206.rs:60:5 + | +LL | test!(); + | ^^^^ + | + = note: `test` is in scope, but it is an attribute: `#[test]` + +error: cannot find macro `Copy` in this scope + --> $DIR/issue-88206.rs:56:5 + | +LL | Copy!(); + | ^^^^ + | + = note: `Copy` is in scope, but it is a derive macro: `#[derive(Copy)]` + +error: cannot find macro `Box` in this scope + --> $DIR/issue-88206.rs:52:5 + | +LL | Box!(); + | ^^^ + | + = note: `Box` is in scope, but it is a struct, not a macro + +error: cannot find macro `from_utf8` in this scope + --> $DIR/issue-88206.rs:49:5 + | +LL | from_utf8!(); + | ^^^^^^^^^ + | +note: `from_utf8` is imported here, but it is a function, not a macro + --> $DIR/issue-88206.rs:5:5 + | +LL | use std::str::*; + | ^^^^^^^^^^^ + +error: cannot find attribute `println` in this scope + --> $DIR/issue-88206.rs:43:3 + | +LL | #[println] + | ^^^^^^^ + | + = note: `println` is in scope, but it is a function-like macro + +error: cannot find attribute `from_utf8_unchecked` in this scope + --> $DIR/issue-88206.rs:39:3 + | +LL | #[from_utf8_unchecked] + | ^^^^^^^^^^^^^^^^^^^ + | +note: `from_utf8_unchecked` is imported here, but it is a function, not an attribute + --> $DIR/issue-88206.rs:5:5 + | +LL | use std::str::*; + | ^^^^^^^^^^^ + +error: cannot find attribute `Deserialize` in this scope + --> $DIR/issue-88206.rs:35:3 + | +LL | #[Deserialize] + | ^^^^^^^^^^^ + | +note: `Deserialize` is imported here, but it is a trait, not an attribute + --> $DIR/issue-88206.rs:17:22 + | +LL | use hey::{Serialize, Deserialize, X}; + | ^^^^^^^^^^^ + +error: cannot find derive macro `println` in this scope + --> $DIR/issue-88206.rs:30:10 + | +LL | #[derive(println)] + | ^^^^^^^ + | + = note: `println` is in scope, but it is a function-like macro + +error: cannot find derive macro `from_utf8_mut` in this scope + --> $DIR/issue-88206.rs:26:10 + | +LL | #[derive(from_utf8_mut)] + | ^^^^^^^^^^^^^ + | +note: `from_utf8_mut` is imported here, but it is a function, not a derive macro + --> $DIR/issue-88206.rs:5:5 + | +LL | use std::str::*; + | ^^^^^^^^^^^ + +error: cannot find derive macro `Serialize` in this scope + --> $DIR/issue-88206.rs:22:10 + | +LL | #[derive(Serialize)] + | ^^^^^^^^^ + | +note: `Serialize` is imported here, but it is only a trait, without a derive macro + --> $DIR/issue-88206.rs:17:11 + | +LL | use hey::{Serialize, Deserialize, X}; + | ^^^^^^^^^ + +error: aborting due to 11 previous errors + diff --git a/src/test/ui/macros/issue-88228.rs b/src/test/ui/macros/issue-88228.rs index 615b865e9f1..cbdef5f0d40 100644 --- a/src/test/ui/macros/issue-88228.rs +++ b/src/test/ui/macros/issue-88228.rs @@ -13,6 +13,7 @@ struct A; #[derive(println)] //~^ ERROR cannot find derive macro `println` +//~|`println` is in scope, but it is a function-like macro struct B; fn main() { diff --git a/src/test/ui/macros/issue-88228.stderr b/src/test/ui/macros/issue-88228.stderr index b164e39064c..62afa67a783 100644 --- a/src/test/ui/macros/issue-88228.stderr +++ b/src/test/ui/macros/issue-88228.stderr @@ -1,5 +1,5 @@ error: cannot find macro `bla` in this scope - --> $DIR/issue-88228.rs:19:5 + --> $DIR/issue-88228.rs:20:5 | LL | bla!(); | ^^^ @@ -12,6 +12,8 @@ error: cannot find derive macro `println` in this scope | LL | #[derive(println)] | ^^^^^^^ + | + = note: `println` is in scope, but it is a function-like macro error: cannot find derive macro `Bla` in this scope --> $DIR/issue-88228.rs:9:10 diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr index 1abb501ec80..70900a6bc81 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr @@ -8,6 +8,8 @@ LL | inline!(); | LL | macro_rules! line { | ----------------- similarly named macro `line` defined here + | + = note: `inline` is in scope, but it is an attribute: `#[inline]` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs index 1983e13db0a..ebea6d3d9d1 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.rs @@ -1,4 +1,4 @@ -// This test enumerates various cases of interest where a ADT or tuple is +// This test enumerates various cases of interest where an ADT or tuple is // partially initialized and then used in some way that is wrong *even* // after rust-lang/rust#54987 is implemented. // diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr index a617319faea..633a6c6a0d3 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -93,30 +93,40 @@ error: cannot find macro `my_macro_attr` in this scope | LL | my_macro_attr!(); | ^^^^^^^^^^^^^ + | + = note: `my_macro_attr` is in scope, but it is an attribute: `#[my_macro_attr]` error: cannot find macro `MyTrait` in this scope --> $DIR/macro-namespace-reserved-2.rs:33:5 | LL | MyTrait!(); | ^^^^^^^ + | + = note: `MyTrait` is in scope, but it is a derive macro: `#[derive(MyTrait)]` error: cannot find attribute `my_macro` in this scope --> $DIR/macro-namespace-reserved-2.rs:38:3 | LL | #[my_macro] | ^^^^^^^^ + | + = note: `my_macro` is in scope, but it is a function-like macro error: cannot find derive macro `my_macro` in this scope --> $DIR/macro-namespace-reserved-2.rs:48:10 | LL | #[derive(my_macro)] | ^^^^^^^^ + | + = note: `my_macro` is in scope, but it is a function-like macro error: cannot find derive macro `my_macro` in this scope --> $DIR/macro-namespace-reserved-2.rs:48:10 | LL | #[derive(my_macro)] | ^^^^^^^^ + | + = note: `my_macro` is in scope, but it is a function-like macro error: aborting due to 20 previous errors diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.rs b/src/test/ui/rfc-2008-non-exhaustive/enum.rs index 73e0b98296b..9d2855f5c61 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.rs @@ -30,7 +30,7 @@ fn main() { match enum_unit { NonExhaustiveEnum::Unit => 1, NonExhaustiveEnum::Tuple(_) => 2, - // This particular arm tests that a enum marked as non-exhaustive + // This particular arm tests that an enum marked as non-exhaustive // will not error if its variants are matched exhaustively. NonExhaustiveEnum::Struct { field } => field, _ => 0 // no error with wildcard diff --git a/src/test/ui/traits/reservation-impl/non-lattice-ok.rs b/src/test/ui/traits/reservation-impl/non-lattice-ok.rs index b894577c1f7..a71051243c8 100644 --- a/src/test/ui/traits/reservation-impl/non-lattice-ok.rs +++ b/src/test/ui/traits/reservation-impl/non-lattice-ok.rs @@ -5,7 +5,7 @@ // Why did we ever want to do this? // -// We want to eventually add a `impl<T> From<!> for T` impl. That impl conflicts +// We want to eventually add an `impl<T> From<!> for T` impl. That impl conflicts // with existing impls - at least the `impl<T> From<T> for T` impl. There are // 2 ways we thought of for dealing with that conflict: // @@ -23,7 +23,7 @@ // actually cause any ambiguity. // // Now it turned out lattice specialization doesn't work it, because an -// `impl<T> From<T> for Smaht<T>` would require a `impl From<!> for Smaht<!>`, +// `impl<T> From<T> for Smaht<T>` would require an `impl From<!> for Smaht<!>`, // breaking backwards-compatibility in a fairly painful way. So if we want to // go with a known approach, we should go with a "marker trait overlap"-style // approach. diff --git a/src/test/ui/union/union-nonzero.rs b/src/test/ui/union/union-nonzero.rs index d29e7a97180..3f4f7ea1c10 100644 --- a/src/test/ui/union/union-nonzero.rs +++ b/src/test/ui/union/union-nonzero.rs @@ -13,7 +13,7 @@ // optimizations to types containing unions even if they're theoretically possible. (discussion: // https://github.com/rust-lang/rust/issues/36394) // -// Notably this nails down part of the behavior that `MaybeUninit` assumes: that a +// Notably this nails down part of the behavior that `MaybeUninit` assumes: that an // `Option<MaybeUninit<&u8>>` does not take advantage of non-zero optimization, and thus is a safe // construct. diff --git a/src/tools/clippy/clippy_lints/src/formatting.rs b/src/tools/clippy/clippy_lints/src/formatting.rs index b4cf1971d78..4dd0ffe77ea 100644 --- a/src/tools/clippy/clippy_lints/src/formatting.rs +++ b/src/tools/clippy/clippy_lints/src/formatting.rs @@ -164,7 +164,7 @@ fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) { if !differing_macro_contexts(lhs.span, rhs.span) && !lhs.span.from_expansion(); // span between BinOp LHS and RHS let binop_span = lhs.span.between(rhs.span); - // if RHS is a UnOp + // if RHS is an UnOp if let ExprKind::Unary(op, ref un_rhs) = rhs.kind; // from UnOp operator to UnOp operand let unop_operand_span = rhs.span.until(un_rhs.span); diff --git a/src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs b/src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs index 2525b14e1c5..2296842e86f 100644 --- a/src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs +++ b/src/tools/clippy/clippy_lints/src/loops/manual_memcpy.rs @@ -268,7 +268,7 @@ impl std::ops::Sub<&MinifyingSugg<'static>> for MinifyingSugg<'static> { } } -/// a wrapper around `MinifyingSugg`, which carries a operator like currying +/// a wrapper around `MinifyingSugg`, which carries an operator like currying /// so that the suggested code become more efficient (e.g. `foo + -bar` `foo - bar`). struct Offset { value: MinifyingSugg<'static>, diff --git a/src/tools/clippy/clippy_lints/src/non_copy_const.rs b/src/tools/clippy/clippy_lints/src/non_copy_const.rs index aa3067876eb..3f9110295fc 100644 --- a/src/tools/clippy/clippy_lints/src/non_copy_const.rs +++ b/src/tools/clippy/clippy_lints/src/non_copy_const.rs @@ -122,7 +122,7 @@ fn is_unfrozen<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool { // Ignore types whose layout is unknown since `is_freeze` reports every generic types as `!Freeze`, // making it indistinguishable from `UnsafeCell`. i.e. it isn't a tool to prove a type is // 'unfrozen'. However, this code causes a false negative in which - // a type contains a layout-unknown type, but also a unsafe cell like `const CELL: Cell<T>`. + // a type contains a layout-unknown type, but also an unsafe cell like `const CELL: Cell<T>`. // Yet, it's better than `ty.has_type_flags(TypeFlags::HAS_TY_PARAM | TypeFlags::HAS_PROJECTION)` // since it works when a pointer indirection involves (`Cell<*const T>`). // Making up a `ParamEnv` where every generic params and assoc types are `Freeze`is another option; @@ -266,7 +266,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst { // in other words, lint consts whose value *could* be unfrozen, not definitely is. // This feels inconsistent with how the lint treats generic types, // which avoids linting types which potentially become unfrozen. - // One could check whether a unfrozen type have a *frozen variant* + // One could check whether an unfrozen type have a *frozen variant* // (like `body_id_opt.map_or_else(|| !has_frozen_variant(...), ...)`), // and do the same as the case of generic types at impl items. // Note that it isn't sufficient to check if it has an enum @@ -293,7 +293,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst { }) => { if_chain! { // Lint a trait impl item only when the definition is a generic type, - // assuming a assoc const is not meant to be a interior mutable type. + // assuming an assoc const is not meant to be an interior mutable type. if let Some(of_trait_def_id) = of_trait_ref.trait_def_id(); if let Some(of_assoc_item) = specialization_graph::Node::Trait(of_trait_def_id) .item(cx.tcx, impl_item.ident, AssocKind::Const, of_trait_def_id); diff --git a/src/tools/clippy/clippy_lints/src/ptr_eq.rs b/src/tools/clippy/clippy_lints/src/ptr_eq.rs index d6d7049fb61..3258c9fb3fe 100644 --- a/src/tools/clippy/clippy_lints/src/ptr_eq.rs +++ b/src/tools/clippy/clippy_lints/src/ptr_eq.rs @@ -74,7 +74,7 @@ impl LateLintPass<'_> for PtrEq { } } -// If the given expression is a cast to an usize, return the lhs of the cast +// If the given expression is a cast to a usize, return the lhs of the cast // E.g., `foo as *const _ as usize` returns `foo as *const _`. fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { if cx.typeck_results().expr_ty(cast_expr) == cx.tcx.types.usize { diff --git a/src/tools/clippy/clippy_lints/src/ranges.rs b/src/tools/clippy/clippy_lints/src/ranges.rs index 0114a2f97a2..4fa361fedaf 100644 --- a/src/tools/clippy/clippy_lints/src/ranges.rs +++ b/src/tools/clippy/clippy_lints/src/ranges.rs @@ -51,7 +51,7 @@ declare_clippy_lint! { /// /// ### Known problems /// Will add unnecessary pair of parentheses when the - /// expression is not wrapped in a pair but starts with a opening parenthesis + /// expression is not wrapped in a pair but starts with an opening parenthesis /// and ends with a closing one. /// I.e., `let _ = (f()+1)..(f()+1)` results in `let _ = ((f()+1)..=f())`. /// diff --git a/src/tools/clippy/clippy_lints/src/shadow.rs b/src/tools/clippy/clippy_lints/src/shadow.rs index b28a37cabd4..b9e317a3cfd 100644 --- a/src/tools/clippy/clippy_lints/src/shadow.rs +++ b/src/tools/clippy/clippy_lints/src/shadow.rs @@ -74,7 +74,7 @@ declare_clippy_lint! { declare_clippy_lint! { /// ### What it does /// Checks for bindings that shadow other bindings already in - /// scope, either without a initialization or with one that does not even use + /// scope, either without an initialization or with one that does not even use /// the original value. /// /// ### Why is this bad? diff --git a/src/tools/clippy/clippy_lints/src/utils/conf.rs b/src/tools/clippy/clippy_lints/src/utils/conf.rs index a28b1d78f7d..c192f9094a8 100644 --- a/src/tools/clippy/clippy_lints/src/utils/conf.rs +++ b/src/tools/clippy/clippy_lints/src/utils/conf.rs @@ -198,7 +198,7 @@ define_Conf! { (enum_variant_name_threshold: u64 = 3), /// Lint: LARGE_ENUM_VARIANT. /// - /// The maximum size of a enum's variant to avoid box suggestion + /// The maximum size of an enum's variant to avoid box suggestion (enum_variant_size_threshold: u64 = 200), /// Lint: VERBOSE_BIT_MASK. /// diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs index 15c27d1a996..9ba1381da65 100644 --- a/src/tools/clippy/clippy_utils/src/consts.rs +++ b/src/tools/clippy/clippy_utils/src/consts.rs @@ -329,7 +329,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> { vec.iter().map(|elem| self.expr(elem)).collect::<Option<_>>() } - /// Lookup a possibly constant expression from a `ExprKind::Path`. + /// Lookup a possibly constant expression from an `ExprKind::Path`. fn fetch_path(&mut self, qpath: &QPath<'_>, id: HirId, ty: Ty<'tcx>) -> Option<Constant> { let res = self.typeck_results.qpath_res(qpath, id); match res { diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 2777e5bd0c4..32a73984674 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -587,7 +587,7 @@ pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Optio /// For example, if `e` represents the `v[0].a.b[x]` /// this method will return a tuple, composed of a `Vec` /// containing the `Expr`s for `v[0], v[0].a, v[0].a.b, v[0].a.b[x]` -/// and a `Expr` for root of them, `v` +/// and an `Expr` for root of them, `v` fn projection_stack<'a, 'hir>(mut e: &'a Expr<'hir>) -> (Vec<&'a Expr<'hir>>, &'a Expr<'hir>) { let mut result = vec![]; let root = loop { diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index 3b494e1fc85..65d93e8f86e 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -434,7 +434,7 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg<'_>, rhs: &Sugg<'_>) -> Sugg<'static> matches!(op, AssocOp::ShiftLeft | AssocOp::ShiftRight) } - /// Returns `true` if the operator is a arithmetic operator + /// Returns `true` if the operator is an arithmetic operator /// (i.e., `+`, `-`, `*`, `/`, `%`). fn is_arith(op: AssocOp) -> bool { matches!( diff --git a/src/tools/clippy/tests/ui/declare_interior_mutable_const/traits.rs b/src/tools/clippy/tests/ui/declare_interior_mutable_const/traits.rs index 535147ccc64..256a336db82 100644 --- a/src/tools/clippy/tests/ui/declare_interior_mutable_const/traits.rs +++ b/src/tools/clippy/tests/ui/declare_interior_mutable_const/traits.rs @@ -117,7 +117,7 @@ impl SelfType for AtomicUsize { const WRAPPED_SELF: Option<Self> = Some(AtomicUsize::new(21)); //~ ERROR interior mutable } -// Even though a constant contains a generic type, if it also have a interior mutable type, +// Even though a constant contains a generic type, if it also have an interior mutable type, // it should be linted at the definition site. trait BothOfCellAndGeneric<T> { // this is a false negative in the current implementation. diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index dee1d315b3d..f291918225f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1733,7 +1733,7 @@ impl<'test> TestCx<'test> { } /// For each `aux-build: foo/bar` annotation, we check to find the - /// file in a `auxiliary` directory relative to the test itself. + /// file in an `auxiliary` directory relative to the test itself. fn compute_aux_test_paths(&self, rel_ab: &str) -> TestPaths { let test_ab = self .testpaths diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index e697e1f86a9..d34dcc0f094 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -3,6 +3,7 @@ // ``` // npm install browser-ui-test // ``` + const fs = require("fs"); const path = require("path"); const os = require('os'); @@ -172,12 +173,14 @@ async function main(argv) { files.sort(); console.log(`Running ${files.length} rustdoc-gui tests...`); + if (opts["jobs"] < 1) { process.setMaxListeners(files.length + 1); } else { - process.setMaxListeners(opts["jobs"]); + process.setMaxListeners(opts["jobs"] + 1); } - let tests = []; + + const tests_queue = []; let results = { successful: [], failed: [], @@ -187,8 +190,7 @@ async function main(argv) { for (let i = 0; i < files.length; ++i) { const file_name = files[i]; const testPath = path.join(opts["tests_folder"], file_name); - tests.push( - runTest(testPath, options) + const callback = runTest(testPath, options) .then(out => { const [output, nb_failures] = out; results[nb_failures === 0 ? "successful" : "failed"].push({ @@ -196,10 +198,10 @@ async function main(argv) { output: output, }); if (nb_failures > 0) { - status_bar.erroneous() + status_bar.erroneous(); failed = true; } else { - status_bar.successful() + status_bar.successful(); } }) .catch(err => { @@ -210,13 +212,19 @@ async function main(argv) { status_bar.erroneous(); failed = true; }) - ); + .finally(() => { + // We now remove the promise from the tests_queue. + tests_queue.splice(tests_queue.indexOf(callback), 1); + }); + tests_queue.push(callback); if (no_headless) { - await tests[i]; + await tests_queue[i]; + } else if (opts["jobs"] > 0 && tests_queue.length >= opts["jobs"]) { + await Promise.race(tests_queue); } } - if (!no_headless) { - await Promise.all(tests); + if (!no_headless && tests_queue.length > 0) { + await Promise.all(tests_queue); } status_bar.finish(); diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index c8ee590b6cc..a9bc89544d8 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -401,7 +401,7 @@ fn rewrite_macro_inner( handle_vec_semi(context, shape, arg_vec, macro_name, style) } else { // If we are rewriting `vec!` macro or other special macros, - // then we can rewrite this as an usual array literal. + // then we can rewrite this as a usual array literal. // Otherwise, we must preserve the original existence of trailing comma. let macro_name = ¯o_name.as_str(); let mut force_trailing_comma = if trailing_comma { diff --git a/src/tools/rustfmt/src/string.rs b/src/tools/rustfmt/src/string.rs index 0cb9d817ca2..64ae15672df 100644 --- a/src/tools/rustfmt/src/string.rs +++ b/src/tools/rustfmt/src/string.rs @@ -153,7 +153,7 @@ pub(crate) fn rewrite_string<'a>( wrap_str(result, fmt.config.max_width(), fmt.shape) } -/// Returns the index to the end of the URL if the split at index of the given string includes an +/// Returns the index to the end of the URL if the split at index of the given string includes a /// URL or alike. Otherwise, returns `None`. fn detect_url(s: &[&str], index: usize) -> Option<usize> { let start = match s[..=index].iter().rposition(|g| is_whitespace(g)) { diff --git a/src/tools/rustfmt/src/visitor.rs b/src/tools/rustfmt/src/visitor.rs index 3f251bf7c16..770693d165b 100644 --- a/src/tools/rustfmt/src/visitor.rs +++ b/src/tools/rustfmt/src/visitor.rs @@ -36,7 +36,7 @@ pub(crate) struct SnippetProvider { big_snippet: Lrc<String>, /// A position of the start of `big_snippet`, used as an offset. start_pos: usize, - /// A end position of the file that this snippet lives. + /// An end position of the file that this snippet lives. end_pos: usize, } diff --git a/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs b/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs index 50d5cfa87c4..4c71a2c6ab9 100644 --- a/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs +++ b/src/tools/rustfmt/tests/source/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs b/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs index 9219a4a577f..b985dd8caa1 100644 --- a/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs +++ b/src/tools/rustfmt/tests/target/cfg_if/detect/arch/x86.rs @@ -2,7 +2,7 @@ //! //! The features are detected using the `detect_features` function below. //! This function uses the CPUID instruction to read the feature flags from the -//! CPU and encodes them in an `usize` where each bit position represents +//! CPU and encodes them in a `usize` where each bit position represents //! whether a feature is available (bit is set) or unavaiable (bit is cleared). //! //! The enum `Feature` is used to map bit positions to feature names, and the diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index d8d3dc3ddb1..022a3dfde82 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -66,7 +66,7 @@ enum LIUState { EXP_END, } -/// Returns `true` if `line` appears to be a line comment containing an URL, +/// Returns `true` if `line` appears to be a line comment containing a URL, /// possibly with a Markdown link label in front, and nothing else. /// The Markdown link label, if present, may not contain whitespace. /// Lines of this form are allowed to be overlength, because Markdown |
