diff options
Diffstat (limited to 'tests/ui/impl-trait/method-resolution3.rs')
| -rw-r--r-- | tests/ui/impl-trait/method-resolution3.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/method-resolution3.rs b/tests/ui/impl-trait/method-resolution3.rs new file mode 100644 index 00000000000..8474e2da7db --- /dev/null +++ b/tests/ui/impl-trait/method-resolution3.rs @@ -0,0 +1,29 @@ +//! Check that we consider `Bar<impl Sized>` to successfully unify +//! with both `Bar<u32>` and `Bar<i32>` (in isolation), so we bail +//! out with ambiguity. + +//@ revisions: current next +//@[next] compile-flags: -Znext-solver + +struct Bar<T>(T); + +impl Bar<u32> { + fn bar(self) {} +} + +impl Bar<i32> { + fn bar(self) {} +} + +fn foo(x: bool) -> Bar<impl Sized> { + //[current]~^ ERROR: cycle + if x { + let x = foo(false); + x.bar(); + //[current]~^ ERROR: no method named `bar` + //[next]~^^ ERROR: multiple applicable items in scope + } + todo!() +} + +fn main() {} |
