Debian Codegraph @

gcc/testsuite/rust/compile/issue-2105.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 pub enum Option<T> {
5 Some(T),
6 None,
7 }
8
9 pub use Option::{None, Some};
10
11 #[lang = "fn_once"]
12 pub trait FnOnce<Args> {
13 #[lang = "fn_once_output"]
14 type Output;
15
16 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
17 }
18
19 impl<T> Option<T> {
20 pub fn map<R, F: FnOnce(T) -> R>(self, f: F) -> Option<R> {
21 match self {
22 Some(value) => Some(f(value)),
23 None => None,
24 }
25 }
26 }