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 gives a compilation error despite the fact that parameter A satisfies the required traits (Array, and A::Item: Copy).
smallvec = { version = "1.7", features = ["const_generics"] }
use smallvec::{Array,SmallVec};traitStrangeWrite{fnexpand(&mutself,bytes:&[u8]);}impl<constN:usize>StrangeWriteforSmallVec<[u8;N]>where[u8;N]:Array,
<[u8;N]asArray>::Item:Copy,{fnexpand(&mutself,bytes:&[u8]){self.extend_from_slice(bytes);}}
error[E0308]: mismatched types
--> src/traits.rs:115:32
|
115 | self.extend_from_slice(bytes);
| ^^^^^ expected associated type, found `u8`
|
= note: expected reference `&[<[u8; N] as smallvec::Array>::Item]`
found reference `&[u8]`
= help: consider constraining the associated type `<[u8; N] as smallvec::Array>::Item` to `u8` or calling a method that returns `<[u8; N] as smallvec::Array>::Item`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
Am I doing something wrong or are there any problems with const generics?
The text was updated successfully, but these errors were encountered:
The following code gives a compilation error despite the fact that parameter A satisfies the required traits (
Array
, andA::Item: Copy
).smallvec = { version = "1.7", features = ["const_generics"] }
Am I doing something wrong or are there any problems with const generics?
The text was updated successfully, but these errors were encountered: