about summary refs log tree commit diff
path: root/tests/ui/impl-trait/method/method-resolution.rs
diff options
context:
space:
mode:
authorLaurențiu Nicola <lnicola@users.noreply.github.com>2025-09-29 04:29:28 +0000
committerGitHub <noreply@github.com>2025-09-29 04:29:28 +0000
commit930451e17d47cc27b6c96cb358dfae2ed3a97c67 (patch)
tree722e3fdf88fdae0903cd1ff43cfc801db18345d3 /tests/ui/impl-trait/method/method-resolution.rs
parentc0e45c896823664c49d631e961208d640dc43c58 (diff)
parent24f6f94c5ad90be5d1ced24d83b8485712bcc27a (diff)
downloadrust-930451e17d47cc27b6c96cb358dfae2ed3a97c67.tar.gz
rust-930451e17d47cc27b6c96cb358dfae2ed3a97c67.zip
Merge pull request #20761 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'tests/ui/impl-trait/method/method-resolution.rs')
-rw-r--r--tests/ui/impl-trait/method/method-resolution.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/method/method-resolution.rs b/tests/ui/impl-trait/method/method-resolution.rs
new file mode 100644
index 00000000000..60fbacd8646
--- /dev/null
+++ b/tests/ui/impl-trait/method/method-resolution.rs
@@ -0,0 +1,26 @@
+//! Since there is only one possible `bar` method, we invoke it and subsequently
+//! constrain `foo`'s RPIT to `u32`.
+
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ check-pass
+
+trait Trait {}
+
+impl Trait for u32 {}
+
+struct Bar<T>(T);
+
+impl Bar<u32> {
+    fn bar(self) {}
+}
+
+fn foo(x: bool) -> Bar<impl Sized> {
+    if x {
+        let x = foo(false);
+        x.bar();
+    }
+    todo!()
+}
+
+fn main() {}