You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code tries to create a TinyVec with a single element, but it fails at the tiny_vec!. (playground)
use tinyvec::{TinyVec, tiny_vec};fnmain(){let a = 1;let _:TinyVec<[u8;4]> = tiny_vec![a];}
Compiling playground v0.0.1 (/playground)
error[E0435]: attempt to use a non-constant value in a constant
--> src/main.rs:5:41
|
5 | let _: TinyVec<[u8; 4]> = tiny_vec![a];
| ^ non-constant value
|
help: consider using `const` instead of `let`
|
4 | const a: /* Type */ = 1;
| ~~~~~ ++++++++++++
For more information about this error, try `rustc --explain E0435`.
error: could not compile `playground` (bin "playground") due to 1 previous error
This does not seem to happen for zero or two elements, or when the type is declared on its left (tiny_vec![ [u8; 4] => a ]).
The text was updated successfully, but these errors were encountered:
We've had occasional problems with this macro before, and unfortunately I think the answer is that it just "is what it is" at this point. If we try to reorder the macro arms then it probably breaks someone.
We should probably document this on the macro at least, even if we can't fix it fully.
The following code tries to create a
TinyVec
with a single element, but it fails at thetiny_vec!
. (playground)This does not seem to happen for zero or two elements, or when the type is declared on its left (
tiny_vec![ [u8; 4] => a ]
).The text was updated successfully, but these errors were encountered: