Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/generated/lints.rs')
| -rw-r--r-- | crates/ide-db/src/generated/lints.rs | 627 |
1 files changed, 596 insertions, 31 deletions
diff --git a/crates/ide-db/src/generated/lints.rs b/crates/ide-db/src/generated/lints.rs index 52a5a95450..264bb4fa81 100644 --- a/crates/ide-db/src/generated/lints.rs +++ b/crates/ide-db/src/generated/lints.rs @@ -258,6 +258,13 @@ pub const DEFAULT_LINTS: &[Lint] = &[ deny_since: None, }, Lint { + label: "dead_code_pub_in_binary", + description: r##"detect public items in executable crates that are never used"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "default_overrides_default_fields", description: r##"detect `Default` impl that should use the type's default field values"##, default_severity: Severity::Error, @@ -736,7 +743,7 @@ pub const DEFAULT_LINTS: &[Lint] = &[ Lint { label: "linker_messages", description: r##"warnings emitted at runtime by the target-specific linker program"##, - default_severity: Severity::Allow, + default_severity: Severity::Warning, warn_since: None, deny_since: None, }, @@ -1238,6 +1245,13 @@ pub const DEFAULT_LINTS: &[Lint] = &[ deny_since: None, }, Lint { + label: "tail_call_track_caller", + description: r##"detects tail calls of functions marked with `#[track_caller]`"##, + default_severity: Severity::Warning, + warn_since: None, + deny_since: None, + }, + Lint { label: "tail_expr_drop_order", description: r##"Detect and warn on significant change in drop order in tail expression location"##, default_severity: Severity::Allow, @@ -4313,7 +4327,7 @@ defined in Rust. They may be called both from within Rust and via FFI. pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize { let mut sum = 0; for _ in 0..n { - sum += args.arg::<usize>(); + sum += args.next_arg::<usize>(); } sum } @@ -4324,6 +4338,22 @@ pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize { deny_since: None, }, Lint { + label: "c_variadic_experimental_arch", + description: r##"# `c_variadic_experimental_arch` + +Allows defining c-variadic functions on targets where this feature has not yet undergone sufficient testing for stabilization. + +The tracking issue for this feature is: [#155973] + +[#155973]: https://github.com/rust-lang/rust/issues/155973 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "c_variadic_naked_functions", description: r##"# `c_variadic_naked_functions` @@ -4806,22 +4836,6 @@ This feature has no tracking issue, and is therefore likely internal to the comp deny_since: None, }, Lint { - label: "char_max_len", - description: r##"# `char_max_len` - - - -The tracking issue for this feature is: [#121714] - -[#121714]: https://github.com/rust-lang/rust/issues/121714 - ------------------------- -"##, - default_severity: Severity::Allow, - warn_since: None, - deny_since: None, - }, - Lint { label: "clamp_magnitude", description: r##"# `clamp_magnitude` @@ -5552,6 +5566,20 @@ The tracking issue for this feature is: [#95174] deny_since: None, }, Lint { + label: "const_param_ty_unchecked", + description: r##"# `const_param_ty_unchecked` + +Allows skipping `ConstParamTy_` trait implementation checks + +This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use. + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "const_path_separators", description: r##"# `const_path_separators` @@ -6004,6 +6032,22 @@ This feature has no tracking issue, and is therefore likely internal to the comp deny_since: None, }, Lint { + label: "core_io", + description: r##"# `core_io` + + + +The tracking issue for this feature is: [#154046] + +[#154046]: https://github.com/rust-lang/rust/issues/154046 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "core_io_borrowed_buf", description: r##"# `core_io_borrowed_buf` @@ -6020,6 +6064,20 @@ The tracking issue for this feature is: [#117693] deny_since: None, }, Lint { + label: "core_io_internals", + description: r##"# `core_io_internals` + + + +This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use. + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "core_private_bignum", description: r##"# `core_private_bignum` @@ -6986,13 +7044,96 @@ The tracking issue for this feature is: [#143874] label: "diagnostic_on_move", description: r##"# `diagnostic_on_move` -Allows giving on-move borrowck custom diagnostic messages for a type - The tracking issue for this feature is: [#154181] -[#154181]: https://github.com/rust-lang/rust/issues/154181 - ------------------------ + +The `diagnostic_on_move` feature allows use of the `#[diagnostic::on_move]` attribute. It should be +placed on struct, enum and union declarations, though it is not an error to be located in other +positions. This attribute is a hint to the compiler to supplement the error message when the +annotated type is involved in a borrowcheck error. + +For example, [`File`] is annotated as such: +```rust +#![feature(diagnostic_on_move)] + +#[diagnostic::on_move(note = "you can use `File::try_clone` \ + to duplicate a `File` instance")] +pub struct File { + // ... +} +``` + +When you try to use a `File` after it's already been moved, it will helpfully tell you about `try_clone`. + +The message and label can also be customized: + +```rust +#![feature(diagnostic_on_move)] + +use std::marker::PhantomData; + +#[diagnostic::on_move( + message = "`{Self}` cannot be used multiple times", + label = "this token may only be used once", + note = "you can create a new `Token` with `Token::conjure()`" +)] +pub struct Token<'brand> { + spooky: PhantomData<&'brand ()>, +} + +impl Token<'_> { + pub fn conjure<'u>() -> Token<'u> { + Token { + spooky: PhantomData, + } + } +} +``` +The user may try to use it like this: +```rust,compile_fail,E0382 +# #![feature(diagnostic_on_move)] +# +# use std::marker::PhantomData; +# +# #[diagnostic::on_move( +# message = "`{Self}` cannot be used multiple times", +# label = "this token may only be used once", +# note = "you can create a new `Token` with `Token::conjure()`" +# )] +# pub struct Token<'brand> { +# spooky: PhantomData<&'brand ()>, +# } +# +# impl Token<'_> { +# pub fn conjure<'u>() -> Token<'u> { +# Token { +# spooky: PhantomData, +# } +# } +# } +# fn main() { +let token = Token::conjure(); +let _ = (token, token); +# } +``` +This will result in the following error: +```text +error[E0382]: `Token` cannot be used multiple times + --> src/main.rs:24:21 + | + 1 | let token = Token::conjure(); + | ----- this token may only be used once + 2 | let _ = (token, token); + | ----- ^^^^^ value used here after move + | | + | value moved here + | + = note: you can create a new `Token` with `Token::conjure()` +``` + +[`File`]: https://doc.rust-lang.org/nightly/std/fs/struct.File.html "File in std::fs" +[#154181]: https://github.com/rust-lang/rust/issues/154181 "Tracking Issue for #[diagnostic::on_move]" "##, default_severity: Severity::Allow, warn_since: None, @@ -7015,6 +7156,66 @@ The tracking issue for this feature is: [#152900] deny_since: None, }, Lint { + label: "diagnostic_on_unmatch_args", + description: r##"# `diagnostic_on_unmatch_args` + +The tracking issue for this feature is: [#155642] + +[#155642]: https://github.com/rust-lang/rust/issues/155642 + +------------------------ + +The `diagnostic_on_unmatch_args` feature adds the +`#[diagnostic::on_unmatch_args(...)]` attribute for declarative macros. +It lets a macro definition customize diagnostics for matcher failures after all arms have been +tried, such as incomplete invocations or trailing extra arguments. + +This attribute currently applies to declarative macros such as `macro_rules!` and `pub macro`. +It is currently used for errors emitted by declarative macro matching itself; fragment parser +errors still use their existing diagnostics. + +```rust,compile_fail +#![feature(diagnostic_on_unmatch_args)] + +#[diagnostic::on_unmatch_args( + message = "invalid arguments to {This} macro invocation", + label = "expected a type and value here", + note = "this macro expects a type and a value, like `pair!(u8, 0)`", + note = "see <link/to/docs>", +)] +macro_rules! pair { + ($ty:ty, $value:expr) => {}; +} + +pair!(u8); +``` + +This emits output like: + +```text +error: invalid arguments to pair macro invocation + --> example.rs:13:9 + | +9 | macro_rules! pair { + | ----------------- when calling this macro +... +13 | pair!(u8); + | ^ expected a type and value here + | +note: while trying to match `,` + --> example.rs:10:12 + | +10 | ($ty:ty, $value:expr) => {}; + | ^ + = note: this macro expects a type and a value, like `pair!(u8, 0)` + = note: see <link/to/docs> +``` +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "dir_entry_ext2", description: r##"# `dir_entry_ext2` @@ -8077,6 +8278,22 @@ The tracking issue for this feature is: [#99842] deny_since: None, }, Lint { + label: "float_masks", + description: r##"# `float_masks` + + + +The tracking issue for this feature is: [#154064] + +[#154064]: https://github.com/rust-lang/rust/issues/154064 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "float_minimum_maximum", description: r##"# `float_minimum_maximum` @@ -8516,7 +8733,7 @@ The tracking issue for this feature is: [#130539] }, Lint { label: "generic_const_args", - description: r##"# `generic_const_args` + description: r##"# generic_const_args Allows using generics in more complex const expressions, based on definitional equality. @@ -8525,6 +8742,35 @@ The tracking issue for this feature is: [#151972] [#151972]: https://github.com/rust-lang/rust/issues/151972 ------------------------ + +Warning: This feature is incomplete; its design and syntax may change. + +This feature enables many of the same use cases supported by [generic_const_exprs], +but based on the machinery developed for [min_generic_const_args]. In a way, it is +meant to be an interim successor for GCE (though it might not currently support all +the valid cases that supported by GCE). + +See also: [generic_const_items] + +[min_generic_const_args]: min-generic-const-args.md +[generic_const_exprs]: generic-const-exprs.md +[generic_const_items]: generic-const-items.md + +## Examples + +<!-- NOTE(ignore) generic_const_args requires -Znext-solver to compile --> +```rust,ignore (requires-Z-next-solver) +#![feature(generic_const_items)] +#![feature(min_generic_const_args)] +#![feature(generic_const_args)] +#![expect(incomplete_features)] + +type const ADD1<const N: usize>: usize = const { N + 1 }; + +type const INC<const N: usize>: usize = ADD1::<N>; + +const ARR: [(); ADD1::<0>] = [(); INC::<0>]; +``` "##, default_severity: Severity::Allow, warn_since: None, @@ -8532,15 +8778,79 @@ The tracking issue for this feature is: [#151972] }, Lint { label: "generic_const_exprs", - description: r##"# `generic_const_exprs` + description: r##"# generic_const_exprs -Allows non-trivial generic constants which have to have wfness manually propagated to callers +Allows non-trivial generic constants which have to be shown to successfully evaluate +to a value by being part of an item signature. The tracking issue for this feature is: [#76560] + [#76560]: https://github.com/rust-lang/rust/issues/76560 ------------------------ + +Warning: This feature is incomplete; its design and syntax may change. + +See also: [min_generic_const_args], [generic_const_args] + +[min_generic_const_args]: min-generic-const-args.md +[generic_const_args]: generic-const-args.md + +## Examples + +```rust +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +// Use parameters that depend on a generic argument. +struct Foo<const N: usize> +where + [(); N + 1]:, +{ + array: [usize; N + 1], +} + +// Use generic parameters in const operations. +trait Bar { + const X: usize; + const Y: usize; +} + +// Note `B::X * B::Y`. +const fn baz<B: Bar>(x: [usize; B::X], y: [usize; B::Y]) -> [usize; B::X * B::Y] { + let mut out = [0; B::X * B::Y]; + let mut i = 0; + while i < B::Y { + let mut j = 0; + while j < B::X { + out[i * B::X + j] = y[i].saturating_mul(x[j]); + j += 1; + } + i += 1; + } + out +} + + +// Create a new type based on a generic argument. +pub struct Grow<const N: usize> { + arr: [usize; N], +} + +impl<const N: usize> Grow<N> { + pub const fn grow(self, val: usize) -> Grow<{ N + 1 }> { + let mut new_arr = [0; { N + 1 }]; + let mut idx = 0; + while idx < N { + new_arr[idx] = self.arr[idx]; + idx += 1; + } + new_arr[N] = val; + Grow { arr: new_arr } + } +} +``` "##, default_severity: Severity::Allow, warn_since: None, @@ -8548,7 +8858,7 @@ The tracking issue for this feature is: [#76560] }, Lint { label: "generic_const_items", - description: r##"# `generic_const_items` + description: r##"# generic_const_items Allows generic parameters and where-clauses on free & associated const items. @@ -8557,6 +8867,50 @@ The tracking issue for this feature is: [#113521] [#113521]: https://github.com/rust-lang/rust/issues/113521 ------------------------ + +Warning: This feature is an [experiment] and lacks an RFC. +There are no guarantees that it will ever be stabilized. + +See also: [generic_const_exprs], [min_generic_const_args]. + +[experiment]: https://lang-team.rust-lang.org/how_to/experiment.html +[generic_const_exprs]: generic-const-exprs.md +[min_generic_const_args]: min-generic-const-args.md + +## Examples + +### Generic constant values + +```rust +#![allow(incomplete_features)] +#![feature(generic_const_items)] + +const GENERIC_VAL<const ARG: usize>: usize = ARG + 1; + +#[test] +fn generic_const_arg() { + assert_eq!(GENERIC_VAL::<1>, 2); + assert_eq!(GENERIC_VAL::<2>, 3); +} +``` + +### Conditional constants + +```rust +#![allow(incomplete_features)] +#![feature(generic_const_items)] + +// `GENERIC_VAL::<0>` will fail to compile +const GENERIC_VAL<const ARG: usize>: usize = if ARG > 0 { ARG + 1 } else { panic!("0 value") }; + +// Will fail to compile if the `Copy` derive is removed. +const COPY_MARKER<C: Copy>: () = (); + +#[derive(Clone, Copy)] +struct Foo; + +const FOO_IS_COPY: () = COPY_MARKER::<Foo>; +``` "##, default_severity: Severity::Allow, warn_since: None, @@ -8671,6 +9025,22 @@ This feature has no tracking issue, and is therefore likely internal to the comp deny_since: None, }, Lint { + label: "gpu_launch_sized_workgroup_mem", + description: r##"# `gpu_launch_sized_workgroup_mem` + + + +The tracking issue for this feature is: [#135513] + +[#135513]: https://github.com/rust-lang/rust/issues/135513 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "guard_patterns", description: r##"# `guard_patterns` @@ -9034,8 +9404,24 @@ The tracking issue for this feature is: [#99069] deny_since: None, }, Lint { - label: "integer_extend_truncate", - description: r##"# `integer_extend_truncate` + label: "integer_cast_extras", + description: r##"# `integer_cast_extras` + + + +The tracking issue for this feature is: [#154650] + +[#154650]: https://github.com/rust-lang/rust/issues/154650 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { + label: "integer_widen_truncate", + description: r##"# `integer_widen_truncate` @@ -10547,15 +10933,116 @@ The tracking issue for this feature is: [#154042] }, Lint { label: "min_generic_const_args", - description: r##"# `min_generic_const_args` + description: r##"# min_generic_const_args -Enables the generic const args MVP (only bare paths, not arbitrary computation). +Enables the generic const args MVP (paths to type const items and constructors for ADTs and primitives). The tracking issue for this feature is: [#132980] [#132980]: https://github.com/rust-lang/rust/issues/132980 ------------------------ + +Warning: This feature is incomplete; its design and syntax may change. + +This feature acts as a minimal alternative to [generic_const_exprs] that allows a smaller subset of functionality, +and uses a different approach for implementation. It is intentionally more restrictive, which helps with avoiding edge +cases that make the `generic_const_exprs` hard to implement properly. See [Feature background][feature_background] +for more details. + +Related features: [generic_const_args], [generic_const_items]. + +[feature_background]: https://github.com/rust-lang/project-const-generics/blob/main/documents/min_const_generics_plan.md +[generic_const_exprs]: generic-const-exprs.md +[generic_const_args]: generic-const-args.md +[generic_const_items]: generic-const-items.md + +## `type const` syntax + +This feature introduces new syntax: `type const`. +Constants marked as `type const` are allowed to be used in type contexts, e.g.: + +```compile_fail +#![allow(incomplete_features)] +#![feature(min_generic_const_args)] + +type const X: usize = 1; +const Y: usize = 1; + +struct Foo { + good_arr: [(); X], // Allowed + bad_arr: [(); Y], // Will not compile, `Y` must be `type const`. +} +``` + +## Examples + +```rust +#![allow(incomplete_features)] +#![feature(min_generic_const_args)] + +trait Bar { + type const VAL: usize; + type const VAL2: usize; +} + +struct Baz; + +impl Bar for Baz { + type const VAL: usize = 2; + type const VAL2: usize = const { Self::VAL * 2 }; +} + +struct Foo<B: Bar> { + arr1: [usize; B::VAL], + arr2: [usize; B::VAL2], +} +``` + +Note that with [generic_const_exprs] the same example would look as follows: + +```rust +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +trait Bar { + const VAL: usize; + const VAL2: usize; +} + +struct Baz; + +impl Bar for Baz { + const VAL: usize = 2; + const VAL2: usize = const { Self::VAL * 2 }; +} + +struct Foo<B: Bar> +where + [(); B::VAL]:, + [(); B::VAL2]:, +{ + arr1: [usize; B::VAL], + arr2: [usize; B::VAL2], +} +``` + +Use of const functions is allowed: + +```rust +#![allow(incomplete_features)] +#![feature(min_generic_const_args)] + +const VAL: usize = 1; + +const fn inc(val: usize) -> usize { + val + 1 +} + +type const INC: usize = const { inc(VAL) }; + +const ARR: [usize; INC] = [0; INC]; +``` "##, default_severity: Severity::Allow, warn_since: None, @@ -11802,6 +12289,22 @@ The tracking issue for this feature is: [#142503] deny_since: None, }, Lint { + label: "pathbuf_into_string", + description: r##"# `pathbuf_into_string` + + + +The tracking issue for this feature is: [#156203] + +[#156203]: https://github.com/rust-lang/rust/issues/156203 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "pattern", description: r##"# `pattern` @@ -11958,6 +12461,20 @@ The tracking issue for this feature is: [#130494] deny_since: None, }, Lint { + label: "pin_macro_internals", + description: r##"# `pin_macro_internals` + + + +This feature has no tracking issue, and is therefore likely internal to the compiler, not being intended for general use. + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "pointer_is_aligned_to", description: r##"# `pointer_is_aligned_to` @@ -14442,6 +14959,22 @@ The tracking issue for this feature is: [#119639] deny_since: None, }, Lint { + label: "tcp_keepalive", + description: r##"# `tcp_keepalive` + + + +The tracking issue for this feature is: [#155889] + +[#155889]: https://github.com/rust-lang/rust/issues/155889 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "tcp_linger", description: r##"# `tcp_linger` @@ -14912,7 +15445,7 @@ pub fn main() { foo(&1); // Use trait alias for trait objects. - let a: &Bar = &123; + let a: &dyn Bar = &123; println!("{:?}", a); let b = Box::new(456) as Box<dyn Foo>; println!("{:?}", b); @@ -16265,6 +16798,22 @@ The tracking issue for this feature is: [#146954] deny_since: None, }, Lint { + label: "view_types", + description: r##"# `view_types` + +Allows view types. + +The tracking issue for this feature is: [#155938] + +[#155938]: https://github.com/rust-lang/rust/issues/155938 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "waker_fn", description: r##"# `waker_fn` @@ -16445,6 +16994,22 @@ This feature is internal to the Rust compiler and is not intended for general us deny_since: None, }, Lint { + label: "windows_permissions_ext", + description: r##"# `windows_permissions_ext` + + + +The tracking issue for this feature is: [#152956] + +[#152956]: https://github.com/rust-lang/rust/issues/152956 + +------------------------ +"##, + default_severity: Severity::Allow, + warn_since: None, + deny_since: None, + }, + Lint { label: "windows_process_exit_code_from", description: r##"# `windows_process_exit_code_from` |