1 //! Adapted from a `rustc` test, which can be found at
2 //! https://github.com/rust-lang/rust/blob/6d34ec18c7d7e574553f6347ecf08e1e1c45c13d/src/test/run-pass/weird-exprs.rs.
4 //! Reported to rust-analyzer in https://github.com/rust-analyzer/rust-analyzer/issues/290
6 #![allow(non_camel_case_types)]
8 #![allow(unreachable_code)]
9 #![allow(unused_parens)]
11 #![recursion_limit = "128"]
16 // Just a grab bag of stuff that you wouldn't want to actually write.
18 fn strange() -> bool { let _x: bool = return true; }
26 fn the(x: &Cell<bool>) {
27 return while !x.get() { x.set(true); };
29 let i = &Cell::new(false);
30 let dont = {||the(i)};
53 if (return) { break; }
59 let mut _y = (_x = 0) == (_x = 0);
60 let mut _z = (_x = 0) < (_x = 0);
61 let _a = (_x += 0) == (_x = 0);
62 let _b = swap(&mut _y, &mut _z) == swap(&mut _y, &mut _z);
65 fn canttouchthis() -> usize {
66 fn p() -> bool { true }
67 let _a = (assert!((true)) == (assert!(p())));
68 let _c = (assert!((p())) == ());
69 let _b: bool = (println!("{}", 0) == (return 0));
75 loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => panic!("wat") } }
79 fn evil_lincoln() { let _evil = println!("lincoln"); }
82 assert_eq!(String::from(".................................................."),
83 format!("{:?}", .. .. .. .. .. .. .. .. .. .. .. .. ..
84 .. .. .. .. .. .. .. .. .. .. .. ..));
93 pub fn u8<'u8: 'u8 + 'u8>(u8: &'u8 u8) -> &'u8 u8 {
102 let &u8: &u8 = u8::u8(&8u8);
110 assert_eq!(String::from("><>"),
111 String::<>::from::<>("><>").chars::<>().rev::<>().collect::<String>());
115 union union<'union> { union: &'union union<'union>, }
118 fn special_characters() {
119 let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})//
124 fn punch_card() -> impl std::fmt::Debug {
125 ..=..=.. .. .. .. .. .. .. .. .. .. .. ..=.. ..
126 ..=.. ..=.. .. .. .. .. .. .. .. .. ..=..=..=..
127 ..=.. ..=.. ..=.. ..=.. .. ..=..=.. .. ..=.. ..
128 ..=..=.. .. ..=.. ..=.. ..=.. .. .. .. ..=.. ..
129 ..=.. ..=.. ..=.. ..=.. .. ..=.. .. .. ..=.. ..
130 ..=.. ..=.. ..=.. ..=.. .. .. ..=.. .. ..=.. ..
131 ..=.. ..=.. .. ..=..=.. ..=..=.. .. .. ..=.. ..
151 special_characters();