When determining when a function or method can be called from a `const`
context, the determination must be made on the instance, not on the
declaration. This makes a difference, for example, with `const_trait`
traits whose implementations may or may not be `const`.
changelog: [`missing_const_for_fn`]: when checking if a function or
method can be called from a `const` context, look at the concrete
implementation rather than at the trait definition
Fixesrust-lang/rust-clippy#14658
r? @Jarcho
This test checks that all symbols defined in Clippy's `sym.rs` file are
used in Clippy. Otherwise, it will fail with a list of symbols which are
unused.
This test only runs when the `internal` feature is set, to allow
developers to temporarily define new, yet unused symbols without failing
the tests. Also, it will not run as part of the compiler test suite, as
an extra symbol should never be seen as a fatal problem in the compiler
repo.
changelog: none
When determining when a function or method can be called from a `const`
context, the determination must be made on the instance, not on the
declaration. This makes a difference, for example, with `const_trait`
traits whose implementations may or may not be `const`.
Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.
So they match the order of the parts in the source code, e.g.:
```
struct Foo<T, U> { t: T, u: U }
<-><----> <------------>
/ | \
ident generics variant_data
```
r? `@fee1-dead`
So they match the order of the parts in the source code, e.g.:
```
struct Foo<T, U> { t: T, u: U }
<-><----> <------------>
/ | \
ident generics variant_data
```
The first commit fixesrust-lang/rust-clippy#14802: when a slice is
directly present, it must be dereferenced (instead of referenced -1
times) before being passed to `mem::size_of_val()`.
The second commit triggers the lint in a `const` contact when MSRV ≥
1.85.
changelog: [`manual_slice_size_computation`]: fix ICE in suggestion to
efficiently compute the size of a slice, and trigger the lint in `const`
context as well
Fixes#13793.
Interestingly enough, to actually check that the macro call has at least
two arguments, we need to use the rust lexer after getting the original
source code snippet.
changelog: Add new `useless_concat` lint
make `rustc_attr_parsing` less dominant in the rustc crate graph
It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly.
Previous graph:

Graph with this PR:

The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*.
The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
fixes#12979fixes#12951fixes#13233
Tests still need to be finished and the docs still need to be updated,
but this should otherwise ready.
changelog: Lint `declare_interior_mutable_const` and
`borrow_interior_mutable_const` more precisely
Added lint for catching `&[foo.clone()]` where foo is a reference and
suggests `std::slice::from_ref(foo)`.
changelog: new lint: [`cloned_ref_to_slice_refs`]