aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-2953-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-2953-1.rs')
-rw-r--r--gcc/testsuite/rust/compile/issue-2953-1.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-2953-1.rs b/gcc/testsuite/rust/compile/issue-2953-1.rs
new file mode 100644
index 0000000..d07059e
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2953-1.rs
@@ -0,0 +1,27 @@
+#[lang = "sized"]
+pub trait Sized {
+ // Empty.
+}
+
+#[lang = "fn_once"]
+pub trait FnOnce<Args> {
+ /// The returned type after the call operator is used.
+ #[lang = "fn_once_output"]
+ type Output;
+
+ /// Performs the call operation.
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+pub enum Ordering {
+ /// An ordering where a compared value is less than another.
+ Less = -1,
+ /// An ordering where a compared value is equal to another.
+ Equal = 0,
+ /// An ordering where a compared value is greater than another.
+ Greater = 1,
+}
+
+pub fn f<F: FnOnce(i32) -> Ordering>(g: F) -> Ordering {
+ g(1)
+}