rust/tests/ui/impl-trait/in-trait/issue-102140.rs
Esteban Küber a9841936fe Deduplicate more sized errors on call exprs
Change the implicit `Sized` `Obligation` `Span` for call expressions to
include the whole expression. This aids the existing deduplication
machinery to reduce the number of errors caused by a single unsized
expression.
2024-01-24 02:53:15 +00:00

27 lines
476 B
Rust

trait Marker {}
impl Marker for u32 {}
trait MyTrait {
fn foo(&self) -> impl Marker
where
Self: Sized;
}
struct Outer;
impl MyTrait for Outer {
fn foo(&self) -> impl Marker {
42
}
}
impl dyn MyTrait {
fn other(&self) -> impl Marker {
MyTrait::foo(&self)
//~^ ERROR the trait bound `&dyn MyTrait: MyTrait` is not satisfied
//~| ERROR the trait bound `&dyn MyTrait: MyTrait` is not satisfied
}
}
fn main() {}