feat: regenrate lint completions
This commit is contained in:
parent
58d2ece88a
commit
660930623e
@ -14,8 +14,9 @@
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn sourcegen_lint_completions() {
|
fn sourcegen_lint_completions() {
|
||||||
if !project_root().join("./target/rust").exists() {
|
let rust_repo = project_root().join("./target/rust");
|
||||||
cmd!("git clone --depth=1 https://github.com/rust-lang/rust ./target/rust").run().unwrap();
|
if !rust_repo.exists() {
|
||||||
|
cmd!("git clone --depth=1 https://github.com/rust-lang/rust {rust_repo}").run().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut contents = r"
|
let mut contents = r"
|
||||||
@ -33,6 +34,7 @@ pub struct Lint {
|
|||||||
|
|
||||||
cmd!("curl https://rust-lang.github.io/rust-clippy/master/lints.json --output ./target/clippy_lints.json").run().unwrap();
|
cmd!("curl https://rust-lang.github.io/rust-clippy/master/lints.json --output ./target/clippy_lints.json").run().unwrap();
|
||||||
generate_descriptor_clippy(&mut contents, Path::new("./target/clippy_lints.json"));
|
generate_descriptor_clippy(&mut contents, Path::new("./target/clippy_lints.json"));
|
||||||
|
|
||||||
let contents =
|
let contents =
|
||||||
sourcegen::add_preamble("sourcegen_lint_completions", sourcegen::reformat(contents));
|
sourcegen::add_preamble("sourcegen_lint_completions", sourcegen::reformat(contents));
|
||||||
|
|
||||||
@ -93,11 +95,10 @@ fn generate_feature_descriptor(buf: &mut String, src_dir: PathBuf) {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
features.sort_by(|(feature_ident, _), (feature_ident2, _)| feature_ident.cmp(feature_ident2));
|
features.sort_by(|(feature_ident, _), (feature_ident2, _)| feature_ident.cmp(feature_ident2));
|
||||||
|
|
||||||
|
buf.push_str(r#"pub const FEATURES: &[Lint] = &["#);
|
||||||
for (feature_ident, doc) in features.into_iter() {
|
for (feature_ident, doc) in features.into_iter() {
|
||||||
push_lint_completion(buf, &feature_ident, &doc)
|
push_lint_completion(buf, &feature_ident, &doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.push_str(r#"pub const FEATURES: &[Lint] = &["#);
|
|
||||||
buf.push('\n');
|
buf.push('\n');
|
||||||
buf.push_str("];\n");
|
buf.push_str("];\n");
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
//! Generated file, do not edit by hand, see `xtask/src/codegen`
|
//! Generated by `sourcegen_lint_completions`, do not edit by hand.
|
||||||
|
|
||||||
pub struct Lint {
|
pub struct Lint {
|
||||||
pub label: &'static str,
|
pub label: &'static str,
|
||||||
pub description: &'static str,
|
pub description: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const DEFAULT_LINTS: &[Lint] = &[
|
pub const DEFAULT_LINTS: &[Lint] = &[
|
||||||
Lint {
|
Lint {
|
||||||
label: "absolute_paths_not_starting_with_crate",
|
label: "absolute_paths_not_starting_with_crate",
|
||||||
@ -71,8 +70,8 @@ pub struct Lint {
|
|||||||
description: r##"detects when an null pointer is dereferenced"##,
|
description: r##"detects when an null pointer is dereferenced"##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "disjoint_capture_migration",
|
label: "disjoint_capture_drop_reorder",
|
||||||
description: r##"Drop reorder and auto traits error because of `capture_disjoint_fields`"##,
|
description: r##"Drop reorder because of `capture_disjoint_fields`"##,
|
||||||
},
|
},
|
||||||
Lint { label: "drop_bounds", description: r##"bounds of the form `T: Drop` are useless"## },
|
Lint { label: "drop_bounds", description: r##"bounds of the form `T: Drop` are useless"## },
|
||||||
Lint {
|
Lint {
|
||||||
@ -98,7 +97,7 @@ pub struct Lint {
|
|||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "future_incompatible",
|
label: "future_incompatible",
|
||||||
description: r##"lint group for: keyword-idents, anonymous-parameters, ellipsis-inclusive-range-patterns, forbidden-lint-groups, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, const-err, unaligned-references, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, bare-trait-objects, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, pointer-structural-match, nontrivial-structural-match, soft-unstable, cenum-impl-drop-cast, const-evaluatable-unchecked, uninhabited-static, unsupported-naked-functions, semicolon-in-expressions-from-macros, legacy-derive-helpers, proc-macro-back-compat, array-into-iter"##,
|
description: r##"lint group for: keyword-idents, anonymous-parameters, forbidden-lint-groups, illegal-floating-point-literal-pattern, private-in-public, pub-use-of-private-extern-crate, invalid-type-param-default, const-err, unaligned-references, patterns-in-fns-without-body, missing-fragment-specifier, late-bound-lifetime-arguments, order-dependent-trait-objects, coherence-leak-check, tyvar-behind-raw-pointer, absolute-paths-not-starting-with-crate, unstable-name-collisions, where-clauses-object-safety, proc-macro-derive-resolution-fallback, macro-expanded-macro-exports-accessed-by-absolute-paths, ill-formed-attribute-input, conflicting-repr-hints, ambiguous-associated-items, mutable-borrow-reservation-conflict, indirect-structural-match, pointer-structural-match, nontrivial-structural-match, soft-unstable, cenum-impl-drop-cast, const-evaluatable-unchecked, uninhabited-static, unsupported-naked-functions, semicolon-in-expressions-from-macros, legacy-derive-helpers, proc-macro-back-compat, array-into-iter"##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "ill_formed_attribute_input",
|
label: "ill_formed_attribute_input",
|
||||||
@ -139,7 +138,7 @@ pub struct Lint {
|
|||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "invalid_value",
|
label: "invalid_value",
|
||||||
description: r##"an invalid value is being created (such as a null reference)"##,
|
description: r##"an invalid value is being created (such as a NULL reference)"##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "irrefutable_let_patterns",
|
label: "irrefutable_let_patterns",
|
||||||
@ -291,10 +290,6 @@ pub struct Lint {
|
|||||||
label: "rust_2018_idioms",
|
label: "rust_2018_idioms",
|
||||||
description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##,
|
description: r##"lint group for: bare-trait-objects, unused-extern-crates, ellipsis-inclusive-range-patterns, elided-lifetimes-in-paths, explicit-outlives-requirements"##,
|
||||||
},
|
},
|
||||||
Lint {
|
|
||||||
label: "rust_2021_compatibility",
|
|
||||||
description: r##"lint group for: ellipsis-inclusive-range-patterns, bare-trait-objects"##,
|
|
||||||
},
|
|
||||||
Lint {
|
Lint {
|
||||||
label: "semicolon_in_expressions_from_macros",
|
label: "semicolon_in_expressions_from_macros",
|
||||||
description: r##"trailing semicolon in macro body used as expression"##,
|
description: r##"trailing semicolon in macro body used as expression"##,
|
||||||
@ -804,6 +799,7 @@ fn tag(&self) -> u8 {
|
|||||||
- Hexagon
|
- Hexagon
|
||||||
- MIPS32r2 and MIPS64r2
|
- MIPS32r2 and MIPS64r2
|
||||||
- wasm32
|
- wasm32
|
||||||
|
- BPF
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
@ -1229,7 +1225,7 @@ fn call_foo(arg: i32) {
|
|||||||
operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
|
operand_expr := expr / "_" / expr "=>" expr / expr "=>" "_"
|
||||||
reg_operand := dir_spec "(" reg_spec ")" operand_expr
|
reg_operand := dir_spec "(" reg_spec ")" operand_expr
|
||||||
operand := reg_operand / "const" const_expr / "sym" path
|
operand := reg_operand / "const" const_expr / "sym" path
|
||||||
option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax"
|
option := "pure" / "nomem" / "readonly" / "preserves_flags" / "noreturn" / "nostack" / "att_syntax" / "raw"
|
||||||
options := "options(" option *["," option] [","] ")"
|
options := "options(" option *["," option] [","] ")"
|
||||||
asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," options] [","] ")"
|
asm := "asm!(" format_string *("," format_string) *("," [ident "="] operand) ["," options] [","] ")"
|
||||||
```
|
```
|
||||||
@ -1344,6 +1340,8 @@ fn call_foo(arg: i32) {
|
|||||||
| PowerPC | `reg_nonzero` | | `r[1-31]` | `b` |
|
| PowerPC | `reg_nonzero` | | `r[1-31]` | `b` |
|
||||||
| PowerPC | `freg` | `f[0-31]` | `f` |
|
| PowerPC | `freg` | `f[0-31]` | `f` |
|
||||||
| wasm32 | `local` | None\* | `r` |
|
| wasm32 | `local` | None\* | `r` |
|
||||||
|
| BPF | `reg` | `r[0-10]` | `r` |
|
||||||
|
| BPF | `wreg` | `w[0-10]` | `w` |
|
||||||
|
|
||||||
> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
|
> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
|
||||||
>
|
>
|
||||||
@ -1389,6 +1387,8 @@ fn call_foo(arg: i32) {
|
|||||||
| PowerPC | `reg_nonzero` | None | `i8`, `i16`, `i32` |
|
| PowerPC | `reg_nonzero` | None | `i8`, `i16`, `i32` |
|
||||||
| PowerPC | `freg` | None | `f32`, `f64` |
|
| PowerPC | `freg` | None | `f32`, `f64` |
|
||||||
| wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` |
|
| wasm32 | `local` | None | `i8` `i16` `i32` `i64` `f32` `f64` |
|
||||||
|
| BPF | `reg` | None | `i8` `i16` `i32` `i64` |
|
||||||
|
| BPF | `wreg` | `alu32` | `i8` `i16` `i32` |
|
||||||
|
|
||||||
> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
|
> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
|
||||||
|
|
||||||
@ -1448,6 +1448,7 @@ fn call_foo(arg: i32) {
|
|||||||
| Hexagon | `r29` | `sp` |
|
| Hexagon | `r29` | `sp` |
|
||||||
| Hexagon | `r30` | `fr` |
|
| Hexagon | `r30` | `fr` |
|
||||||
| Hexagon | `r31` | `lr` |
|
| Hexagon | `r31` | `lr` |
|
||||||
|
| BPF | `r[0-10]` | `w[0-10]` |
|
||||||
|
|
||||||
Some registers cannot be used for input or output operands:
|
Some registers cannot be used for input or output operands:
|
||||||
|
|
||||||
@ -1549,6 +1550,7 @@ fn call_foo(arg: i32) {
|
|||||||
- `noreturn`: The `asm` block never returns, and its return type is defined as `!` (never). Behavior is undefined if execution falls through past the end of the asm code. A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
|
- `noreturn`: The `asm` block never returns, and its return type is defined as `!` (never). Behavior is undefined if execution falls through past the end of the asm code. A `noreturn` asm block behaves just like a function which doesn't return; notably, local variables in scope are not dropped before it is invoked.
|
||||||
- `nostack`: The `asm` block does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
|
- `nostack`: The `asm` block does not push data to the stack, or write to the stack red-zone (if supported by the target). If this option is *not* used then the stack pointer is guaranteed to be suitably aligned (according to the target ABI) for a function call.
|
||||||
- `att_syntax`: This option is only valid on x86, and causes the assembler to use the `.att_syntax prefix` mode of the GNU assembler. Register operands are substituted in with a leading `%`.
|
- `att_syntax`: This option is only valid on x86, and causes the assembler to use the `.att_syntax prefix` mode of the GNU assembler. Register operands are substituted in with a leading `%`.
|
||||||
|
- `raw`: This causes the template string to be parsed as a raw assembly string, with no special handling for `{` and `}`. This is primarily useful when including raw assembly code from an external file using `include_str!`.
|
||||||
|
|
||||||
The compiler performs some additional checks on options:
|
The compiler performs some additional checks on options:
|
||||||
- The `nomem` and `readonly` options are mutually exclusive: it is a compile-time error to specify both.
|
- The `nomem` and `readonly` options are mutually exclusive: it is a compile-time error to specify both.
|
||||||
@ -3801,6 +3803,39 @@ fn cheap_clone<T: CheapToClone>(t: T) -> T {
|
|||||||
|
|
||||||
This is expected to replace the unstable `overlapping_marker_traits`
|
This is expected to replace the unstable `overlapping_marker_traits`
|
||||||
feature, which applied to all empty traits (without needing an opt-in).
|
feature, which applied to all empty traits (without needing an opt-in).
|
||||||
|
"##,
|
||||||
|
},
|
||||||
|
Lint {
|
||||||
|
label: "more_qualified_paths",
|
||||||
|
description: r##"# `more_qualified_paths`
|
||||||
|
|
||||||
|
The `more_qualified_paths` feature can be used in order to enable the
|
||||||
|
use of qualified paths in patterns.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```rust
|
||||||
|
#![feature(more_qualified_paths)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// destructure through a qualified path
|
||||||
|
let <Foo as A>::Assoc { br } = StructStruct { br: 2 };
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StructStruct {
|
||||||
|
br: i8,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
trait A {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl A for Foo {
|
||||||
|
type Assoc = StructStruct;
|
||||||
|
}
|
||||||
|
```
|
||||||
"##,
|
"##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
@ -4681,60 +4716,6 @@ pub union GenericUnion<T: Copy> { // Unions with non-`Copy` fields are unstable.
|
|||||||
};
|
};
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
```
|
```
|
||||||
"##,
|
|
||||||
},
|
|
||||||
Lint {
|
|
||||||
label: "try_trait",
|
|
||||||
description: r##"# `try_trait`
|
|
||||||
|
|
||||||
The tracking issue for this feature is: [#42327]
|
|
||||||
|
|
||||||
[#42327]: https://github.com/rust-lang/rust/issues/42327
|
|
||||||
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
This introduces a new trait `Try` for extending the `?` operator to types
|
|
||||||
other than `Result` (a part of [RFC 1859]). The trait provides the canonical
|
|
||||||
way to _view_ a type in terms of a success/failure dichotomy. This will
|
|
||||||
allow `?` to supplant the `try_opt!` macro on `Option` and the `try_ready!`
|
|
||||||
macro on `Poll`, among other things.
|
|
||||||
|
|
||||||
[RFC 1859]: https://github.com/rust-lang/rfcs/pull/1859
|
|
||||||
|
|
||||||
Here's an example implementation of the trait:
|
|
||||||
|
|
||||||
```rust,ignore (cannot-reimpl-Try)
|
|
||||||
/// A distinct type to represent the `None` value of an `Option`.
|
|
||||||
///
|
|
||||||
/// This enables using the `?` operator on `Option`; it's rarely useful alone.
|
|
||||||
#[derive(Debug)]
|
|
||||||
#[unstable(feature = "try_trait", issue = "42327")]
|
|
||||||
pub struct None { _priv: () }
|
|
||||||
|
|
||||||
#[unstable(feature = "try_trait", issue = "42327")]
|
|
||||||
impl<T> ops::Try for Option<T> {
|
|
||||||
type Ok = T;
|
|
||||||
type Error = None;
|
|
||||||
|
|
||||||
fn into_result(self) -> Result<T, None> {
|
|
||||||
self.ok_or(None { _priv: () })
|
|
||||||
}
|
|
||||||
|
|
||||||
fn from_ok(v: T) -> Self {
|
|
||||||
Some(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn from_error(_: None) -> Self {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Note the `Error` associated type here is a new marker. The `?` operator
|
|
||||||
allows interconversion between different `Try` implementers only when
|
|
||||||
the error type can be converted `Into` the error type of the enclosing
|
|
||||||
function (or catch block). Having a distinct error type (as opposed to
|
|
||||||
just `()`, or similar) restricts this to where it's semantically meaningful.
|
|
||||||
"##,
|
"##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
@ -5035,6 +5016,10 @@ fn main() {
|
|||||||
label: "clippy::almost_swapped",
|
label: "clippy::almost_swapped",
|
||||||
description: r##"Checks for `foo = bar; bar = foo` sequences."##,
|
description: r##"Checks for `foo = bar; bar = foo` sequences."##,
|
||||||
},
|
},
|
||||||
|
Lint {
|
||||||
|
label: "clippy::append_instead_of_extend",
|
||||||
|
description: r##"Checks for occurrences where one vector gets extended instead of append"##,
|
||||||
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "clippy::approx_constant",
|
label: "clippy::approx_constant",
|
||||||
description: r##"Checks for floating point literals that approximate
|
description: r##"Checks for floating point literals that approximate
|
||||||
@ -5371,6 +5356,25 @@ fn main() {
|
|||||||
label: "clippy::disallowed_method",
|
label: "clippy::disallowed_method",
|
||||||
description: r##"Denies the configured methods and functions in clippy.toml"##,
|
description: r##"Denies the configured methods and functions in clippy.toml"##,
|
||||||
},
|
},
|
||||||
|
Lint {
|
||||||
|
label: "clippy::disallowed_script_idents",
|
||||||
|
description: r##"Checks for usage of unicode scripts other than those explicitly allowed
|
||||||
|
by the lint config.
|
||||||
|
|
||||||
|
This lint doesn't take into account non-text scripts such as `Unknown` and `Linear_A`.
|
||||||
|
It also ignores the `Common` script type.
|
||||||
|
While configuring, be sure to use official script name [aliases] from
|
||||||
|
[the list of supported scripts][supported_scripts].
|
||||||
|
|
||||||
|
See also: [`non_ascii_idents`].
|
||||||
|
|
||||||
|
[aliases]: http://www.unicode.org/reports/tr24/tr24-31.html#Script_Value_Aliases
|
||||||
|
[supported_scripts]: https://www.unicode.org/iso15924/iso15924-codes.html"##,
|
||||||
|
},
|
||||||
|
Lint {
|
||||||
|
label: "clippy::disallowed_type",
|
||||||
|
description: r##"Denies the configured types in clippy.toml."##,
|
||||||
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "clippy::diverging_sub_expression",
|
label: "clippy::diverging_sub_expression",
|
||||||
description: r##"Checks for diverging calls that are not match arms or
|
description: r##"Checks for diverging calls that are not match arms or
|
||||||
@ -6147,6 +6151,11 @@ fn main() {
|
|||||||
label: "clippy::missing_docs_in_private_items",
|
label: "clippy::missing_docs_in_private_items",
|
||||||
description: r##"Warns if there is missing doc for any documentable item
|
description: r##"Warns if there is missing doc for any documentable item
|
||||||
(public or private)."##,
|
(public or private)."##,
|
||||||
|
},
|
||||||
|
Lint {
|
||||||
|
label: "clippy::missing_enforced_import_renames",
|
||||||
|
description: r##"Checks for imports that do not rename the item as specified
|
||||||
|
in the `enforce-import-renames` config option."##,
|
||||||
},
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "clippy::missing_errors_doc",
|
label: "clippy::missing_errors_doc",
|
||||||
@ -6372,6 +6381,10 @@ fn main() {
|
|||||||
description: r##"Checks for duplicate open options as well as combinations
|
description: r##"Checks for duplicate open options as well as combinations
|
||||||
that make no sense."##,
|
that make no sense."##,
|
||||||
},
|
},
|
||||||
|
Lint {
|
||||||
|
label: "clippy::nonstandard_macro_braces",
|
||||||
|
description: r##"Checks that common macros are used with consistent bracing."##,
|
||||||
|
},
|
||||||
Lint {
|
Lint {
|
||||||
label: "clippy::not_unsafe_ptr_arg_deref",
|
label: "clippy::not_unsafe_ptr_arg_deref",
|
||||||
description: r##"Checks for public functions that dereference raw pointer
|
description: r##"Checks for public functions that dereference raw pointer
|
||||||
@ -6560,6 +6573,7 @@ fn main() {
|
|||||||
label: "clippy::rc_buffer",
|
label: "clippy::rc_buffer",
|
||||||
description: r##"Checks for `Rc<T>` and `Arc<T>` when `T` is a mutable buffer type such as `String` or `Vec`."##,
|
description: r##"Checks for `Rc<T>` and `Arc<T>` when `T` is a mutable buffer type such as `String` or `Vec`."##,
|
||||||
},
|
},
|
||||||
|
Lint { label: "clippy::rc_mutex", description: r##"Checks for `Rc<Mutex<T>>`."## },
|
||||||
Lint {
|
Lint {
|
||||||
label: "clippy::redundant_allocation",
|
label: "clippy::redundant_allocation",
|
||||||
description: r##"Checks for use of redundant allocations anywhere in the code."##,
|
description: r##"Checks for use of redundant allocations anywhere in the code."##,
|
||||||
|
Loading…
Reference in New Issue
Block a user