Rollup merge of #88174 - camelid:clarify-rust-2021-lint-docs, r=m-ou-se
Clarify some wording in Rust 2021 lint docs Also added some inline code styling.
This commit is contained in:
commit
d486ce75bc
1 changed files with 13 additions and 9 deletions
|
@ -3070,16 +3070,19 @@ declare_lint! {
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `rust_2021_incompatible_closure_captures` lint detects variables that aren't completely
|
/// The `rust_2021_incompatible_closure_captures` lint detects variables that aren't completely
|
||||||
/// captured in Rust 2021 and affect the Drop order of at least one path starting at this variable.
|
/// captured in Rust 2021, such that the `Drop` order of their fields may differ between
|
||||||
/// It can also detect when a variable implements a trait, but one of its field does not and
|
/// Rust 2018 and 2021.
|
||||||
/// the field is captured by a closure and used with the assumption that said field implements
|
///
|
||||||
|
/// It can also detect when a variable implements a trait like `Send`, but one of its fields does not,
|
||||||
|
/// and the field is captured by a closure and used with the assumption that said field implements
|
||||||
/// the same trait as the root variable.
|
/// the same trait as the root variable.
|
||||||
///
|
///
|
||||||
/// ### Example of drop reorder
|
/// ### Example of drop reorder
|
||||||
///
|
///
|
||||||
/// ```rust,compile_fail
|
/// ```rust,compile_fail
|
||||||
/// # #![deny(rust_2021_incompatible_closure_captures)]
|
/// #![deny(rust_2021_incompatible_closure_captures)]
|
||||||
/// # #![allow(unused)]
|
/// # #![allow(unused)]
|
||||||
|
///
|
||||||
/// struct FancyInteger(i32);
|
/// struct FancyInteger(i32);
|
||||||
///
|
///
|
||||||
/// impl Drop for FancyInteger {
|
/// impl Drop for FancyInteger {
|
||||||
|
@ -3133,8 +3136,8 @@ declare_lint! {
|
||||||
/// ### Explanation
|
/// ### Explanation
|
||||||
///
|
///
|
||||||
/// In the above example, only `fptr.0` is captured in Rust 2021.
|
/// In the above example, only `fptr.0` is captured in Rust 2021.
|
||||||
/// The field is of type *mut i32 which doesn't implement Send, making the code invalid as the
|
/// The field is of type `*mut i32`, which doesn't implement `Send`,
|
||||||
/// field cannot be sent between thread safely.
|
/// making the code invalid as the field cannot be sent between threads safely.
|
||||||
pub RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
|
pub RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
|
||||||
Allow,
|
Allow,
|
||||||
"detects closures affected by Rust 2021 changes",
|
"detects closures affected by Rust 2021 changes",
|
||||||
|
@ -3254,6 +3257,7 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ```rust,compile_fail
|
/// ```rust,compile_fail
|
||||||
/// #![deny(rust_2021_incompatible_or_patterns)]
|
/// #![deny(rust_2021_incompatible_or_patterns)]
|
||||||
|
///
|
||||||
/// macro_rules! match_any {
|
/// macro_rules! match_any {
|
||||||
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
|
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
|
||||||
/// match $expr {
|
/// match $expr {
|
||||||
|
@ -3275,7 +3279,7 @@ declare_lint! {
|
||||||
///
|
///
|
||||||
/// ### Explanation
|
/// ### Explanation
|
||||||
///
|
///
|
||||||
/// In Rust 2021, the pat matcher will match new patterns, which include the | character.
|
/// In Rust 2021, the `pat` matcher will match additional patterns, which include the `|` character.
|
||||||
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||||
Allow,
|
Allow,
|
||||||
"detects usage of old versions of or-patterns",
|
"detects usage of old versions of or-patterns",
|
||||||
|
@ -3320,8 +3324,8 @@ declare_lint! {
|
||||||
/// In Rust 2021, one of the important introductions is the [prelude changes], which add
|
/// In Rust 2021, one of the important introductions is the [prelude changes], which add
|
||||||
/// `TryFrom`, `TryInto`, and `FromIterator` into the standard library's prelude. Since this
|
/// `TryFrom`, `TryInto`, and `FromIterator` into the standard library's prelude. Since this
|
||||||
/// results in an ambiguity as to which method/function to call when an existing `try_into`
|
/// results in an ambiguity as to which method/function to call when an existing `try_into`
|
||||||
/// method is called via dot-call syntax or a `try_from`/`from_iter` associated function
|
/// method is called via dot-call syntax or a `try_from`/`from_iter` associated function
|
||||||
/// is called directly on a type.
|
/// is called directly on a type.
|
||||||
///
|
///
|
||||||
/// [prelude changes]: https://blog.rust-lang.org/inside-rust/2021/03/04/planning-rust-2021.html#prelude-changes
|
/// [prelude changes]: https://blog.rust-lang.org/inside-rust/2021/03/04/planning-rust-2021.html#prelude-changes
|
||||||
pub RUST_2021_PRELUDE_COLLISIONS,
|
pub RUST_2021_PRELUDE_COLLISIONS,
|
||||||
|
|
Loading…
Add table
Reference in a new issue