3 #![feature(generators)]
4 #![feature(unboxed_closures, fn_traits)]
6 #![allow(non_camel_case_types)]
8 #![allow(unreachable_code)]
9 #![allow(unused_braces, unused_must_use, unused_parens)]
10 #![allow(uncommon_codepoints, confusable_idents)]
11 #![allow(unreachable_patterns)]
13 #![recursion_limit = "256"]
18 // Just a grab bag of stuff that you wouldn't want to actually write.
20 fn strange() -> bool { let _x: bool = return true; }
28 fn the(x: &Cell<bool>) {
29 return while !x.get() { x.set(true); };
31 let i = &Cell::new(false);
32 let dont = {||the(i)};
55 if (return) { break; }
61 let mut _y = (_x = 0) == (_x = 0);
62 let mut _z = (_x = 0) < (_x = 0);
63 let _a = (_x += 0) == (_x = 0);
64 let _b = swap(&mut _y, &mut _z) == swap(&mut _y, &mut _z);
67 fn canttouchthis() -> usize {
68 fn p() -> bool { true }
69 let _a = (assert!((true)) == (assert!(p())));
70 let _c = (assert!((p())) == ());
71 let _b: bool = (println!("{}", 0) == (return 0));
77 loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } }
81 fn evil_lincoln() { let _evil = println!("lincoln"); }
84 assert_eq!(String::from(".................................................."),
85 format!("{:?}", .. .. .. .. .. .. .. .. .. .. .. .. ..
86 .. .. .. .. .. .. .. .. .. .. .. ..));
95 pub fn u8<'u8: 'u8 + 'u8>(u8: &'u8 u8) -> &'u8 u8 {
104 let &u8: &u8 = u8::u8(&8u8);
112 assert_eq!(String::from("><>"),
113 String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>());
117 union union<'union> { union: &'union union<'union>, }
120 fn special_characters() {
121 let val = !((|(..):(_,_),(|__@_|__)|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
126 fn punch_card() -> impl std::fmt::Debug {
127 ..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. ..
128 ..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=..
129 ..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. ..
130 ..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. ..
131 ..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. ..
132 ..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. ..
133 ..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. ..
137 let val = match match match match match () {
153 yield yield yield yield yield yield yield yield yield;
157 fn match_nested_if() {
159 () if if if if true {true} else {false} {true} else {false} {true} else {false} => true,
166 let val = ()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=()=();
183 impl FnOnce<()> for foo {
185 extern "rust-call" fn call_once(self, _args: ()) -> Self::Output {
189 let foo = foo () ()() ()()() ()()()() ()()()()();
192 fn bathroom_stall() {
194 matches!(2, _|_|_|_|_|_ if (i+=1) != (i+=1));
198 fn closure_matching() {
200 let (|x| x) = match x(..) {
201 |_| Some(2) => |_| Some(3),
202 |_| _ => unreachable!(),
204 assert!(matches!(x(..), |_| Some(4)));
220 special_characters();