Add suspicious group
changelog: Introduce `clippy::suspicious` 🤔 group and move several lints into the group
Closes#6366. CC #6626.
A number of lints are moved from each of `correctness`, `style` and `complexity` groups. Notably I didn't move `suspicious_splitn` since I think that is a `correctness` lint despite the name.
Lints moved to `clippy::suspicious`:
* `blanket_clippy_restriction_lints` (was `clippy::style`)
* `empty_loop` (was `clippy::style`)
* `eval_order_dependence` (was `clippy::complexity`)
* `float_equality_without_abs` (was `clippy::correctness`)
* `for_loops_over_fallibles` (was `clippy::correctness`)
* `misrefactored_assign_op` (was `clippy::complexity`)
* `mut_range_bound` (was `clippy::complexity`)
* `mutable_key_type` (was `clippy::correctness`)
* `suspicious_arithmetic_impl` (was `clippy::correctness`)
* `suspicious_assignment_formatting` (was `clippy::style`)
* `suspicious_else_formatting` (was `clippy::style`)
* `suspicious_map` (was `clippy::complexity`)
* `suspicious_op_assign_impl` (was `clippy::correctness`)
* `suspicious_unary_op_formatting` (was `clippy::style`)
Fix typo in libs tracking issue template
Currently, the libs tracking issue template expands FCP as "final commenting period". Everywhere else, including in [the official explanation](https://rust-lang.github.io/rfcs/), it's expanded as "final comment period". That version also sounds a bit better. Accordingly, this PR changes the tracking issue template to use that version.
`@rustbot` label A-meta T-libs-api
r? `@m-ou-se`
Reserve prefixed identifiers and literals (RFC 3101)
This PR denies any identifiers immediately followed by one of three tokens `"`, `'` or `#`, which is stricter than the requirements of RFC 3101 but may be necessary according to the discussion at [Zulip].
[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/268952-edition-2021/topic/reserved.20prefixes/near/238470099
The tracking issue #84599 says we'll add a feature gate named `reserved_prefixes`, but I don't think I can do this because it is impossible for the lexer to know whether a feature is enabled or not. I guess determining the behavior by the edition information should be enough.
Fixes#84599
2229: Capture box completely in move closures
Even if the content from box is used in a sharef-ref context,
we capture the box entirerly.
This is motivated by:
1) We only capture data that is on the stack.
2) Capturing data from within the box might end up moving more data than
the user anticipated.
Closes https://github.com/rust-lang/project-rfc-2229/issues/50
r? `@nikomatsakis`
This causes Windows Defender's firewall to pop up during tests to ask if
I want to allow the test program to access the public Internet, since it
was listening on `0.0.0.0`. The test server doesn't actually need to be
publically reachable, so this makes it so it is only reachable locally,
which makes Windows Defender happy.
Revert revert of constness in #86003
Re-constify `mem::swap`, `mem::replace`, `ptr::write` which were marked as not `const` in #86003
Once the checks pass, this should solve #86236
Add debug info tests for range, fix-sized array, and cell types
This PR add several debug info tests to guarantee that the displays of fixed sized arrays, range types, cell types, threads, locks, and mutexes in CDB are correct.
It also updates CDB tests for slices in pretty-std.rs after string visualization in WinDbg is fixed by this PR: #81898.
Fix ICE with `-Zunpretty=hir,typed`
This PR fixes#82328. The `-Zunpretty=hir,typed` pretty-printer maintains an `Option` with type-checking results and sets the `Option` to `Some` when entering a body. However, this leads to an ICE if an expression occurs in a function signature (i.e. outside of a body), such as `128` in
```rust
fn foo(-128..=127: i8) {}
```
This PR fixes the ICE by checking (if necessary) whether the expression's owner has a body, and retrieving type-checking results for that on the fly.
Allow loading of llvm plugins on nightly
Based on a discussion in #82734 / with `@wsmoses.`
Mainly moves [this](0149bc4e7e) behind a -Z flag, so it can only be used on nightly,
as requested by `@nagisa` in https://github.com/rust-lang/rust/issues/82734#issuecomment-835863940
This change allows loading of llvm plugins like Enzyme.
Right now it also requires a shared library LLVM build of rustc for symbol resolution.
```rust
// test.rs
extern { fn __enzyme_autodiff(_: usize, ...) -> f64; }
fn square(x : f64) -> f64 {
return x * x;
}
fn main() {
unsafe {
println!("Hello, world {} {}!", square(3.0), __enzyme_autodiff(square as usize, 3.0));
}
}
```
```
./rustc test.rs -Z llvm-plugins="./LLVMEnzyme-12.so" -C passes="enzyme"
./test
Hello, world 9 6!
```
I will try to figure out how to simplify the usage and get this into stable in a later iteration,
but having this on nightly will already help testing further steps.