From f52ebaa45dcb35a7dbb8fcb1a19ad41de02ab581 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Sun, 13 Feb 2022 17:08:30 +0100 Subject: [PATCH 1/9] document expectations for Waker::wake fixes #93961 --- library/core/src/task/wake.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 27af227a1f2..c3e6c1f84ad 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -219,6 +219,13 @@ unsafe impl Sync for Waker {} impl Waker { /// Wake up the task associated with this `Waker`. + /// + /// Multiple wake-ups (through clones of this `Waker` or `wake_by_ref`) may be + /// coalesced into a single `poll` invocation by the runtime, and as long as + /// the runtime keeps running and the task is not finished it is expected that + /// each wake-up is followed by an invocation of `poll`, even in the absence of + /// other events. This makes it possible to yield to other tasks when running + /// potentially unbounded processing loops in order to maintain fairness. #[inline] #[stable(feature = "futures_api", since = "1.36.0")] pub fn wake(self) { From 2946f7aad17c5445c3837a6691bf2b7f51e883a8 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Sun, 20 Feb 2022 12:23:26 +0100 Subject: [PATCH 2/9] improve wording of Waker::wake documentation --- library/core/src/task/wake.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index c3e6c1f84ad..301cfacb554 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -220,12 +220,14 @@ unsafe impl Sync for Waker {} impl Waker { /// Wake up the task associated with this `Waker`. /// - /// Multiple wake-ups (through clones of this `Waker` or `wake_by_ref`) may be - /// coalesced into a single `poll` invocation by the runtime, and as long as - /// the runtime keeps running and the task is not finished it is expected that - /// each wake-up is followed by an invocation of `poll`, even in the absence of - /// other events. This makes it possible to yield to other tasks when running - /// potentially unbounded processing loops in order to maintain fairness. + /// As long as the runtime keeps running and the task is not finished, it is + /// guaranteed that each invocation of `wake` (or `wake_by_ref`) will be followed + /// by at least one `poll` of the task to which this `Waker` belongs. This makes + /// it possible to temporarily yield to other tasks while running potentially + /// unbounded processing loops. + /// + /// Note that the above implies that multiple wake-ups may be coalesced into a + /// single `poll` invocation by the runtime. #[inline] #[stable(feature = "futures_api", since = "1.36.0")] pub fn wake(self) { From 3d808d52dec3db864532403f980a38ff98e3af8a Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 4 May 2022 10:58:23 +0200 Subject: [PATCH 3/9] add caveat discussed in #74335 --- library/core/src/task/wake.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 301cfacb554..9e74bcc541e 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -228,6 +228,10 @@ impl Waker { /// /// Note that the above implies that multiple wake-ups may be coalesced into a /// single `poll` invocation by the runtime. + /// + /// Also note that yielding to competing tasks is not guaranteed: it is the + /// executor’s choice which task to run and the executor may choose to run the + /// current task again. #[inline] #[stable(feature = "futures_api", since = "1.36.0")] pub fn wake(self) { From cd251fb48e93509b7ddb34aa973ef2c12e25e8dd Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 21 May 2022 20:59:51 +0200 Subject: [PATCH 4/9] Fix typo --- compiler/rustc_lint_defs/src/builtin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index f9429702783..a067534b189 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -474,7 +474,7 @@ declare_lint! { } declare_lint! { - /// The `unknown_lints` lint detects unrecognized lint attribute. + /// The `unknown_lints` lint detects unrecognized lint attributes. /// /// ### Example /// From 69203619592b5e49742d35c698ef3f33ae152988 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 24 May 2022 15:55:01 +0200 Subject: [PATCH 5/9] Remove unused brush image --- src/librustdoc/html/static/images/brush.svg | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/librustdoc/html/static/images/brush.svg diff --git a/src/librustdoc/html/static/images/brush.svg b/src/librustdoc/html/static/images/brush.svg deleted file mode 100644 index ea266e856a9..00000000000 --- a/src/librustdoc/html/static/images/brush.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 00a380c2351c4431cf0f8fee0926fc323992bea4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 24 May 2022 16:55:29 +0200 Subject: [PATCH 6/9] Update minifier-rs version to 0.1.0 --- Cargo.lock | 13 ++----------- src/librustdoc/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fa6e1d51d2..f9f8362fb7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2224,12 +2224,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -[[package]] -name = "macro-utils" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e72f7deb758fea9ea7d290aebfa788763d0bffae12caa6406a25baaf8fa68a8" - [[package]] name = "maplit" version = "1.0.2" @@ -2361,12 +2355,9 @@ dependencies = [ [[package]] name = "minifier" -version = "0.0.43" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d81352bda6f4d04af1720afaa762054f66e16caffd93c1f86461a1c0ac4e695e" -dependencies = [ - "macro-utils", -] +checksum = "7071d17e2898e134cabf624f43cdefa0cedf57c739e964df3d0df9d028701a72" [[package]] name = "minimal-lexical" diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 0495cd97dc2..03ceb63168c 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -11,7 +11,7 @@ arrayvec = { version = "0.7", default-features = false } askama = { version = "0.11", default-features = false, features = ["config"] } atty = "0.2" pulldown-cmark = { version = "0.9", default-features = false } -minifier = "0.0.43" +minifier = "0.1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" smallvec = "1.6.1" From 2a8b60f915c9fdc61e18be3392ea4330d9617da4 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 22 May 2022 04:25:40 +0200 Subject: [PATCH 7/9] Emit weird lint name lints after expansion Previously, we were emitting weird name lints (for renamed or unknown lints) before expansion, most importantly before cfg expansion. This meant that the weird name lints would not fire for lint attributes hidden inside cfg_attr. The same applied for lint level specifications of those lints. By moving the lints for the lint names to the post-expansion phase, these issues are resolved. --- compiler/rustc_lint/src/early.rs | 34 ++--- src/test/ui-fulldeps/lint-tool-test.stderr | 16 +-- ...issue-43106-gating-of-builtin-attrs.stderr | 28 ++-- .../ui/lint/issue-97094.interleaved.stderr | 53 ++++++++ .../ui/lint/issue-97094.nointerleaved.stderr | 53 ++++++++ src/test/ui/lint/issue-97094.rs | 59 +++++++++ src/test/ui/lint/reasons-erroneous.stderr | 120 +++++++++--------- 7 files changed, 264 insertions(+), 99 deletions(-) create mode 100644 src/test/ui/lint/issue-97094.interleaved.stderr create mode 100644 src/test/ui/lint/issue-97094.nointerleaved.stderr create mode 100644 src/test/ui/lint/issue-97094.rs diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 8e505152fc4..2ab948958d0 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -424,10 +424,25 @@ pub fn check_ast_node<'a>( let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect(); let mut buffered = lint_buffer.unwrap_or_default(); - if !sess.opts.debugging_opts.no_interleave_lints { + if sess.opts.debugging_opts.no_interleave_lints { + for (i, pass) in passes.iter_mut().enumerate() { + buffered = + sess.prof.extra_verbose_generic_activity("run_lint", pass.name()).run(|| { + early_lint_node( + sess, + !pre_expansion && i == 0, + lint_store, + registered_tools, + buffered, + EarlyLintPassObjects { lints: slice::from_mut(pass) }, + check_node, + ) + }); + } + } else { buffered = early_lint_node( sess, - pre_expansion, + !pre_expansion, lint_store, registered_tools, buffered, @@ -446,21 +461,6 @@ pub fn check_ast_node<'a>( check_node, ); } - } else { - for (i, pass) in passes.iter_mut().enumerate() { - buffered = - sess.prof.extra_verbose_generic_activity("run_lint", pass.name()).run(|| { - early_lint_node( - sess, - pre_expansion && i == 0, - lint_store, - registered_tools, - buffered, - EarlyLintPassObjects { lints: slice::from_mut(pass) }, - check_node, - ) - }); - } } // All of the buffered lints should have been emitted at this point. diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index 513f70d0f05..af9b8dedc73 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -18,14 +18,6 @@ warning: lint name `test_group` is deprecated and may not have an effect in the LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` -warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint-tool-test.rs:36:8 - | -LL | #[deny(this_lint_does_not_exist)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unknown_lints)]` on by default - warning: lint name `test_lint` is deprecated and may not have an effect in the future. --> $DIR/lint-tool-test.rs:9:23 | @@ -44,6 +36,14 @@ warning: lint name `test_group` is deprecated and may not have an effect in the LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` +warning: unknown lint: `this_lint_does_not_exist` + --> $DIR/lint-tool-test.rs:36:8 + | +LL | #[deny(this_lint_does_not_exist)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_lints)]` on by default + warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 --> $DIR/lint-tool-test.rs:6:1 | diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index cf9f89d8fde..06e1bd84c8b 100644 --- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -1,3 +1,17 @@ +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:17 + | +LL | mod inner { #![macro_escape] } + | ^^^^^^^^^^^^^^^^ + | + = help: try an outer attribute: `#[macro_use]` + +warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:1 + | +LL | #[macro_escape] + | ^^^^^^^^^^^^^^^ + warning: unknown lint: `x5400` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:46:9 | @@ -172,20 +186,6 @@ warning: unknown lint: `x5100` LL | #[deny(x5100)] impl S { } | ^^^^^ -warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:17 - | -LL | mod inner { #![macro_escape] } - | ^^^^^^^^^^^^^^^^ - | - = help: try an outer attribute: `#[macro_use]` - -warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:398:1 - | -LL | #[macro_escape] - | ^^^^^^^^^^^^^^^ - warning: use of deprecated attribute `crate_id`: no longer used. --> $DIR/issue-43106-gating-of-builtin-attrs.rs:85:1 | diff --git a/src/test/ui/lint/issue-97094.interleaved.stderr b/src/test/ui/lint/issue-97094.interleaved.stderr new file mode 100644 index 00000000000..a2581658920 --- /dev/null +++ b/src/test/ui/lint/issue-97094.interleaved.stderr @@ -0,0 +1,53 @@ +error: unknown lint: `nonex_lint_top_level` + --> $DIR/issue-97094.rs:14:26 + | +LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/issue-97094.rs:10:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` + +error: lint `bare_trait_object` has been renamed to `bare_trait_objects` + --> $DIR/issue-97094.rs:16:26 + | +LL | #![cfg_attr(all(), allow(bare_trait_object))] + | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` + | + = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` + +error: unknown lint: `nonex_lint_mod` + --> $DIR/issue-97094.rs:19:25 + | +LL | #[cfg_attr(all(), allow(nonex_lint_mod))] + | ^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_mod_inner` + --> $DIR/issue-97094.rs:22:30 + | +LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_fn` + --> $DIR/issue-97094.rs:26:25 + | +LL | #[cfg_attr(all(), allow(nonex_lint_fn))] + | ^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_in_macro` + --> $DIR/issue-97094.rs:37:29 + | +LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] + | ^^^^^^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_fn` + --> $DIR/issue-97094.rs:56:13 + | +LL | #[allow(nonex_lint_fn)] + | ^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/lint/issue-97094.nointerleaved.stderr b/src/test/ui/lint/issue-97094.nointerleaved.stderr new file mode 100644 index 00000000000..a2581658920 --- /dev/null +++ b/src/test/ui/lint/issue-97094.nointerleaved.stderr @@ -0,0 +1,53 @@ +error: unknown lint: `nonex_lint_top_level` + --> $DIR/issue-97094.rs:14:26 + | +LL | #![cfg_attr(all(), allow(nonex_lint_top_level))] + | ^^^^^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/issue-97094.rs:10:9 + | +LL | #![deny(warnings)] + | ^^^^^^^^ + = note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` + +error: lint `bare_trait_object` has been renamed to `bare_trait_objects` + --> $DIR/issue-97094.rs:16:26 + | +LL | #![cfg_attr(all(), allow(bare_trait_object))] + | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` + | + = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]` + +error: unknown lint: `nonex_lint_mod` + --> $DIR/issue-97094.rs:19:25 + | +LL | #[cfg_attr(all(), allow(nonex_lint_mod))] + | ^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_mod_inner` + --> $DIR/issue-97094.rs:22:30 + | +LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_fn` + --> $DIR/issue-97094.rs:26:25 + | +LL | #[cfg_attr(all(), allow(nonex_lint_fn))] + | ^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_in_macro` + --> $DIR/issue-97094.rs:37:29 + | +LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))] + | ^^^^^^^^^^^^^^^^^^^ + +error: unknown lint: `nonex_lint_fn` + --> $DIR/issue-97094.rs:56:13 + | +LL | #[allow(nonex_lint_fn)] + | ^^^^^^^^^^^^^ + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/lint/issue-97094.rs b/src/test/ui/lint/issue-97094.rs new file mode 100644 index 00000000000..aeaead1bd11 --- /dev/null +++ b/src/test/ui/lint/issue-97094.rs @@ -0,0 +1,59 @@ +// revisions: interleaved nointerleaved +// [nointerleaved]compile-flags: -Z no-interleave-lints + +// This test has two revisions because the logic change +// needed to make this test pass had to be adjusted +// for no-interleave-lints. Should the debug option +// be removed one day, please don't remove this +// test entirely, just remove the revision from it. + +#![deny(warnings)] + +// Ensure that unknown lints inside cfg-attr's are linted for + +#![cfg_attr(all(), allow(nonex_lint_top_level))] +//~^ ERROR unknown lint +#![cfg_attr(all(), allow(bare_trait_object))] +//~^ ERROR has been renamed + +#[cfg_attr(all(), allow(nonex_lint_mod))] +//~^ ERROR unknown lint +mod baz { + #![cfg_attr(all(), allow(nonex_lint_mod_inner))] + //~^ ERROR unknown lint +} + +#[cfg_attr(all(), allow(nonex_lint_fn))] +//~^ ERROR unknown lint +pub fn main() {} + +macro_rules! bar { + ($($t:tt)*) => { + $($t)* + }; +} + +bar!( + #[cfg_attr(all(), allow(nonex_lint_in_macro))] + //~^ ERROR unknown lint + pub fn _bar() {} +); + +// No warning for non-applying cfg +#[cfg_attr(any(), allow(nonex_lint_fn))] +pub fn _foo() {} + +// Allowing unknown lints works if inside cfg_attr +#[cfg_attr(all(), allow(unknown_lints))] +mod bar_allowed { + #[allow(nonex_lint_fn)] + fn _foo() {} +} + +// ... but not if the cfg_attr doesn't evaluate +#[cfg_attr(any(), allow(unknown_lints))] +mod bar_not_allowed { + #[allow(nonex_lint_fn)] + //~^ ERROR unknown lint + fn _foo() {} +} diff --git a/src/test/ui/lint/reasons-erroneous.stderr b/src/test/ui/lint/reasons-erroneous.stderr index f65ca08694d..5521af17c84 100644 --- a/src/test/ui/lint/reasons-erroneous.stderr +++ b/src/test/ui/lint/reasons-erroneous.stderr @@ -58,6 +58,66 @@ error[E0452]: malformed lint attribute input LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:3:58 + | +LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] + | ^ reason must be a string literal + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:8:40 + | +LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:13:29 + | +LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:13:29 + | +LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:22:23 + | +LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:22:23 + | +LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:31:36 + | +LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:31:36 + | +LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:40:44 + | +LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] + | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last + +error[E0452]: malformed lint attribute input + --> $DIR/reasons-erroneous.rs:45:25 + | +LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last + warning: unknown lint: `reason` --> $DIR/reasons-erroneous.rs:50:39 | @@ -66,66 +126,6 @@ LL | #![warn(missing_copy_implementations, reason)] | = note: `#[warn(unknown_lints)]` on by default -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:3:58 - | -LL | #![warn(absolute_paths_not_starting_with_crate, reason = 0)] - | ^ reason must be a string literal - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:8:40 - | -LL | #![warn(anonymous_parameters, reason = b"consider these, for we have condemned them")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reason must be a string literal - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 - | -LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:13:29 - | -LL | #![warn(bare_trait_objects, reasons = "leaders to no sure land, guides their bearings lost")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 - | -LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:22:23 - | -LL | #![warn(box_pointers, blerp = "or in league with robbers have reversed the signposts")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 - | -LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:31:36 - | -LL | #![warn(elided_lifetimes_in_paths, reason("disrespectful to ancestors", "irresponsible to heirs"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bad attribute argument - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:40:44 - | -LL | #![warn(ellipsis_inclusive_range_patterns, reason = "born barren", reason = "a freak growth")] - | ^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last - -error[E0452]: malformed lint attribute input - --> $DIR/reasons-erroneous.rs:45:25 - | -LL | #![warn(keyword_idents, reason = "root in rubble", macro_use_extern_crate)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ reason in lint attribute must come last - error: aborting due to 20 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0452`. From ce947735c017a59f9732eaf2719707a8eaafa8f3 Mon Sep 17 00:00:00 2001 From: wackbyte Date: Tue, 24 May 2022 13:22:41 -0400 Subject: [PATCH 8/9] Fix a mistake in `SliceIndex`'s documentation --- library/core/src/slice/index.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs index 68de4e4e1f3..fd7ecf3daf3 100644 --- a/library/core/src/slice/index.rs +++ b/library/core/src/slice/index.rs @@ -138,7 +138,7 @@ mod private_slice_index { /// A helper trait used for indexing operations. /// /// Implementations of this trait have to promise that if the argument -/// to `get_(mut_)unchecked` is a safe reference, then so is the result. +/// to `get_unchecked(_mut)` is a safe reference, then so is the result. #[stable(feature = "slice_get_slice", since = "1.28.0")] #[rustc_diagnostic_item = "SliceIndex"] #[rustc_on_unimplemented( From 1d19462a45083d49568a1fc69895671e714c6196 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 24 May 2022 11:09:24 -0700 Subject: [PATCH 9/9] Fix weird indentation in continue_keyword docs This format was causing every line in the code examples to have a space at the start. --- library/std/src/keyword_docs.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index bc2384c88d2..6dcd55cc937 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -70,7 +70,7 @@ mod as_keyword {} /// A break expression is normally associated with the innermost loop enclosing the /// `break` but a label can be used to specify which enclosing loop is affected. /// -///```rust +/// ```rust /// 'outer: for i in 1..=5 { /// println!("outer iteration (i): {i}"); /// @@ -87,7 +87,7 @@ mod as_keyword {} /// } /// } /// println!("Bye."); -///``` +/// ``` /// /// When associated with `loop`, a break expression may be used to return a value from that loop. /// This is only valid with `loop` and not with any other type of loop. @@ -194,7 +194,7 @@ mod const_keyword {} /// When `continue` is encountered, the current iteration is terminated, returning control to the /// loop head, typically continuing with the next iteration. /// -///```rust +/// ```rust /// // Printing odd numbers by skipping even ones /// for number in 1..=10 { /// if number % 2 == 0 { @@ -202,12 +202,12 @@ mod const_keyword {} /// } /// println!("{number}"); /// } -///``` +/// ``` /// /// Like `break`, `continue` is normally associated with the innermost enclosing loop, but labels /// may be used to specify the affected loop. /// -///```rust +/// ```rust /// // Print Odd numbers under 30 with unit <= 5 /// 'tens: for ten in 0..3 { /// '_units: for unit in 0..=9 { @@ -220,7 +220,7 @@ mod const_keyword {} /// println!("{}", ten * 10 + unit); /// } /// } -///``` +/// ``` /// /// See [continue expressions] from the reference for more details. ///