Fix Wasm compile errors

This commit is contained in:
Brian Carroll 2022-02-14 21:10:45 +00:00
parent e56a5695ba
commit 3e511acbcc
3 changed files with 7 additions and 7 deletions

View file

@ -51,7 +51,7 @@ use crate::work::{Dependencies, Phase};
#[cfg(not(target_family = "wasm"))]
use std::time::{Duration, SystemTime};
#[cfg(target_family = "wasm")]
use wasm_system_time::{Duration, SystemTime};
use crate::wasm_system_time::{Duration, SystemTime};
/// Default name for the binary generated for an app, if an invalid one was specified.
const DEFAULT_APP_OUTPUT_PATH: &str = "app";
@ -650,7 +650,7 @@ impl ModuleTiming {
end_time,
} = self;
let calculate = |t: Result<Duration, std::time::SystemTimeError>| -> Option<Duration> {
let calculate = |t: Result<Duration, _>| -> Option<Duration> {
t.ok()?
.checked_sub(*make_specializations)?
.checked_sub(*find_specializations)?

View file

@ -11,13 +11,13 @@ Instead we use these dummy implementations, which should just disappear at compi
pub struct SystemTime;
impl SystemTime {
fn now() -> Self {
pub fn now() -> Self {
SystemTime
}
fn duration_since(&self, _: SystemTime) -> Result<Duration, String> {
pub fn duration_since(&self, _: SystemTime) -> Result<Duration, String> {
Ok(Duration)
}
fn elapsed(&self) -> Result<Duration, String> {
pub fn elapsed(&self) -> Result<Duration, String> {
Ok(Duration)
}
}
@ -26,7 +26,7 @@ impl SystemTime {
pub struct Duration;
impl Duration {
fn checked_sub(&self, _: Duration) -> Option<Duration> {
pub fn checked_sub(&self, _: Duration) -> Option<Duration> {
Some(Duration)
}
}

View file

@ -1633,7 +1633,7 @@ roc_error_macros::assert_sizeof_all!(FlatType, 3 * 8);
roc_error_macros::assert_sizeof_aarch64!((Variable, Option<Lowercase>), 4 * 8);
roc_error_macros::assert_sizeof_wasm!((Variable, Option<Lowercase>), 4 * 4);
roc_error_macros::assert_sizeof_all!((Variable, Option<Lowercase>), 4 * 8);
roc_error_macros::assert_sizeof_default!((Variable, Option<Lowercase>), 4 * 8);
#[derive(Clone, Debug)]
pub enum Content {