summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/impl-trait/in-trait/sibling-function-constraint.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
new file mode 100644
index 000000000..fe162e6cf
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/sibling-function-constraint.rs
@@ -0,0 +1,21 @@
+// 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() {}