Commit Graph

10463 Commits

Author SHA1 Message Date
Esteban Küber
eff6d414c0 On implicit Sized bound on fn argument, point at type instead of pattern
Instead of

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:20
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                    ^^^^^^^ doesn't have a size known at compile-time
```

output

```
error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _> + 'static)` cannot be known at compilation time
  --> $DIR/issue-59324.rs:23:29
   |
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
   |                             ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
```
2024-09-27 00:45:02 +00:00
Ben Kimock
249210e8d8 Fix clippy 2024-09-21 01:07:00 -04:00
bors
bb04c68b2e Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
Disallow hidden references to mutable static

Closes #123060

Tracking:
- https://github.com/rust-lang/rust/issues/123758
2024-09-20 17:25:34 +00:00
GnomedDev
4f319002cd [Clippy] Remove final std paths for diagnostic item 2024-09-20 10:39:31 +01:00
GnomedDev
07b6e0713e Categorise paths in clippy_utils::paths 2024-09-19 13:13:43 +01:00
GnomedDev
c7453b4280 [Clippy] Swap open_options to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
917775fff1 [Clippy] Swap iter_over_hash_type to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
37e38320b4 [Clippy] Swap non_octal_unix_permissions to use diagnostic item instead of path 2024-09-19 13:13:43 +01:00
GnomedDev
f1fc9c07c4 [Clippy] Swap unnecessary_owned_empty_strings to use diagnostic item instead of path 2024-09-19 13:13:43 +01:00
GnomedDev
1b76ae683c [Clippy] Swap manual_strip to use diagnostic items instead of paths 2024-09-19 13:13:43 +01:00
GnomedDev
acb6748f80 [Clippy] Swap unnecessary_to_owned to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
98dc68e85e [Clippy] Swap instant_subtraction to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
d63e35ba22 [Clippy] Swap waker_clone_wake to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
45c1700e13 [Clippy] Swap filter_map_bool_then to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
b0152909d6 [Clippy] Swap manual_while_let_some to use diagnostic items instead of paths 2024-09-19 13:13:42 +01:00
GnomedDev
984bd6fed6 [Clippy] Swap repeat_vec_with_capacity to use diagnostic item instead of path 2024-09-19 13:13:42 +01:00
GnomedDev
545967955a [Clippy] Swap VecArgs::hir to use diagnostic items instead of paths 2024-09-19 13:13:40 +01:00
GnomedDev
f66915e8f8 [Clippy] Swap single_char_add_str/format_push_string to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
959f7a2bbb [Clippy] Swap manual_main_separator_str to use diagnostic item instead of path 2024-09-19 13:13:20 +01:00
GnomedDev
1922a99bc6 [Clippy] Swap redundant_clone to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
8fc9e67cf5 [Clippy] Swap float_equality_without_abs to use diagnostic items instead of paths 2024-09-19 13:13:20 +01:00
GnomedDev
7ffd485be0 [Clippy] Swap option_as_ref_deref to use diagnostic items instead of paths 2024-09-19 13:13:19 +01:00
GnomedDev
71dbfd55a1 [Clippy] Swap lines_filter_map_ok to use a diagnostic item instead of path 2024-09-19 08:26:41 +01:00
GnomedDev
5a13a93d41 [Clippy] Swap map_entry to use diagnostic items instead of paths 2024-09-19 08:26:37 +01:00
GnomedDev
978582be74 [Clippy] Swap manual_retain to use diagnostic items instead of paths 2024-09-18 17:20:44 +01:00
Matthias Krüger
e3bb779e1e Rollup merge of #130293 - gurry:130142-lint-level-issue, r=cjgillot
Fix lint levels not getting overridden by attrs on `Stmt` nodes

Fixes #130142. See comments on the issue for context.

r? `@cjgillot`
2024-09-15 16:01:37 +02:00
Ralf Jung
976131f896 stabilize const_mut_refs 2024-09-15 09:51:32 +02:00
Folkert de Vries
b5ea5c23b3 stabilize const_extern_fn 2024-09-14 18:07:06 +02:00
Gurinder Singh
9e697964dc Fix lint levels not getting overridden by attrs on Stmt nodes 2024-09-14 16:12:00 +05:30
Trevor Spiteri
7cccef84cf handle transmutes in const context if msrvs::CONST_FLOAT_BITS_CONV 2024-09-13 13:57:41 +02:00
Trevor Spiteri
7fcdebf658 Revert "stabilize const_float_bits_conv" for src/tools/clippy/clippy_lints
This reverts the part of commit 19908ff7a3 in
subdirectory src/tools/clippy/clippy_lints.
2024-09-13 13:56:41 +02:00
Obei Sideg
cd99729478 Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
Michael Goulet
1c2e9f8775 Remove unused functions from ast CoroutineKind 2024-09-11 19:24:40 -04:00
Matthias Krüger
c8f5136fe8 Rollup merge of #129555 - RalfJung:const_float_bits_conv, r=dtolnay
stabilize const_float_bits_conv

This stabilizes `const_float_bits_conv`, and thus fixes https://github.com/rust-lang/rust/issues/72447. With https://github.com/rust-lang/rust/pull/128596 having landed, this is entirely a libs-only question now.

```rust
impl f32 {
    pub const fn to_bits(self) -> u32;
    pub const fn from_bits(v: u32) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 4];
    pub const fn to_le_bytes(self) -> [u8; 4]
    pub const fn to_ne_bytes(self) -> [u8; 4];
    pub const fn from_be_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self;
}

