`Option<Symbol>` is a much nicer and idiomatic way of representing "no
name" using empty symbols. And it works naturally for the item ordering
checking because `None < Some(_)` just like the empty string compares
less than all non-empty strings.
changelog: none
There were two bugs here. Let's assume `T` is a singleton type
implementing `Default` and that `f()` takes a `T`:
- `f(<T>::default())` cannot be replaced by `f(<T)` as it was (incorrect
spans – this is tricky because the type relative path uses a base span
covering only `T`, not `<T>`) (third commit)
- The argument of `f(<_>::default())` is inferred correctly, but cannot
be replaced by `<_>` or `_`, as this cannot be used to infer an instance
of a singleton type (first commit).
The second commit offers better error messages by pointing at the whole
expression.
Fix#12654
changelog: [`default_constructed_unit_struct`]: do not suggest incorrect
fix when using a type surrounded by brackets
`non_canonical_partial_ord_impl` will now recognize two forms of
canonical implementations: `Some(self.cmp(other))` and
`self.cmp(other).into()`.
changelog: [`non_canonical_partial_ord_impl`]: recognize
`self.cmp(other).into()` as a canonical implementation of
`PartialOrd::partial_cmp()`.
Fixesrust-lang/rust-clippy#13640
Fixes rust-lang/rust-clippy#14449, introduced in #14314
changelog: [`map_entry`]: fix a false positive where the lint would
trigger without any insert calls present
changelog: [`manual_abs_diff`]: Initial implementation
Hey, first time writing a new lint for clippy, hope I got it right. I
think it's pretty self-explanatory!
Added a few `fixme` test cases, where the lint can be improved to catch
more (probably rare) patterns, but opening a PR with this initial
implementation to make sure I'm on the right track, and that this lint
is acceptable at all.
😁
Straight from triagebot's documentation, this should allow the bot to
set and remove the `S-waiting-on-author` and `S-waiting-on-review`
labels when a PR author requests a review, or when a review is done with
changes requested.
We do not want to remove casts done inside macros. Also, when printing
the suggestion, take it from the same context as the origin expression
(the root context).
Problems found while working on #14526, but should be merged even if
#14526 is not.
changelog: none
This PR enables to the canonicalization of issue links in triagebot.
Documentation pending at
https://github.com/rust-lang/rust-forge/pull/825
changelog: add `[canonicalize-issue-links]` in `triagebot.toml`
This PR fixes issues with the `missing_asserts_for_indexing` lint.
- false positive when the first index is the highest(or equal) value in
a list of indexes:
```rust
pub fn foo(slice: &[i32]) -> i32{
slice[1] * slice[0]
}
```
- false negative when an assert statement if found after the indexing
operation.
```rust
pub fn bar(slice: &[i32]) -> i32 {
let product = slice[0] * slice[1];
assert!(slice.len() > 1);
product
}
```
examples: https://godbolt.org/z/s7Y47vKdEcloses: #14079
changelog: [`missing_asserts_for_indexing`]: ignore asserts found after
indexing, and do not require asserts if the first index is highest.
Not all host tools platforms support `f16`/`f128` builtins yet due to
LLVM assertion failures and miscompilations. Until them, Clippy should
avoid using `f16`/`f128` at runtime itself. See
https://github.com/rust-lang/rust/issues/137630.
cc @tgross35
changelog: none
We do not want to remove casts done inside macros. Also, when printing
the suggestion, take it from the same context as the origin expression
(the root context).
r? @flip1995
After seeing some PRs get relabelled I think it's probably for the best
not to, a conflict doesn't mean it's no longer waiting for review after
all
changelog: none
Move methods from `Map` to `TyCtxt`, part 5.
This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.
A follow-up to #137504.
r? `@Zalathar`
Various local trait item iteration cleanups
Adding a trait impl for `Foo` unconditionally affected all queries that are interested in a completely independent trait `Bar`. Perf has no effect on this. We probably don't have a good perf test for this tho.
r? `@compiler-errors`
I am unsure about https://github.com/rust-lang/rust/pull/139018/commits/9d05efb66f7b599eeacb5d2456f844fe4768e865 as it doesn't improve anything wrt incremental, because we still do all the checks for valid `Drop` impls, which subsequently will still invoke many queries and basically keep the depgraph the same.
I want to do
9549077a47/compiler/rustc_middle/src/ty/trait_def.rs (L141)
but would leave that to a follow-up PR, this one changes enough things as it is
This PR resolves#11432 by checking that paths resolve in `disallowed_*`
configurations.
It also does some lightweight validation of definition kinds. For
example, only paths that resolve to `DefKind::Macro` definitions are
allowed in `disallowed_macro` configurations.
~The PR is currently two commits. The first is #14376 (cc: @Jarcho),
which I submitted just a few days ago. The second commit is everything
else.~
Side note: For me, the most difficult part of this PR was getting the
spans of the individual `DisallowedPath` configurations. There is some
discussion at https://github.com/toml-rs/toml/discussions/840, if
interested.
changelog: validate paths in `disallowed_*` configurations
Fixes#14488
Context: the `macro_metavars_in_unsafe` lint looks for unsafe blocks
with a macro span that then contain expressions with a root context span
(which means that it is a macro with an unsafe block expanding a
metavariable inside). In order to avoid emitting a warning for every
single macro invocation, it will deduplicate the unsafe blocks by the
span in the macro.
This leads to the linked issue where because of the deduplicating and
removing unsafe blocks that all belong to the same unsafe block in the
macro, only one of the unsafe blocks will actually have its lint
expectation fulfilled. This PR fixes that by manually fulfilling all of
the unsafe blocks from all expansions before deduplicating them.
changelog: [`macro_metavars_in_unsafe`]: fix unfulfilled `#[expect]` if
macro is invoked multiple times
A discrepancy between the `cmake` version available on the runners and
the one required by the `aws-lc-sys` dependency prevents the crate from
building.
changelog: none
r? @flip1995
cc @Alexendoo