| Age | Commit message (Collapse) | Author | Lines |
|
Rustc itself now warns for all cases that triggered this lint.
|
|
|
|
|
|
|
|
|
|
|
|
This should make Clippy more resilient and will unblock #78343.
This PR is made against rust-lang/rust to avoid the need for a subtree
sync at @flip1995's suggestion in rust-lang/rust-clippy#6310.
|
|
add error_occured field to ConstQualifs,
fix #76064
I wasn't sure what `in_return_place` actually did and not sure why it returns `ConstQualifs` while it's sibling functions return `bool`. So I tried to make as minimal changes to the structure as possible. Please point out whether I have to refactor it or not.
r? `@oli-obk`
cc `@RalfJung`
|
|
|
|
Co-authored-by: varkor <github@varkor.com>
|
|
hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk
ICEs should always print the top of the query stack
see #76920
|
|
|
|
|
|
|
|
|
|
That is, this changes `#[forbid(foo)] #[allow(foo)]` from allowing foo to
forbidding foo.
|
|
|
|
|
|
Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.
|
|
Stabilize some Result methods as const
Stabilize the following methods of Result as const:
- `is_ok`
- `is_err`
- `as_ref`
A test is also included, analogous to the test for `const_option`.
These methods are currently const under the unstable feature `const_result` (tracking issue: #67520).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135).
Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature.
Related: #76225
|
|
Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts.
Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.
|
|
|
|
We no longer lint assignments to const item fields in the
`temporary_assignment` lint, since this is now covered by the
`CONST_ITEM_MUTATION` lint.
Additionally, we `#![allow(const_item_mutation)]` in the
`borrow_interior_mutable_const.rs` test. Clippy UI tests are run with
`-D warnings`, which seems to cause builtin lints to prevent Clippy
lints from running.
|
|
If a comma in a format call is replaced with a similar token, then we
emit an error and continue parsing, instead of stopping at this point.
|
|
|
|
|
|
This commit updates clippy with the introduction of `QPath::LangItem` so
that it still compiles.
Signed-off-by: David Wood <david@davidtw.co>
|
|
|
|
Clippy pointer cast lint experiment
This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.
This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).
r? @oli-obk
|
|
|
|
|
|
suggest anything
|
|
|
|
Check whether locals are too large instead of whether accesses into them are too large
Essentially this stops const prop from attempting to optimize
```rust
let mut x = [0_u8; 5000];
x[42] = 3;
```
I don't expect this to be a perf improvement without #73656 (which is also where the lack of this PR will be a perf regression).
r? @wesleywiser
|
|
|
|
Co-authored-by: Philipp Krones <hello@philkrones.com>
|
|
|
|
transmutes_expressible_as_ptr_casts test
|
|
lint ordering changing
|
|
covering the same ground
|
|
still get an ICE
|
|
There are 5 errors, when there should be 7.
|
|
transmute module
|
|
|
|
The reason we do not trigger these lints anymore is that clippy sets the mir-opt-level to 0, and the recent changes subtly changed how the const propagator works.
|
|
|
|
|
|
Stabilize `transmute` in constants and statics but not const fn
cc #53605 (leaving issue open so we can add `transmute` to `const fn` later)
Previous attempt: #64011
r? @RalfJung
cc @rust-lang/wg-const-eval
|
|
|
|
Other terms are more inclusive and precise.
|