impl f64 {
    pub const fn to_bits(self) -> u64;
    pub const fn from_bits(v: u64) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 8];
    pub const fn to_le_bytes(self) -> [u8; 8]
    pub const fn to_ne_bytes(self) -> [u8; 8];
    pub const fn from_be_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self;
}
````

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-09-07 23:30:11 +02:00
Pavel Grigorenko
0b8cb4a1eb Make Ty::boxed_ty return an Option 2024-09-06 00:30:36 +03:00
Ralf Jung
ba2577f23c stabilize const_float_bits_conv 2024-09-01 12:38:59 +02:00
Matthias Krüger
663f20086a Rollup merge of #129207 - GrigorenkoPV:elided-is-named, r=cjgillot
Lint that warns when an elided lifetime ends up being a named lifetime

As suggested in https://github.com/rust-lang/rust/issues/48686#issuecomment-1817334575

Fixes #48686
2024-09-01 03:58:03 +02:00
Pavel Grigorenko
9957101f3a elided_named_lifetimes: bless & add tests 2024-08-31 15:35:42 +03:00
Michael Goulet
5bbb0d41f1 Stop using ty::GenericPredicates for non-predicates_of queries 2024-08-29 00:17:40 -04:00
bors
508a7b4b38 Auto merge of #129531 - Jarcho:clippyup, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-08-25 11:56:57 +00:00
Jason Newcomb
173d5a6af0 Merge commit '0f8eabd6231366bfc1bb1464601297c2d48f8f68' into clippyup 2024-08-24 18:33:44 -04:00
Matthias Krüger
8b8a3c91af Rollup merge of #129510 - GrigorenkoPV:fix-elided-named-lifetimes, r=cjgillot
Fix `elided_named_lifetimes` in code

https://github.com/rust-lang/rust/pull/129207#issuecomment-2308428671

r? cjgillot
2024-08-24 22:14:15 +02:00
Pavel Grigorenko
3c4367a80f Fix elided_named_lifetimes in code 2024-08-24 19:21:32 +03:00
Ralf Jung
89ad7334e0 stabilize const_fn_floating_point_arithmetic 2024-08-22 08:25:54 +02:00
Ralf Jung
43e1145c80 rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
Matthias Krüger
dde0dca695 Rollup merge of #129065 - nnethercote:PartialEq-TokenKind, r=spastorino
Use `impl PartialEq<TokenKind> for Token` more.

This lets us compare a `Token` with a `TokenKind`. It's used a lot, but can be used even more, avoiding the need for some `.kind` uses.

r? `@spastorino`
2024-08-15 19:32:35 +02:00
Nicholas Nethercote
f72b3dbba2 Use impl PartialEq<TokenKind> for Token more.
This lets us compare a `Token` with a `TokenKind`. It's used a lot, but
can be used even more, avoiding the need for some `.kind` uses.
2024-08-14 16:37:09 +10:00
bors
6d08b08927 Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errors
Shrink `TyKind::FnPtr`.

By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.

r? `@compiler-errors`
2024-08-14 00:56:53 +00:00
bors
e36c2a40e3 Auto merge of #126793 - saethlin:mono-rawvec, r=scottmcm
Apply "polymorphization at home" to RawVec

The idea here is to move all the logic in RawVec into functions with explicit size and alignment parameters. This should eliminate all the fussing about how tweaking RawVec code produces large swings in compile times.

This uncovered https://github.com/rust-lang/rust-clippy/issues/12979, so I've modified the relevant test in a way that tries to preserve the spirit of the test without tripping the ICE.
2024-08-12 01:47:06 +00:00
John Kåre Alsaker
837d9045c5 Link std statically in rustc_driver 2024-08-11 04:16:53 +02:00