mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +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:
|
||||
name: Rust tests, build and package nightly release
|
||||
runs-on: [self-hosted, macOS, ARM64]
|
||||
env:
|
||||
LIBRARY_PATH: /opt/homebrew/Cellar/zstd/1.5.6/lib
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
68
Cargo.lock
generated
68
Cargo.lock
generated
|
@ -723,17 +723,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "diff"
|
||||
version = "0.1.13"
|
||||
|
@ -784,12 +773,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d9d8664cf849d7d0f3114a3a387d2f5e4303176d746d5a951aaddc66dfe9240"
|
||||
|
||||
[[package]]
|
||||
name = "doc-comment"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dunce"
|
||||
version = "1.0.4"
|
||||
|
@ -1700,11 +1683,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"ruzstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2516,7 +2497,6 @@ dependencies = [
|
|||
"roc_solve",
|
||||
"roc_target",
|
||||
"roc_types",
|
||||
"snafu",
|
||||
"ven_pretty",
|
||||
]
|
||||
|
||||
|
@ -2536,9 +2516,6 @@ version = "0.0.1"
|
|||
[[package]]
|
||||
name = "roc_error_utils"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"snafu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "roc_exhaustive"
|
||||
|
@ -2824,7 +2801,6 @@ dependencies = [
|
|||
"roc_error_macros",
|
||||
"roc_ident",
|
||||
"roc_region",
|
||||
"snafu",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
|
@ -3356,17 +3332,6 @@ dependencies = [
|
|||
"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]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
|
@ -3599,29 +3564,6 @@ version = "1.11.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "socket2"
|
||||
version = "0.4.9"
|
||||
|
@ -4227,16 +4169,6 @@ version = "0.2.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "typed-arena"
|
||||
version = "2.0.2"
|
||||
|
|
|
@ -137,7 +137,7 @@ maplit = "1.0.2"
|
|||
memmap2 = "0.5.10"
|
||||
mimalloc = { version = "0.1.34", default-features = false }
|
||||
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"
|
||||
page_size = "0.5.0"
|
||||
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"
|
||||
signal-hook = "0.3.15"
|
||||
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
|
||||
strip-ansi-escapes = "0.1.1"
|
||||
strum = { version = "0.24.1", features = ["derive"] }
|
||||
|
|
|
@ -14,7 +14,6 @@ roc_ident = { path = "../ident" }
|
|||
roc_region = { path = "../region" }
|
||||
|
||||
bumpalo.workspace = true
|
||||
snafu.workspace = true
|
||||
static_assertions.workspace = true
|
||||
|
||||
[features]
|
||||
|
|
|
@ -1,30 +1,45 @@
|
|||
use snafu::{Backtrace, Snafu};
|
||||
|
||||
use crate::symbol::IdentId;
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
#[snafu(visibility(pub))]
|
||||
#[derive(Debug)]
|
||||
pub enum ModuleError {
|
||||
#[snafu(display(
|
||||
"ModuleIdNotFound: I could not find the ModuleId {} in Interns.all_ident_ids: {}.",
|
||||
module_id,
|
||||
all_ident_ids
|
||||
))]
|
||||
ModuleIdNotFound {
|
||||
module_id: String,
|
||||
all_ident_ids: String,
|
||||
backtrace: Backtrace,
|
||||
},
|
||||
#[snafu(display(
|
||||
"IdentIdNotFound: I could not find IdentId {:?} in ident_ids {:?}.",
|
||||
ident_id,
|
||||
ident_ids_str
|
||||
))]
|
||||
IdentIdNotFound {
|
||||
ident_id: IdentId,
|
||||
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>;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
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_error_macros::internal_error;
|
||||
use roc_ident::IdentStr;
|
||||
use roc_region::all::Region;
|
||||
use snafu::OptionExt;
|
||||
use std::num::NonZeroU32;
|
||||
use std::{fmt, u32};
|
||||
|
||||
|
@ -324,7 +323,7 @@ pub fn get_module_ident_ids<'a>(
|
|||
) -> ModuleResult<&'a IdentIds> {
|
||||
all_ident_ids
|
||||
.get(module_id)
|
||||
.with_context(|| ModuleIdNotFoundSnafu {
|
||||
.ok_or_else(|| ModuleError::ModuleIdNotFound {
|
||||
module_id: format!("{module_id:?}"),
|
||||
all_ident_ids: format!("{all_ident_ids:?}"),
|
||||
})
|
||||
|
@ -336,9 +335,10 @@ pub fn get_module_ident_ids_mut<'a>(
|
|||
) -> ModuleResult<&'a mut IdentIds> {
|
||||
all_ident_ids
|
||||
.get_mut(module_id)
|
||||
.with_context(|| ModuleIdNotFoundSnafu {
|
||||
.ok_or_else(|| ModuleError::ModuleIdNotFound {
|
||||
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> {
|
||||
self.get_name(ident_id)
|
||||
.with_context(|| IdentIdNotFoundSnafu {
|
||||
.ok_or_else(|| ModuleError::IdentIdNotFound {
|
||||
ident_id,
|
||||
ident_ids_str: format!("{self:?}"),
|
||||
})
|
||||
|
|
|
@ -27,4 +27,3 @@ ven_pretty = { path = "../vendor/pretty" }
|
|||
|
||||
bumpalo.workspace = true
|
||||
pulldown-cmark.workspace = true
|
||||
snafu.workspace = true
|
||||
|
|
|
@ -8,6 +8,5 @@ license.workspace = true
|
|||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
snafu.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -1,39 +1,55 @@
|
|||
//! Provides utility functions used all over the code base.
|
||||
use snafu::{Backtrace, OptionExt, Snafu};
|
||||
use std::{collections::HashMap, slice::SliceIndex};
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
#[snafu(visibility(pub))]
|
||||
#[derive(Debug)]
|
||||
pub enum UtilError {
|
||||
#[snafu(display(
|
||||
"IndexOfFailed: Element {} was not found in collection {}.",
|
||||
elt_str,
|
||||
collection_str
|
||||
))]
|
||||
IndexOfFailed {
|
||||
elt_str: String,
|
||||
collection_str: String,
|
||||
backtrace: Backtrace,
|
||||
},
|
||||
#[snafu(display("KeyNotFound: key {} was not found in HashMap.", key_str,))]
|
||||
KeyNotFound {
|
||||
key_str: String,
|
||||
backtrace: Backtrace,
|
||||
},
|
||||
#[snafu(display(
|
||||
"OutOfBounds: index {} was out of bounds for {} with length {}.",
|
||||
index,
|
||||
collection_name,
|
||||
len
|
||||
))]
|
||||
OutOfBounds {
|
||||
index: usize,
|
||||
collection_name: String,
|
||||
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>;
|
||||
|
||||
// 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>,
|
||||
key: &K,
|
||||
) -> 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:?}"),
|
||||
})?;
|
||||
|
||||
|
@ -52,11 +68,11 @@ pub fn index_of<T: ::std::fmt::Debug + std::cmp::Eq>(elt: T, slice: &[T]) -> Uti
|
|||
let index = slice
|
||||
.iter()
|
||||
.position(|slice_elt| *slice_elt == elt)
|
||||
.with_context(|| {
|
||||
.ok_or_else(|| {
|
||||
let elt_str = format!("{elt:?}");
|
||||
let collection_str = format!("{slice:?}");
|
||||
|
||||
IndexOfFailedSnafu {
|
||||
UtilError::IndexOfFailed {
|
||||
elt_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
|
||||
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,
|
||||
collection_name: "Slice",
|
||||
collection_name: "Slice".to_owned(),
|
||||
len: slice.len(),
|
||||
})?;
|
||||
|
||||
|
@ -82,9 +98,9 @@ pub fn slice_get_mut<T>(
|
|||
) -> UtilResult<&mut <usize as SliceIndex<[T]>>::Output> {
|
||||
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,
|
||||
collection_name: "Slice",
|
||||
collection_name: "Slice".to_owned(),
|
||||
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 collection_str = format!("{slice:?}");
|
||||
|
||||
IndexOfFailedSnafu {
|
||||
Err(UtilError::IndexOfFailed {
|
||||
elt_str,
|
||||
collection_str,
|
||||
}
|
||||
.fail()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,6 @@ which includes the Roc compiler and some helpful utilities.
|
|||
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, ...):
|
||||
|
||||
```sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue