File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,11 @@ macro_rules! vec {
5050 // Using `write_box_via_move` produces a dramatic improvement in stack usage for unoptimized
5151 // programs using this code path to construct large Vecs. We can't use `write_via_move`
5252 // because this entire invocation has to remain a call chain without `let` bindings, or else
53- // inference and temporary lifetimes change and things break (see `vec-macro-rvalue-scope`
54- // and `autoderef-vec-box-fn-36786` tests). This function isn't actually safe but the way we
55- // use it here is. We can't use an unsafe block as that would also wrap `$x`.
53+ // inference and temporary lifetimes change and things break (see `vec-macro-rvalue-scope`,
54+ // `vec-macro-coercions`, and `autoderef-vec-box-fn-36786` tests).
55+ //
56+ // `box_uninit_array_into_vec_unsafe` isn't actually safe but the way we use it here is. We
57+ // can't use an unsafe block as that would also wrap `$x`.
5658 $crate:: boxed:: box_uninit_array_into_vec_unsafe(
5759 $crate:: intrinsics:: write_box_via_move( $crate:: boxed:: Box :: new_uninit( ) , [ $( $x) ,+] )
5860 )
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+
3+ fn main ( ) {
4+ let functions = & vec ! [
5+ |x: i32 | -> i32 { x + 3 } ,
6+ |x: i32 | -> i32 { x + 3 } ,
7+ ] ;
8+
9+ let string = String :: new ( ) ;
10+ let a = vec ! [ & string, "abc" ] ;
11+ let b = vec ! [ "abc" , & string] ;
12+ }
You can’t perform that action at this time.
0 commit comments