Skip to content

Commit

Permalink
Merge #2046
Browse files Browse the repository at this point in the history
2046: Fix a compilation error (maybe temporary) r=adrien-zinger a=adrien-zinger

It seems that we need to change something quick! The standard library will pass over

```bash
   Compiling massa_consensus v0.1.0 (/home/adrien/Documents/repos/massa/massa-consensus)
warning: an associated function with this name may be added to the standard library in the future
   --> massa-consensus/src/pos.rs:522:37
    |
522 |         let bits_u8_len = n_entries.div_ceil(&u8::BITS) as usize;
    |                                     ^^^^^^^^
    |
    = note: `#[warn(unstable_name_collisions)]` on by default
    = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <rust-lang/rust#48919>
    = help: call with fully qualified syntax `num::Integer::div_ceil(...)` to keep using the current method
    = help: add `#![feature(int_roundings)]` to the crate attributes to enable `core::num::<impl u32>::div_ceil`
```

Opt for the fully qualified syntax

Co-authored-by: Adrien Zinger <zinger.ad@gmail.com>
  • Loading branch information
bors[bot] and adrien-zinger committed Dec 30, 2021
2 parents 785ece3 + c898dc5 commit e3e4e45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions massa-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#![feature(bool_to_option)]
#![feature(hash_drain_filter)]
#![feature(map_first_last)]
#![feature(int_roundings)]

#[macro_use]
extern crate massa_logging;
Expand Down
3 changes: 1 addition & 2 deletions massa-consensus/src/pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use massa_models::{
};
use massa_signature::derive_public_key;
use num::rational::Ratio;
use num::Integer;
use rand::distributions::Uniform;
use rand::Rng;
use rand_xoshiro::rand_core::SeedableRng;
Expand Down Expand Up @@ -519,7 +518,7 @@ impl DeserializeCompact for ThreadCycleState {
"invalid number entries when deserializing ExportThreadCycleStat rng_seed".into(),
));
}
let bits_u8_len = n_entries.div_ceil(&u8::BITS) as usize;
let bits_u8_len = n_entries.div_ceil(u8::BITS) as usize;
if buffer[cursor..].len() < bits_u8_len {
return Err(ModelsError::SerializeError(
"too few remaining bytes when deserializing ExportThreadCycleStat rng_seed".into(),
Expand Down

0 comments on commit e3e4e45

Please sign in to comment.