Skip to content

Problem compiling Ch. 6's face-detection-tf project #1

Description

@pjkennedy

Cannot compile: practical-machine-learning-w-rust/chapter6/face-detection-tf

$ cargo run
Compiling imageproc v0.18.0
error[E0034]: multiple applicable items in scope
--> /home/px/.cargo/registry/src/github.com-1ecc6299db9ec823/imageproc-0.18.0/src/hog.rs:440:35
|
440 | let intensity = ::clamp(hist[bucket]);
| ^^^^^ multiple clamp found
|
= note: candidate #1 is defined in an impl of the trait Ord for the type u8
note: candidate #2 is defined in the trait Clamp
--> /home/px/.cargo/registry/src/github.com-1ecc6299db9ec823/imageproc-0.18.0/src/definitions.rs:68:5
|
68 | fn clamp(x: T) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
440 | let intensity = ::clamp(hist[bucket]);
| ~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
440 | let intensity = ::clamp(hist[bucket]);
| ~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
--> /home/px/.cargo/registry/src/github.com-1ecc6299db9ec823/imageproc-0.18.0/src/hog.rs:444:35
|
444 | let intensity = ::clamp(hist[bucket]);
| ^^^^^ multiple clamp found
|
= note: candidate #1 is defined in an impl of the trait Ord for the type u8
note: candidate #2 is defined in the trait Clamp
--> /home/px/.cargo/registry/src/github.com-1ecc6299db9ec823/imageproc-0.18.0/src/definitions.rs:68:5
|
68 | fn clamp(x: T) -> Self;
| ^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
|
444 | let intensity = ::clamp(hist[bucket]);
| ~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
|
444 | let intensity = ::clamp(hist[bucket]);
| ~~~~~~~~~~~~~~~

For more information about this error, try rustc --explain E0034.
error: could not compile imageproc due to 2 previous errors

How do I disambiguate per info from E0034? Type u8 is std::u8, so I'm not sure why it's related to a trait issue that needs to be disambiguated. I'm new to Rust, so hoping to get a pointer or help on this. Seems like there's a bug in the code. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions