summaryrefslogtreecommitdiffstats
path: root/src/test/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs
new file mode 100644
index 000000000..6834c392d
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs
@@ -0,0 +1,13 @@
+// run-pass
+#![allow(dead_code)]
+// pretty-expanded FIXME #23616
+
+// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) +
+// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would
+// cause a compilation error. Issue #18772.
+
+fn adder(y: isize) -> Box<dyn Fn(isize) -> isize + 'static> {
+ Box::new(move |x| y + x)
+}
+
+fn main() {}