mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +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,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:?}"),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue