about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-02-25 13:32:52 +0100
committerGitHub <noreply@github.com>2025-02-25 13:32:52 +0100
commitfb31487fdb2f28c9368a6ea887709ad7575ec070 (patch)
tree6383fc262ed242476642054d2c8849886b618ed9 /compiler/rustc_driver_impl/src
parentad27045c31a9f37ad7d44ca2a403de52d1a896d3 (diff)
parentffc955bcfb79063b51947d4846591bf162e7ddfe (diff)
downloadrust-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