rust/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs

22 lines
351 B
Rust
Raw Normal View History

// Checks that a sibling function (i.e. `foo`) cannot constrain
// an RPITIT from another function (`bar`).
trait Trait {
fn foo();
fn bar() -> impl Sized;
}
impl Trait for () {
fn foo() {
let _: String = Self::bar();
//~^ ERROR mismatched types
}
fn bar() -> impl Sized {
loop {}
}
}
fn main() {}