diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-02-25 13:32:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-25 13:32:52 +0100 |
| commit | fb31487fdb2f28c9368a6ea887709ad7575ec070 (patch) | |
| tree | 6383fc262ed242476642054d2c8849886b618ed9 /compiler/rustc_driver_impl/src | |
| parent | ad27045c31a9f37ad7d44ca2a403de52d1a896d3 (diff) | |
| parent | ffc955bcfb79063b51947d4846591bf162e7ddfe (diff) | |
| download | rust-fb31487fdb2f28c9368a6ea887709ad7575ec070.tar.gz rust-fb31487fdb2f28c9368a6ea887709ad7575ec070.zip | |
Rollup merge of #135480 - oli-obk:sized-method-on-unsized-impl, r=lcnr
Don't require method impls for methods with `Self:Sized` bounds for impls for unsized types
Similarly to how #112319 doesn't require specifying associated types with `Self: Sized` bounds on `dyn Trait`, we now don't require assoc items with `Self: Sized` bounds to be in impls of for unsized types.
Additionally we lint assoc items with `Self: Sized` bounds that are in such impls:
```rust
trait Foo {
fn foo() where Self: Sized;
}
impl Foo for () {
fn foo() {}
}
impl Foo for i32 {}
//~^ ERROR: not all trait items implemented, missing: `foo`
impl Foo for dyn std::fmt::Debug {}
#[deny(dead_code)]
impl Foo for dyn std::fmt::Display {
fn foo() {}
//~^ ERROR this item cannot be used as its where bounds are not satisfied
}
```
Note that this works with the same `Self: Sized` specific logic we already have for `dyn Trait`, so no new capabilities like avoiding assoc items with `Self: Copy` bounds on impls for `String` or such are added here. Specifying `where ConcreteType: Sized` in a trait and implementing the trait for `ConcreteType` also does not work, it *must* be exactly `Self: Sized`.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
0 files changed, 0 insertions, 0 deletions
