Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "n0-error"
version = "0.1.0"
version = "0.1.1"
edition = "2024"
readme = "README.md"
description = "ergonomic errors with call-site location"
Expand All @@ -11,7 +11,6 @@ keywords = ["error", "location", "ergonomic"]

[dependencies]
anyhow = { version = "1.0.100", optional = true }
derive_more = { version = "2.0.1", features = ["debug", "display"] }
n0-error-macros = { path = "n0-error-macros", version = "0.1.0" }
spez = "0.1.2"

Expand Down
1 change: 0 additions & 1 deletion n0-error-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ keywords = ["error", "location", "ergonomic"]
proc-macro = true

[dependencies]
heck = "0.5"
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }
15 changes: 13 additions & 2 deletions src/meta.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
use std::{fmt, sync::OnceLock};

/// Wrapper around `std::panic::Location` used for display in reports.
#[derive(derive_more::Debug, derive_more::Display, Clone, Copy)]
#[debug("{_0:?}")]
#[derive(Clone, Copy)]
pub struct Location(&'static std::panic::Location<'static>);

impl fmt::Display for Location {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.0, f)
}
}

impl fmt::Debug for Location {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.0, f)
}
}

/// Captured metadata for an error creation site.
///
/// Currently this only contains the call-site [`Location`].
Expand Down
Loading