Skip to content

Commit ba9093e

Browse files
authored
Clarify some wording in Rust 2021 lint docs
1 parent 7960030 commit ba9093e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -3070,16 +3070,19 @@ declare_lint! {
30703070

30713071
declare_lint! {
30723072
/// The `rust_2021_incompatible_closure_captures` lint detects variables that aren't completely
3073-
/// captured in Rust 2021 and affect the Drop order of at least one path starting at this variable.
3074-
/// It can also detect when a variable implements a trait, but one of its field does not and
3075-
/// the field is captured by a closure and used with the assumption that said field implements
3073+
/// captured in Rust 2021, such that the `Drop` order of their fields may differ between
3074+
/// Rust 2018 and 2021.
3075+
///
3076+
/// It can also detect when a variable implements a trait like `Send`, but one of its fields does not,
3077+
/// and the field is captured by a closure and used with the assumption that said field implements
30763078
/// the same trait as the root variable.
30773079
///
30783080
/// ### Example of drop reorder
30793081
///
30803082
/// ```rust,compile_fail
3081-
/// # #![deny(rust_2021_incompatible_closure_captures)]
3083+
/// #![deny(rust_2021_incompatible_closure_captures)]
30823084
/// # #![allow(unused)]
3085+
///
30833086
/// struct FancyInteger(i32);
30843087
///
30853088
/// impl Drop for FancyInteger {
@@ -3133,8 +3136,8 @@ declare_lint! {
31333136
/// ### Explanation
31343137
///
31353138
/// In the above example, only `fptr.0` is captured in Rust 2021.
3136-
/// The field is of type *mut i32 which doesn't implement Send, making the code invalid as the
3137-
/// field cannot be sent between thread safely.
3139+
/// The field is of type `*mut i32`, which doesn't implement `Send`,
3140+
/// making the code invalid as the field cannot be sent between threads safely.
31383141
pub RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
31393142
Allow,
31403143
"detects closures affected by Rust 2021 changes",
@@ -3254,6 +3257,7 @@ declare_lint! {
32543257
///
32553258
/// ```rust,compile_fail
32563259
/// #![deny(rust_2021_incompatible_or_patterns)]
3260+
///
32573261
/// macro_rules! match_any {
32583262
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
32593263
/// match $expr {
@@ -3275,7 +3279,7 @@ declare_lint! {
32753279
///
32763280
/// ### Explanation
32773281
///
3278-
/// In Rust 2021, the pat matcher will match new patterns, which include the | character.
3282+
/// In Rust 2021, the `pat` matcher will match additional patterns, which include the `|` character.
32793283
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
32803284
Allow,
32813285
"detects usage of old versions of or-patterns",
@@ -3320,8 +3324,8 @@ declare_lint! {
33203324
/// In Rust 2021, one of the important introductions is the [prelude changes], which add
33213325
/// `TryFrom`, `TryInto`, and `FromIterator` into the standard library's prelude. Since this
33223326
/// results in an ambiguity as to which method/function to call when an existing `try_into`
3323-
/// method is called via dot-call syntax or a `try_from`/`from_iter` associated function
3324-
/// is called directly on a type.
3327+
/// method is called via dot-call syntax or a `try_from`/`from_iter` associated function
3328+
/// is called directly on a type.
33253329
///
33263330
/// [prelude changes]: https://blog.rust-lang.org/inside-rust/2021/03/04/planning-rust-2021.html#prelude-changes
33273331
pub RUST_2021_PRELUDE_COLLISIONS,

0 commit comments

Comments
 (0)