File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 140140#![ feature( type_alias_impl_trait) ]
141141#![ feature( associated_type_bounds) ]
142142#![ feature( slice_group_by) ]
143+ #![ feature( decl_macro) ]
143144// Allow testing this library
144145
145146#[ cfg( test) ]
@@ -193,4 +194,11 @@ mod std {
193194#[ unstable( feature = "liballoc_internals" , issue = "none" , reason = "implementation detail" ) ]
194195pub mod __export {
195196 pub use core:: format_args;
197+
198+ /// Force AST node to an expression to improve diagnostics in pattern position.
199+ #[ rustc_macro_transparency = "semitransparent" ]
200+ #[ unstable( feature = "liballoc_internals" , issue = "none" , reason = "implementation detail" ) ]
201+ pub macro force_expr( $e: expr) {
202+ $e
203+ }
196204}
Original file line number Diff line number Diff line change 3737#[ cfg( not( test) ) ]
3838#[ macro_export]
3939#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40- #[ allow_internal_unstable( box_syntax) ]
40+ #[ allow_internal_unstable( box_syntax, liballoc_internals ) ]
4141macro_rules! vec {
4242 ( ) => (
43- $crate:: vec:: Vec :: new( )
43+ $crate:: __export :: force_expr! ( $crate :: vec:: Vec :: new( ) )
4444 ) ;
4545 ( $elem: expr; $n: expr) => (
46- $crate:: vec:: from_elem( $elem, $n)
46+ $crate:: __export :: force_expr! ( $crate :: vec:: from_elem( $elem, $n) )
4747 ) ;
4848 ( $( $x: expr) ,+ $( , ) ?) => (
49- <[ _] >:: into_vec( box [ $( $x) ,+] )
49+ $crate :: __export :: force_expr! ( <[ _] >:: into_vec( box [ $( $x) ,+] ) )
5050 ) ;
5151}
5252
You can’t perform that action at this time.
0 commit comments