diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-05-21 11:39:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-21 11:39:53 +0200 |
| commit | b659266b88de9da759f29f5dcd4e473d84fe1b89 (patch) | |
| tree | 8612528aa39ebd0b366f6f4f4038c9b9a009e4d1 | |
| parent | 85dfd065b1b691a4b2bfb2287c9ec55921c3fd43 (diff) | |
| parent | 6491eb1e6c9fac20faad11e5da16db3185b2410d (diff) | |
| download | rust-b659266b88de9da759f29f5dcd4e473d84fe1b89.tar.gz rust-b659266b88de9da759f29f5dcd4e473d84fe1b89.zip | |
Rollup merge of #97237 - oberien:patch-1, r=Dylan-DPC
Add some more weird-exprs Continuing from https://github.com/rust-lang/rust/pull/86713 (which stalled due to a thinking emoji), I'd like to "improve" the `weird-exprs.rs`-file (as I can't reopen that PR).
| -rw-r--r-- | src/test/ui/weird-exprs.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/test/ui/weird-exprs.rs b/src/test/ui/weird-exprs.rs index 42acd30a0ff..4066bcf3bad 100644 --- a/src/test/ui/weird-exprs.rs +++ b/src/test/ui/weird-exprs.rs @@ -1,11 +1,13 @@ // run-pass #![feature(generators)] +#![feature(unboxed_closures, fn_traits)] #![allow(non_camel_case_types)] #![allow(dead_code)] #![allow(unreachable_code)] #![allow(unused_braces, unused_must_use, unused_parens)] +#![allow(uncommon_codepoints, confusable_idents)] #![recursion_limit = "256"] @@ -115,7 +117,7 @@ fn union() { } fn special_characters() { - let val = !((|(..):(_,_),__@_|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})// + let val = !((|(..):(_,_),(|__@_|__)|__)((&*"\\",'🤔')/**/,{})=={&[..=..][..];})// ; assert!(!val); } @@ -164,6 +166,28 @@ fn monkey_barrel() { assert_eq!(val, ()); } +fn 𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎() { + type 𝚕𝚘𝚘𝚙 = i32; + fn 𝚋𝚛𝚎𝚊𝚔() -> 𝚕𝚘𝚘𝚙 { + let 𝚛𝚎𝚝𝚞𝚛𝚗 = 42; + return 𝚛𝚎𝚝𝚞𝚛𝚗; + } + assert_eq!(loop { + break 𝚋𝚛𝚎𝚊𝚔 (); + }, 42); +} + +fn function() { + struct foo; + impl FnOnce<()> for foo { + type Output = foo; + extern "rust-call" fn call_once(self, _args: ()) -> Self::Output { + foo + } + } + let foo = foo () ()() ()()() ()()()() ()()()()(); +} + fn bathroom_stall() { let mut i = 1; matches!(2, _|_|_|_|_|_ if (i+=1) != (i+=1)); @@ -189,5 +213,7 @@ pub fn main() { i_yield(); match_nested_if(); monkey_barrel(); + 𝚌𝚘𝚗𝚝𝚒𝚗𝚞𝚎(); + function(); bathroom_stall(); } |
