diff options
| author | bors <bors@rust-lang.org> | 2023-08-24 18:10:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-24 18:10:42 +0000 |
| commit | df68b713270775364dc286eaec1c48fd14ae50e4 (patch) | |
| tree | 2afb5aa99a0716c3831f48e15977b5d6d57650cd /compiler/rustc_interface/src/errors.rs | |
| parent | 4932d0573360bb71d078579842d7b7712edff1a3 (diff) | |
| parent | 12275713d5e1540ddde6a6854b106c537270e9de (diff) | |
| download | rust-df68b713270775364dc286eaec1c48fd14ae50e4.tar.gz rust-df68b713270775364dc286eaec1c48fd14ae50e4.zip | |
Auto merge of #11362 - y21:superfluous_impl, r=xFrednet
new lint: `implied_bounds_in_impls`
Closes #10849
A new lint that looks for explicitly specified bounds that are already implied by other bounds in `impl Trait` return position types.
One example, as shown in the linked example, would be
```rs
fn foo<T>(x: T) -> impl Deref<Target = T> + DerefMut<Target = T> {
Box::new(x)
}
```
`DerefMut<Target = T>` requires `Deref<Target = T>` to be wellformed, so specifying `Deref` there is unnecessary.
This currently "ignores" (i.e., does not lint at all) transitive supertrait bounds (e.g. `trait A {} trait B: A {} trait C: B {}`, then having an `impl A + C` type), because that seems a bit more difficult and I think this isn't technically a blocker. It leads to FNs, but shouldn't bring any FPs
changelog: new lint [`implied_bounds_in_impls`]
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
