mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Remove barely used zstd dependency
This commit is contained in:
parent
a14a110293
commit
e169529ede
10 changed files with 81 additions and 131 deletions
|
@ -14,8 +14,6 @@ jobs:
|
||||||
test-and-build:
|
test-and-build:
|
||||||
name: Rust tests, build and package nightly release
|
name: Rust tests, build and package nightly release
|
||||||
runs-on: [self-hosted, macOS, ARM64]
|
runs-on: [self-hosted, macOS, ARM64]
|
||||||
env:
|
|
||||||
LIBRARY_PATH: /opt/homebrew/Cellar/zstd/1.5.6/lib
|
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
68
Cargo.lock
generated
68
Cargo.lock
generated
|
@ -723,17 +723,6 @@ dependencies = [
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "derive_more"
|
|
||||||
version = "0.99.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diff"
|
name = "diff"
|
||||||
version = "0.1.13"
|
version = "0.1.13"
|
||||||
|
@ -784,12 +773,6 @@ version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d9d8664cf849d7d0f3114a3a387d2f5e4303176d746d5a951aaddc66dfe9240"
|
checksum = "6d9d8664cf849d7d0f3114a3a387d2f5e4303176d746d5a951aaddc66dfe9240"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "doc-comment"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dunce"
|
name = "dunce"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
|
@ -1700,11 +1683,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"flate2",
|
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"memchr",
|
"memchr",
|
||||||
"ruzstd",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2516,7 +2497,6 @@ dependencies = [
|
||||||
"roc_solve",
|
"roc_solve",
|
||||||
"roc_target",
|
"roc_target",
|
||||||
"roc_types",
|
"roc_types",
|
||||||
"snafu",
|
|
||||||
"ven_pretty",
|
"ven_pretty",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2536,9 +2516,6 @@ version = "0.0.1"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "roc_error_utils"
|
name = "roc_error_utils"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
|
||||||
"snafu",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "roc_exhaustive"
|
name = "roc_exhaustive"
|
||||||
|
@ -2824,7 +2801,6 @@ dependencies = [
|
||||||
"roc_error_macros",
|
"roc_error_macros",
|
||||||
"roc_ident",
|
"roc_ident",
|
||||||
"roc_region",
|
"roc_region",
|
||||||
"snafu",
|
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3356,17 +3332,6 @@ dependencies = [
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ruzstd"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"derive_more",
|
|
||||||
"twox-hash",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
|
@ -3599,29 +3564,6 @@ version = "1.11.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
|
checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "snafu"
|
|
||||||
version = "0.7.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6"
|
|
||||||
dependencies = [
|
|
||||||
"backtrace",
|
|
||||||
"doc-comment",
|
|
||||||
"snafu-derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "snafu-derive"
|
|
||||||
version = "0.7.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf"
|
|
||||||
dependencies = [
|
|
||||||
"heck",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "socket2"
|
name = "socket2"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
|
@ -4227,16 +4169,6 @@ version = "0.2.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
|
checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "twox-hash"
|
|
||||||
version = "1.6.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"static_assertions",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-arena"
|
name = "typed-arena"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
|
|
|
@ -137,7 +137,7 @@ maplit = "1.0.2"
|
||||||
memmap2 = "0.5.10"
|
memmap2 = "0.5.10"
|
||||||
mimalloc = { version = "0.1.34", default-features = false }
|
mimalloc = { version = "0.1.34", default-features = false }
|
||||||
nonempty = "0.8.1"
|
nonempty = "0.8.1"
|
||||||
object = { version = "0.32.2", features = ["read", "write"] }
|
object = { version = "0.32.2", default-features = false, features = ["read", "write"] }
|
||||||
packed_struct = "0.10.1"
|
packed_struct = "0.10.1"
|
||||||
page_size = "0.5.0"
|
page_size = "0.5.0"
|
||||||
palette = "0.6.1"
|
palette = "0.6.1"
|
||||||
|
@ -171,7 +171,6 @@ serde_json = "1.0.94" # update roc_std/Cargo.toml on change
|
||||||
serial_test = "1.0.0"
|
serial_test = "1.0.0"
|
||||||
signal-hook = "0.3.15"
|
signal-hook = "0.3.15"
|
||||||
smallvec = { version = "1.10.0", features = ["const_generics", "const_new"] }
|
smallvec = { version = "1.10.0", features = ["const_generics", "const_new"] }
|
||||||
snafu = { version = "0.7.4", features = ["backtraces"] }
|
|
||||||
static_assertions = "1.1.0" # update roc_std/Cargo.toml on change
|
static_assertions = "1.1.0" # update roc_std/Cargo.toml on change
|
||||||
strip-ansi-escapes = "0.1.1"
|
strip-ansi-escapes = "0.1.1"
|
||||||
strum = { version = "0.24.1", features = ["derive"] }
|
strum = { version = "0.24.1", features = ["derive"] }
|
||||||
|
|
|
@ -14,7 +14,6 @@ roc_ident = { path = "../ident" }
|
||||||
roc_region = { path = "../region" }
|
roc_region = { path = "../region" }
|
||||||
|
|
||||||
bumpalo.workspace = true
|
bumpalo.workspace = true
|
||||||
snafu.workspace = true
|
|
||||||
static_assertions.workspace = true
|
static_assertions.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -1,30 +1,45 @@
|
||||||
use snafu::{Backtrace, Snafu};
|
|
||||||
|
|
||||||
use crate::symbol::IdentId;
|
use crate::symbol::IdentId;
|
||||||
|
|
||||||
#[derive(Debug, Snafu)]
|
#[derive(Debug)]
|
||||||
#[snafu(visibility(pub))]
|
|
||||||
pub enum ModuleError {
|
pub enum ModuleError {
|
||||||
#[snafu(display(
|
|
||||||
"ModuleIdNotFound: I could not find the ModuleId {} in Interns.all_ident_ids: {}.",
|
|
||||||
module_id,
|
|
||||||
all_ident_ids
|
|
||||||
))]
|
|
||||||
ModuleIdNotFound {
|
ModuleIdNotFound {
|
||||||
module_id: String,
|
module_id: String,
|
||||||
all_ident_ids: String,
|
all_ident_ids: String,
|
||||||
backtrace: Backtrace,
|
|
||||||
},
|
},
|
||||||
#[snafu(display(
|
|
||||||
"IdentIdNotFound: I could not find IdentId {:?} in ident_ids {:?}.",
|
|
||||||
ident_id,
|
|
||||||
ident_ids_str
|
|
||||||
))]
|
|
||||||
IdentIdNotFound {
|
IdentIdNotFound {
|
||||||
ident_id: IdentId,
|
ident_id: IdentId,
|
||||||
ident_ids_str: String,
|
ident_ids_str: String,
|
||||||
backtrace: Backtrace,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for ModuleError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::ModuleIdNotFound {
|
||||||
|
module_id,
|
||||||
|
all_ident_ids,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"ModuleIdNotFound: I could not find the ModuleId {} in Interns.all_ident_ids: {}.",
|
||||||
|
module_id,
|
||||||
|
all_ident_ids
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Self::IdentIdNotFound {
|
||||||
|
ident_id,
|
||||||
|
ident_ids_str,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"IdentIdNotFound: I could not find IdentId {:?} in ident_ids {:?}.",
|
||||||
|
ident_id, ident_ids_str
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for ModuleError {}
|
||||||
|
|
||||||
pub type ModuleResult<T, E = ModuleError> = std::result::Result<T, E>;
|
pub type ModuleResult<T, E = ModuleError> = std::result::Result<T, E>;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use crate::ident::{Ident, Lowercase, ModuleName};
|
use crate::ident::{Ident, Lowercase, ModuleName};
|
||||||
use crate::module_err::{IdentIdNotFoundSnafu, ModuleIdNotFoundSnafu, ModuleResult};
|
use crate::module_err::{ModuleError, ModuleResult};
|
||||||
use roc_collections::{SmallStringInterner, VecMap};
|
use roc_collections::{SmallStringInterner, VecMap};
|
||||||
use roc_error_macros::internal_error;
|
use roc_error_macros::internal_error;
|
||||||
use roc_ident::IdentStr;
|
use roc_ident::IdentStr;
|
||||||
use roc_region::all::Region;
|
use roc_region::all::Region;
|
||||||
use snafu::OptionExt;
|
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
use std::{fmt, u32};
|
use std::{fmt, u32};
|
||||||
|
|
||||||
|
@ -324,7 +323,7 @@ pub fn get_module_ident_ids<'a>(
|
||||||
) -> ModuleResult<&'a IdentIds> {
|
) -> ModuleResult<&'a IdentIds> {
|
||||||
all_ident_ids
|
all_ident_ids
|
||||||
.get(module_id)
|
.get(module_id)
|
||||||
.with_context(|| ModuleIdNotFoundSnafu {
|
.ok_or_else(|| ModuleError::ModuleIdNotFound {
|
||||||
module_id: format!("{module_id:?}"),
|
module_id: format!("{module_id:?}"),
|
||||||
all_ident_ids: format!("{all_ident_ids:?}"),
|
all_ident_ids: format!("{all_ident_ids:?}"),
|
||||||
})
|
})
|
||||||
|
@ -336,9 +335,10 @@ pub fn get_module_ident_ids_mut<'a>(
|
||||||
) -> ModuleResult<&'a mut IdentIds> {
|
) -> ModuleResult<&'a mut IdentIds> {
|
||||||
all_ident_ids
|
all_ident_ids
|
||||||
.get_mut(module_id)
|
.get_mut(module_id)
|
||||||
.with_context(|| ModuleIdNotFoundSnafu {
|
.ok_or_else(|| ModuleError::ModuleIdNotFound {
|
||||||
module_id: format!("{module_id:?}"),
|
module_id: format!("{module_id:?}"),
|
||||||
all_ident_ids: "I could not return all_ident_ids here because of borrowing issues.",
|
all_ident_ids: "I could not return all_ident_ids here because of borrowing issues."
|
||||||
|
.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ impl IdentIds {
|
||||||
|
|
||||||
pub fn get_name_str_res(&self, ident_id: IdentId) -> ModuleResult<&str> {
|
pub fn get_name_str_res(&self, ident_id: IdentId) -> ModuleResult<&str> {
|
||||||
self.get_name(ident_id)
|
self.get_name(ident_id)
|
||||||
.with_context(|| IdentIdNotFoundSnafu {
|
.ok_or_else(|| ModuleError::IdentIdNotFound {
|
||||||
ident_id,
|
ident_id,
|
||||||
ident_ids_str: format!("{self:?}"),
|
ident_ids_str: format!("{self:?}"),
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,4 +27,3 @@ ven_pretty = { path = "../vendor/pretty" }
|
||||||
|
|
||||||
bumpalo.workspace = true
|
bumpalo.workspace = true
|
||||||
pulldown-cmark.workspace = true
|
pulldown-cmark.workspace = true
|
||||||
snafu.workspace = true
|
|
||||||
|
|
|
@ -8,6 +8,5 @@ license.workspace = true
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
snafu.workspace = true
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -1,39 +1,55 @@
|
||||||
//! Provides utility functions used all over the code base.
|
//! Provides utility functions used all over the code base.
|
||||||
use snafu::{Backtrace, OptionExt, Snafu};
|
|
||||||
use std::{collections::HashMap, slice::SliceIndex};
|
use std::{collections::HashMap, slice::SliceIndex};
|
||||||
|
|
||||||
#[derive(Debug, Snafu)]
|
#[derive(Debug)]
|
||||||
#[snafu(visibility(pub))]
|
|
||||||
pub enum UtilError {
|
pub enum UtilError {
|
||||||
#[snafu(display(
|
|
||||||
"IndexOfFailed: Element {} was not found in collection {}.",
|
|
||||||
elt_str,
|
|
||||||
collection_str
|
|
||||||
))]
|
|
||||||
IndexOfFailed {
|
IndexOfFailed {
|
||||||
elt_str: String,
|
elt_str: String,
|
||||||
collection_str: String,
|
collection_str: String,
|
||||||
backtrace: Backtrace,
|
|
||||||
},
|
},
|
||||||
#[snafu(display("KeyNotFound: key {} was not found in HashMap.", key_str,))]
|
|
||||||
KeyNotFound {
|
KeyNotFound {
|
||||||
key_str: String,
|
key_str: String,
|
||||||
backtrace: Backtrace,
|
|
||||||
},
|
},
|
||||||
#[snafu(display(
|
|
||||||
"OutOfBounds: index {} was out of bounds for {} with length {}.",
|
|
||||||
index,
|
|
||||||
collection_name,
|
|
||||||
len
|
|
||||||
))]
|
|
||||||
OutOfBounds {
|
OutOfBounds {
|
||||||
index: usize,
|
index: usize,
|
||||||
collection_name: String,
|
collection_name: String,
|
||||||
len: usize,
|
len: usize,
|
||||||
backtrace: Backtrace,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for UtilError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
Self::IndexOfFailed {
|
||||||
|
elt_str,
|
||||||
|
collection_str,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"IndexOfFailed: Element {} was not found in collection {}.",
|
||||||
|
elt_str, collection_str
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Self::KeyNotFound { key_str } => {
|
||||||
|
write!(f, "KeyNotFound: key {} was not found in HashMap.", key_str)
|
||||||
|
}
|
||||||
|
Self::OutOfBounds {
|
||||||
|
index,
|
||||||
|
collection_name,
|
||||||
|
len,
|
||||||
|
} => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"OutOfBounds: index {} was out of bounds for {} with length {}.",
|
||||||
|
index, collection_name, len
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for UtilError {}
|
||||||
|
|
||||||
pub type UtilResult<T, E = UtilError> = std::result::Result<T, E>;
|
pub type UtilResult<T, E = UtilError> = std::result::Result<T, E>;
|
||||||
|
|
||||||
// replace HashMap method that returns Option with one that returns Result and proper Error
|
// replace HashMap method that returns Option with one that returns Result and proper Error
|
||||||
|
@ -41,7 +57,7 @@ pub fn map_get<'a, K: ::std::fmt::Debug + std::hash::Hash + std::cmp::Eq, V>(
|
||||||
hash_map: &'a HashMap<K, V>,
|
hash_map: &'a HashMap<K, V>,
|
||||||
key: &K,
|
key: &K,
|
||||||
) -> UtilResult<&'a V> {
|
) -> UtilResult<&'a V> {
|
||||||
let value = hash_map.get(key).context(KeyNotFoundSnafu {
|
let value = hash_map.get(key).ok_or_else(|| UtilError::KeyNotFound {
|
||||||
key_str: format!("{key:?}"),
|
key_str: format!("{key:?}"),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -52,11 +68,11 @@ pub fn index_of<T: ::std::fmt::Debug + std::cmp::Eq>(elt: T, slice: &[T]) -> Uti
|
||||||
let index = slice
|
let index = slice
|
||||||
.iter()
|
.iter()
|
||||||
.position(|slice_elt| *slice_elt == elt)
|
.position(|slice_elt| *slice_elt == elt)
|
||||||
.with_context(|| {
|
.ok_or_else(|| {
|
||||||
let elt_str = format!("{elt:?}");
|
let elt_str = format!("{elt:?}");
|
||||||
let collection_str = format!("{slice:?}");
|
let collection_str = format!("{slice:?}");
|
||||||
|
|
||||||
IndexOfFailedSnafu {
|
UtilError::IndexOfFailed {
|
||||||
elt_str,
|
elt_str,
|
||||||
collection_str,
|
collection_str,
|
||||||
}
|
}
|
||||||
|
@ -67,9 +83,9 @@ pub fn index_of<T: ::std::fmt::Debug + std::cmp::Eq>(elt: T, slice: &[T]) -> Uti
|
||||||
|
|
||||||
// replaces slice method that return Option with one that return Result and proper Error
|
// replaces slice method that return Option with one that return Result and proper Error
|
||||||
pub fn slice_get<T>(index: usize, slice: &[T]) -> UtilResult<&<usize as SliceIndex<[T]>>::Output> {
|
pub fn slice_get<T>(index: usize, slice: &[T]) -> UtilResult<&<usize as SliceIndex<[T]>>::Output> {
|
||||||
let elt_ref = slice.get(index).context(OutOfBoundsSnafu {
|
let elt_ref = slice.get(index).ok_or_else(|| UtilError::OutOfBounds {
|
||||||
index,
|
index,
|
||||||
collection_name: "Slice",
|
collection_name: "Slice".to_owned(),
|
||||||
len: slice.len(),
|
len: slice.len(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -82,9 +98,9 @@ pub fn slice_get_mut<T>(
|
||||||
) -> UtilResult<&mut <usize as SliceIndex<[T]>>::Output> {
|
) -> UtilResult<&mut <usize as SliceIndex<[T]>>::Output> {
|
||||||
let slice_len = slice.len();
|
let slice_len = slice.len();
|
||||||
|
|
||||||
let elt_ref = slice.get_mut(index).context(OutOfBoundsSnafu {
|
let elt_ref = slice.get_mut(index).ok_or_else(|| UtilError::OutOfBounds {
|
||||||
index,
|
index,
|
||||||
collection_name: "Slice",
|
collection_name: "Slice".to_owned(),
|
||||||
len: slice_len,
|
len: slice_len,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -118,10 +134,9 @@ pub fn first_last_index_of<T: ::std::fmt::Debug + std::cmp::Eq>(
|
||||||
let elt_str = format!("{elt:?}");
|
let elt_str = format!("{elt:?}");
|
||||||
let collection_str = format!("{slice:?}");
|
let collection_str = format!("{slice:?}");
|
||||||
|
|
||||||
IndexOfFailedSnafu {
|
Err(UtilError::IndexOfFailed {
|
||||||
elt_str,
|
elt_str,
|
||||||
collection_str,
|
collection_str,
|
||||||
}
|
})
|
||||||
.fail()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,6 @@ which includes the Roc compiler and some helpful utilities.
|
||||||
cd roc_night<TAB TO AUTOCOMPLETE>
|
cd roc_night<TAB TO AUTOCOMPLETE>
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Install required dependencies:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew install z3 zstd
|
|
||||||
```
|
|
||||||
|
|
||||||
1. To be able to run the `roc` command anywhere on your system; add the line below to your shell startup script (.profile, .zshrc, ...):
|
1. To be able to run the `roc` command anywhere on your system; add the line below to your shell startup script (.profile, .zshrc, ...):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue