Fix build on old Rustc

This commit is contained in:
Rafał Harabień 2018-12-20 02:42:49 +01:00
parent 8502edb7b8
commit 131f047c91

View File

@ -3,6 +3,7 @@ use alloc::String;
use core::cell::{Cell, RefCell}; use core::cell::{Cell, RefCell};
use core::char; use core::char;
use core::cmp; use core::cmp;
use core::u32;
use core::fmt::Debug; use core::fmt::Debug;
use core::iter::FromIterator; use core::iter::FromIterator;
use io; use io;
@ -927,7 +928,7 @@ pub fn format_volume<T: ReadWriteSeek>(mut disk: T, options: FormatVolumeOptions
let total_bytes: u64 = disk.seek(SeekFrom::End(0))?; let total_bytes: u64 = disk.seek(SeekFrom::End(0))?;
let total_sectors_64 = total_bytes / u64::from(bytes_per_sector); let total_sectors_64 = total_bytes / u64::from(bytes_per_sector);
disk.seek(SeekFrom::Start(0))?; disk.seek(SeekFrom::Start(0))?;
if total_sectors_64 > u64::from(core::u32::MAX) { if total_sectors_64 > u64::from(u32::MAX) {
return Err(Error::new(ErrorKind::Other, "Volume has too many sectors")); return Err(Error::new(ErrorKind::Other, "Volume has too many sectors"));
} }
total_sectors_64 as u32 total_sectors_64 as u32