File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ macro_rules! smallvec {
145
145
$crate:: SmallVec :: from_elem( $elem, $n)
146
146
} ) ;
147
147
( $( $x: expr) ,* $( , ) * ) => ( {
148
- let count = 0usize $( + smallvec!( @one $x) ) * ;
148
+ let count = 0usize $( + $crate :: smallvec!( @one $x) ) * ;
149
149
let mut vec = $crate:: SmallVec :: new( ) ;
150
150
if count <= vec. inline_size( ) {
151
151
$( vec. push( $x) ; ) *
Original file line number Diff line number Diff line change
1
+ /// This file tests `smallvec!` without actually having the macro in scope.
2
+ /// This forces any recursion to use a `$crate` prefix to reliably find itself.
3
+
4
+ #[ test]
5
+ fn smallvec ( ) {
6
+ let mut vec: smallvec:: SmallVec < [ i32 ; 2 ] > ;
7
+
8
+ macro_rules! check {
9
+ ( $init: tt) => {
10
+ vec = smallvec:: smallvec! $init;
11
+ assert_eq!( * vec, * vec! $init) ;
12
+ }
13
+ }
14
+
15
+ check ! ( [ 0 ; 0 ] ) ;
16
+ check ! ( [ 1 ; 1 ] ) ;
17
+ check ! ( [ 2 ; 2 ] ) ;
18
+ check ! ( [ 3 ; 3 ] ) ;
19
+
20
+ check ! ( [ ] ) ;
21
+ check ! ( [ 1 ] ) ;
22
+ check ! ( [ 1 , 2 ] ) ;
23
+ check ! ( [ 1 , 2 , 3 ] ) ;
24
+ }
25
+
You can’t perform that action at this time.
0 commit comments