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
While fixing some project for latest rust nightly (porting to new IO) I got an misleading error because I used a Path in an enum that was used in a vector as function argument.
use std::path::Path;enumSomeEnum{SomeBool(bool),SomePath(Path)}fnsome_function(arg:&mutVec<SomeEnum>){/* some whitespace to demonstrate that the line number is also wrong */}fnmain(){letmut v = Vec::new();some_function(&mut v);}
<anon>:8:1: 17:2 error: the trait `core::marker::Sized` is not implemented for the type `[u8]` [E0277]
<anon>:8 fn some_function(arg: &mut Vec<SomeEnum>) {
<anon>:9 /* some whitespace to demonstrate that the line number is also wrong
<anon>:10
<anon>:11
<anon>:12
<anon>:13
...
<anon>:8:1: 17:2 note: `[u8]` does not have a constant size known at compile-time
<anon>:8 fn some_function(arg: &mut Vec<SomeEnum>) {
<anon>:9 /* some whitespace to demonstrate that the line number is also wrong
<anon>:10
<anon>:11
<anon>:12
<anon>:13
...
error: aborting due to previous error
The error complains about a [u8] but there is no [u8] in the signature. Also the line number of the error message points to the closing bracket of the function but then goes on and prints the first lines of the function.
Error was easily solved by replacing Path with PathBuf once it became clear that Path is the culprit.
While fixing some project for latest rust nightly (porting to new IO) I got an misleading error because I used a
Path
in an enum that was used in a vector as function argument.The error complains about a
[u8]
but there is no[u8]
in the signature. Also the line number of the error message points to the closing bracket of the function but then goes on and prints the first lines of the function.Error was easily solved by replacing Path with PathBuf once it became clear that
Path
is the culprit.http://is.gd/yD8S6w
The text was updated successfully, but these errors were encountered: