Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int_roundings feature breaks the num crate #88617

Closed
SkiFire13 opened this issue Sep 3, 2021 · 2 comments
Closed

int_roundings feature breaks the num crate #88617

SkiFire13 opened this issue Sep 3, 2021 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@SkiFire13
Copy link
Contributor

This is due to the new div_ceil method that conflicts with the method with the same name in the num::integer::Integer trait. This matters for example when compiling the num-bigint crate, which now fails with this error:

Error
   Compiling num-bigint v0.4.1
error[E0658]: use of unstable library feature 'int_roundings'
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint.rs:398:45
    |
398 |                 let root_scale = extra_bits.div_ceil(&n64);
    |                                             ^^^^^^^^
    |
    = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581> for more information
    = help: add `#![feature(int_roundings)]` to the crate attributes to enable

error[E0308]: mismatched types
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint.rs:398:54
    |
398 |                 let root_scale = extra_bits.div_ceil(&n64);
    |                                                      ^^^^ expected `u64`, found `&u64`
    |
help: consider removing the borrow
    |
398 -                 let root_scale = extra_bits.div_ceil(&n64);
398 +                 let root_scale = extra_bits.div_ceil(n64);
    |

error[E0658]: use of unstable library feature 'int_roundings'
  --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:70:10
   |
70 |         .div_ceil(&big_digit::BITS.into())
   |          ^^^^^^^^
   |
   = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581> for more information
   = help: add `#![feature(int_roundings)]` to the crate attributes to enable

error[E0308]: mismatched types
  --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:70:19
   |
70 |         .div_ceil(&big_digit::BITS.into())
   |                   ^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found reference
   |
   = note:   expected type `u64`
           found reference `&_`
help: consider removing the borrow
   |
70 -         .div_ceil(&big_digit::BITS.into())
70 +         .div_ceil(big_digit::BITS.into())
   |

error[E0658]: use of unstable library feature 'int_roundings'
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:585:10
    |
585 |         .div_ceil(&u64::from(bits))
    |          ^^^^^^^^
    |
    = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581> for more information
    = help: add `#![feature(int_roundings)]` to the crate attributes to enable

error[E0308]: mismatched types
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:585:19
    |
585 |         .div_ceil(&u64::from(bits))
    |                   ^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
    |
help: consider removing the borrow
    |
585 -         .div_ceil(&u64::from(bits))
585 +         .div_ceil(u64::from(bits))
    |

error[E0658]: use of unstable library feature 'int_roundings'
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:613:10
    |
613 |         .div_ceil(&u64::from(bits))
    |          ^^^^^^^^
    |
    = note: see issue #88581 <https://github.com/rust-lang/rust/issues/88581> for more information
    = help: add `#![feature(int_roundings)]` to the crate attributes to enable

error[E0308]: mismatched types
   --> G:\Programmi\Rust\.cargo\registry\src\github.com-1ecc6299db9ec823\num-bigint-0.4.1\src\biguint\convert.rs:613:19
    |
613 |         .div_ceil(&u64::from(bits))
    |                   ^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
    |
help: consider removing the borrow
    |
613 -         .div_ceil(&u64::from(bits))
613 +         .div_ceil(u64::from(bits))
    |

Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `num-bigint` due to 8 previous errors

rustc --version --verbose:

rustc 1.56.0-nightly (371f3cd3f 2021-09-02)
binary: rustc
commit-hash: 371f3cd3fe523d0b398ed1db1620667c53ba7d02
commit-date: 2021-09-02
host: x86_64-pc-windows-msvc
release: 1.56.0-nightly
LLVM version: 13.0.0
@SkiFire13 SkiFire13 added the C-bug Category: This is a bug. label Sep 3, 2021
@CryZe
Copy link
Contributor

CryZe commented Sep 3, 2021

This is acceptable breakage, see: #88581 (comment)

@cuviper
Copy link
Member

cuviper commented Sep 3, 2021

This was reported as rust-num/num-bigint#218, and fixed in 0.3.3 and 0.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants