Skip to content

Commit

Permalink
chore(deps): update dependencies
Browse files Browse the repository at this point in the history
Most notably the update to `miette` v6.0 and some deprecations in the
latest `winnow` release.
  • Loading branch information
dnaka91 committed Feb 4, 2024
1 parent dbeec5b commit 3f06c9e
Show file tree
Hide file tree
Showing 62 changed files with 142 additions and 157 deletions.
112 changes: 42 additions & 70 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ clap = { version = "4.4.18", features = ["derive", "wrap_help"] }
glob = "0.3.1"
indoc = "2.0.4"
insta = { version = "1.34.0", features = ["glob"] }
miette = "5.10.0"
miette = { version = "6.0.1", default-features = false }
mimalloc = "0.1.39"
proc-macro2 = { version = "1.0.78", default-features = false }
quote = { version = "1.0.35", default-features = false }
Expand Down
30 changes: 24 additions & 6 deletions crates/mabo-compiler/src/resolve/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::highlight;
/// Reason why type resolution failed.
#[derive(Debug)]
pub struct Error {
pub(super) source_code: NamedSource,
pub(super) source_code: NamedSource<String>,
/// Cause of the failure.
pub cause: ResolveError,
}
Expand Down Expand Up @@ -65,17 +65,29 @@ pub enum ResolveError {
/// Local type resolution failed.
#[error("failed resolving type in local modules")]
#[diagnostic(transparent)]
Local(#[from] ResolveLocal),
Local(#[from] Box<ResolveLocal>),
/// Import statement resolution failed.
#[error("failed resolving import statement")]
#[diagnostic(transparent)]
Import(#[from] ResolveImport),
Import(#[from] Box<ResolveImport>),
/// Remote (types in another schema) type resolution failed.
#[error("failed resolving type in remote modules")]
#[diagnostic(transparent)]
Remote(#[from] Box<ResolveRemote>),
}

impl From<ResolveLocal> for ResolveError {
fn from(value: ResolveLocal) -> Self {
Self::Local(value.into())
}
}

impl From<ResolveImport> for ResolveError {
fn from(value: ResolveImport) -> Self {
Self::Import(value.into())
}
}

impl From<ResolveRemote> for ResolveError {
fn from(value: ResolveRemote) -> Self {
Self::Remote(value.into())
Expand Down Expand Up @@ -220,7 +232,13 @@ pub enum ResolveRemote {
/// The referenced definition can't be used as type.
#[error(transparent)]
#[diagnostic(transparent)]
InvalidKind(#[from] RemoteInvalidKind),
InvalidKind(#[from] Box<RemoteInvalidKind>),
}

impl From<RemoteInvalidKind> for ResolveRemote {
fn from(value: RemoteInvalidKind) -> Self {
Self::InvalidKind(value.into())
}
}

/// None of the existing imports match for the referenced type.
Expand Down Expand Up @@ -261,7 +279,7 @@ pub struct RemoteGenericsCountDeclaration {
/// Amount of generics on the declaration side.
pub amount: usize,
#[source_code]
pub(super) source_code: NamedSource,
pub(super) source_code: NamedSource<String>,
#[label("declared here")]
pub(super) used: Range<usize>,
}
Expand Down Expand Up @@ -294,7 +312,7 @@ pub struct RemoteInvalidKindDeclaration {
/// The kind of definition that is declared.
pub kind: &'static str,
#[source_code]
pub(super) source_code: NamedSource,
pub(super) source_code: NamedSource<String>,
#[label("declared here")]
pub(super) used: Range<usize>,
}
2 changes: 1 addition & 1 deletion crates/mabo-compiler/src/resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn schemas(values: &[(&str, &Schema<'_>)]) -> Result<(), Error> {
.map_or_else(|| "<unknown>".to_owned(), |p| p.display().to_string()),
schema.source.to_owned(),
),
cause: ResolveError::Import(e),
cause: ResolveError::Import(e.into()),
})?;

for ty in missing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ input_file: crates/mabo-compiler/tests/inputs/resolve/import_root.mabo
× type resolution failed
├─▶ failed resolving import statement
╰─▶ definitionYOtherYnot found in moduleYdatetimeY
╭─[import_root.mabo:1:1]
╭─[resolve/import_root.mabo:1:15]
1use datetime::Other;
· ──┬──
· ╰── used here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ input_file: crates/mabo-compiler/tests/inputs/resolve/import_sub.mabo
× type resolution failed
├─▶ failed resolving import statement
╰─▶ moduleYotherYnot found
╭─[import_sub.mabo:1:1]
╭─[resolve/import_sub.mabo:1:15]
1use datetime::other;
· ──┬──
· ╰── used here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ input_file: crates/mabo-compiler/tests/inputs/resolve/import_sub_type.mabo
× type resolution failed
├─▶ failed resolving import statement
╰─▶ definitionYOtherYnot found in moduleYdatetime::timingY
╭─[import_sub_type.mabo:1:1]
╭─[resolve/import_sub_type.mabo:1:23]
1use datetime::timing::Other;
· ──┬──
· ╰── used here
Expand Down
Loading

0 comments on commit 3f06c9e

Please sign in to comment.