rustml icon indicating copy to clipboard operation
rustml copied to clipboard

failure to compile, error: the trait bound `Self: std::marker::Sized` is not satisfied

Open zeryx opened this issue 8 years ago • 5 comments

Hey I'm pretty new with rust so this could be a non issue, but I was trying to use this library and test out the example code:

#[macro_use] extern crate rustml;
....
#[test]
fn ml_test () {
        let a = mat![
        1.0f32, 2.0;
        3.0, 4.0;
        5.0, 6.0
    ];
        let b = mat![
        5.0, 7.0;
        6.0, 2.0
    ];
        let c = (a * b).unwrap();
println!("{}", c);
}

But when I tried running my test I got this exception:

   Compiling rustml v0.0.5
/home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297:5: 297:76 error: the trait bound `Self: std::marker::Sized` is not satisfied [E0277]
/home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297     fn grid(images: &Vec<Self>, cols: usize, space: usize) -> Option<Self>;
                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297:5: 297:76 help: run `rustc --explain E0277` to see a detailed explanation
/home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297:5: 297:76 help: consider adding a `where Self: std::marker::Sized` bound
/home/.../.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297:5: 297:76 note: required by `std::vec::Vec`
error: aborting due to previous error
error: Could not compile `rustml`.

zeryx avatar Sep 28 '16 15:09 zeryx

I discovered that the above exception only occured if I was pulling the crate (IE: writing in the Cargo.toml file) with the following:

[dependencies]
rustml = "*"

If I instead pulled it with:

[dependencies.rustml]
git = "https://github.com/daniel-e/rustml/"

it succeeded

zeryx avatar Sep 28 '16 15:09 zeryx

same here

RedRoosterMobile avatar Nov 05 '16 14:11 RedRoosterMobile

Hitting the same issue. I think the repo may need to be bumped to a new version.

cjsMBP15:dbscan cj$ cargo install
  Installing dbscan v0.1.0 (file:///Users/cj/rust_projects/dbscan)
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading rustml v0.0.5
   Compiling rustml v0.0.5
error[E0277]: the trait bound `Self: std::marker::Sized` is not satisfied
  --> /Users/cj/.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/scaling.rs:61:5
   |
61 |     fn scale(&self) -> (Self, Vec<Gaussian<T>>);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Self` does not have a constant size known at compile-time
   |
   = help: the trait `std::marker::Sized` is not implemented for `Self`
   = help: consider adding a `where Self: std::marker::Sized` bound
   = note: only the last element of a tuple may have a dynamically sized type

error[E0277]: the trait bound `Self: std::marker::Sized` is not satisfied
   --> /Users/cj/.cargo/registry/src/github.com-1ecc6299db9ec823/rustml-0.0.5/src/opencv/mod.rs:297:5
    |
297 |     fn grid(images: &Vec<Self>, cols: usize, space: usize) -> Option<Self>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Self` does not have a constant size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `Self`
    = help: consider adding a `where Self: std::marker::Sized` bound
    = note: required by `std::vec::Vec`

error: aborting due to 2 previous errors

error: failed to compile `dbscan v0.1.0 (file:///Users/cj/rust_projects/dbscan)`, intermediate artifacts can be found at `/Users/cj/rust_projects/dbscan/target`

Caused by:
  Could not compile `rustml`.

To learn more, run the command again with --verbose.

Pulling from the master branch gets another issue.

cdesch avatar Oct 18 '17 17:10 cdesch

I have uploaded a new version to crates.io. Does it solve your problem?

daniel-e avatar Jan 31 '18 13:01 daniel-e

I think I solved this problem back in October. I ran into it and then found how to fix. It was working back then.

Same with #4 -- I think that might have been the provided readme.md docs.

cdesch avatar Jan 31 '18 18:01 cdesch