File tree 3 files changed +15
-5
lines changed
3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,17 @@ pub macro cfg_match {
313
313
/// }
314
314
/// }
315
315
/// ```
316
+ ///
317
+ /// If desired, it is possible to return expressions through the use of surrounding braces:
318
+ ///
319
+ /// ```
320
+ /// #![feature(cfg_match)]
321
+ ///
322
+ /// let _some_string = cfg_match! {{
323
+ /// unix => { "With great power comes great electricity bills" }
324
+ /// _ => { "Behind every successful diet is an unwatched pizza" }
325
+ /// }};
326
+ /// ```
316
327
#[ cfg( not( bootstrap) ) ]
317
328
#[ unstable( feature = "cfg_match" , issue = "115585" ) ]
318
329
#[ rustc_diagnostic_item = "cfg_match" ]
Original file line number Diff line number Diff line change 1
1
use crate :: io:: { Read , Write , pipe} ;
2
2
3
3
#[ test]
4
- #[ cfg( all( windows , unix , not( miri) ) ) ]
4
+ #[ cfg( all( any ( unix , windows ) , not( miri) ) ) ]
5
5
fn pipe_creation_clone_and_rw ( ) {
6
6
let ( rx, tx) = pipe ( ) . unwrap ( ) ;
7
7
Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ mod uefi_command_internal {
460
460
helpers:: open_protocol ( self . handle , loaded_image:: PROTOCOL_GUID ) . unwrap ( ) ;
461
461
462
462
let len = args. len ( ) ;
463
- let args_size: u32 = crate :: mem:: size_of_val ( & args ) . try_into ( ) . unwrap ( ) ;
463
+ let args_size: u32 = ( len * crate :: mem:: size_of :: < u16 > ( ) ) . try_into ( ) . unwrap ( ) ;
464
464
let ptr = Box :: into_raw ( args) . as_mut_ptr ( ) ;
465
465
466
466
unsafe {
@@ -706,9 +706,10 @@ mod uefi_command_internal {
706
706
res. push ( QUOTE ) ;
707
707
res. extend ( prog. encode_wide ( ) ) ;
708
708
res. push ( QUOTE ) ;
709
- res. push ( SPACE ) ;
710
709
711
710
for arg in args {
711
+ res. push ( SPACE ) ;
712
+
712
713
// Wrap the argument in quotes to be treat as single arg
713
714
res. push ( QUOTE ) ;
714
715
for c in arg. encode_wide ( ) {
@@ -719,8 +720,6 @@ mod uefi_command_internal {
719
720
res. push ( c) ;
720
721
}
721
722
res. push ( QUOTE ) ;
722
-
723
- res. push ( SPACE ) ;
724
723
}
725
724
726
725
res. into_boxed_slice ( )
You can’t perform that action at this time.
0 commit comments