RazrFalcon / rustybuzz

A complete harfbuzz's shaping algorithm port to Rust
MIT License
544 stars 34 forks source link

compilation error: "trait `std::iter::Step` is not implemented for `char`" in fallback.rs #24

Closed CodingJonas closed 3 years ago

CodingJonas commented 3 years ago

I noticed this issue when trying to build resvg, which has this as a dependency. After trying to build this project directly, the error persisted:

cargo build                                          
    Updating crates.io index
   Compiling unicode-general-category v0.2.0
   Compiling bitflags v1.2.1
   Compiling smallvec v1.5.1
   Compiling bytemuck v1.4.1
   Compiling unicode-script v0.5.2
   Compiling unicode-ccc v0.1.0
   Compiling unicode-bidi-mirroring v0.1.0
   Compiling ttf-parser v0.9.0
   Compiling rustybuzz v0.3.0 (/home/jonas/tmp/rustybuzz)
error[E0277]: the trait bound `char: std::iter::Step` is not satisfied
   --> src/fallback.rs:450:26
    |
450 |                 for u in '0'..='9' {
    |                          ^^^^^^^^^ the trait `std::iter::Step` is not implemented for `char`
    |
    = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::RangeInclusive<char>`
...

Am I using a wrong version of Rust? What could be the issue? If it is not already known, I can also take a look at the code to see if I can fix it :)

CryZe commented 3 years ago

You seem to be on Rust <1.45 which is where this was added.

CodingJonas commented 3 years ago

Yes, I had Rust 1.43. The one provided by the Ubuntu official repositories. Upgrading by installing through the rustup script fixed it. Thank you!

ferdnyc commented 3 years ago

Hmm. I'm using rust and cargo 1.48.0, and still hitting this.

AARGH! Wait, no, I'm not. Because of rustup, even though Fedora 33 is now at 1.48.0, I still have 1.45.0-nightly from 2020-05-09 installed in my $HOME/.cargo/bin/! :angry:

ferdnyc commented 3 years ago

Yup. After rm-ing all traces of cargo* and rust* from $HOME/.cargo/bin/, compilation with the system cargo/rustc 1.48.0 succeeds.