File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
compiler/rustc_parse/src/parser
tests/ui/ergonomic-clones/closure Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,9 @@ impl<'a> Parser<'a> {
209
209
let check_pub = def == & Defaultness :: Final ;
210
210
let mut def_ = || mem:: replace ( def, Defaultness :: Final ) ;
211
211
212
- let info = if self . eat_keyword_case ( exp ! ( Use ) , case) {
212
+ let info = if !self . look_ahead ( 1 , |t| [ token:: OrOr , token:: Or ] . contains ( & t. kind ) )
213
+ && self . eat_keyword_case ( exp ! ( Use ) , case)
214
+ {
213
215
self . parse_use_item ( ) ?
214
216
} else if self . check_fn_front_matter ( check_pub, case) {
215
217
// FUNCTION ITEM
Original file line number Diff line number Diff line change
1
+ //@ run-pass
2
+
3
+ #![ feature( ergonomic_clones) ]
4
+
5
+ use std:: clone:: UseCloned ;
6
+
7
+ #[ derive( Clone ) ]
8
+ struct Foo ;
9
+
10
+ impl UseCloned for Foo { }
11
+
12
+ fn work ( _: Box < Foo > ) { }
13
+ fn foo < F : FnOnce ( ) > ( _: F ) { }
14
+
15
+ pub fn main ( ) {
16
+ let a = Box :: new ( Foo ) ;
17
+ foo ( use || { foo ( use || { work ( a) } ) } ) ;
18
+ let x = use || { use || { Foo } } ;
19
+ let _y = x ( ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments