Files
rust/tests/ui/impl-trait/method/method-resolution5-deref-no-constrain.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
535 B
Rust
Raw Normal View History

2025-09-23 17:33:24 +02:00
//! The recursive method call yields the opaque type. We want
//! to use the impl candidate for `Foo` here without constraining
//! the opaque to `&Foo`.
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
use std::ops::Deref;
struct Foo;
impl Foo {
fn method(&self) {}
}
fn via_deref() -> impl Deref<Target = Foo> {
// Currently errors on stable, but should not
if false {
via_deref().method();
}
Box::new(Foo)
//[current]~^ ERROR mismatched types
}
fn main() {}