Skip to content

nested RPITIT in default methods result in type mismatch #142

@lcnr

Description

@lcnr
use std::ops::Deref; trait Foo { fn bar() -> impl Deref<Target = impl Sized> { &() } } fn main() {}
error[E0271]: type mismatch resolving `<impl Deref<Target = impl Sized> as Deref>::Target == impl Sized` --> <source>:4:17 | 4 | fn bar() -> impl Deref<Target = impl Sized> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ | note: required by a bound in `Foo::{synthetic#0}` --> <source>:4:28 | 4 | fn bar() -> impl Deref<Target = impl Sized> { | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::{synthetic#0}` 

affected tests

  • tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs
  • tests/ui/impl-trait/in-trait/default-body-with-rpit.rs

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions