use miette's new panic hook

This commit is contained in:
Kat Marchán 2021-09-21 12:37:16 -07:00
parent 923330aadd
commit 32f39c2fb8
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
6 changed files with 80 additions and 6 deletions

72
Cargo.lock generated
View File

@ -2,6 +2,21 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "addr2line"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.18" version = "0.7.18"
@ -51,6 +66,21 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "backtrace"
version = "0.3.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -68,6 +98,12 @@ dependencies = [
"regex-automata", "regex-automata",
] ]
[[package]]
name = "cc"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -209,6 +245,12 @@ dependencies = [
"wasi", "wasi",
] ]
[[package]]
name = "gimli"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7"
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.0" version = "0.3.0"
@ -297,9 +339,10 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "miette" name = "miette"
version = "3.0.1-alpha.0" version = "3.0.1-alpha.0"
source = "git+https://github.com/zkat/miette?branch=release/3.0.0#338c885a305035fc21f63e3566131af5befa14b3" source = "git+https://github.com/zkat/miette?rev=183ecb9#183ecb9b78a1c22d832e979db5054dcac36d8b7a"
dependencies = [ dependencies = [
"atty", "atty",
"backtrace",
"ci_info", "ci_info",
"itertools", "itertools",
"miette-derive", "miette-derive",
@ -317,13 +360,23 @@ dependencies = [
[[package]] [[package]]
name = "miette-derive" name = "miette-derive"
version = "3.0.0-alpha.0" version = "3.0.0-alpha.0"
source = "git+https://github.com/zkat/miette?branch=release/3.0.0#338c885a305035fc21f63e3566131af5befa14b3" source = "git+https://github.com/zkat/miette?rev=183ecb9#183ecb9b78a1c22d832e979db5054dcac36d8b7a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.7.13" version = "0.7.13"
@ -442,6 +495,15 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "object"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39f37e50073ccad23b6d09bcb5b263f4e76d3bb6038e4a3c08e52162ffa8abc2"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.8.0" version = "1.8.0"
@ -651,6 +713,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"

View File

@ -16,7 +16,8 @@ nu-engine = { path="./crates/nu-engine" }
nu-parser = { path="./crates/nu-parser" } nu-parser = { path="./crates/nu-parser" }
nu-protocol = { path = "./crates/nu-protocol" } nu-protocol = { path = "./crates/nu-protocol" }
nu-table = { path = "./crates/nu-table" } nu-table = { path = "./crates/nu-table" }
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" } miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
# miette = { path = "../miette" }
# mimalloc = { version = "*", default-features = false } # mimalloc = { version = "*", default-features = false }
[dev-dependencies] [dev-dependencies]

View File

@ -7,7 +7,8 @@ edition = "2018"
nu-engine = { path = "../nu-engine" } nu-engine = { path = "../nu-engine" }
nu-parser = { path = "../nu-parser" } nu-parser = { path = "../nu-parser" }
nu-protocol = { path = "../nu-protocol" } nu-protocol = { path = "../nu-protocol" }
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0", features = ["fancy"] } miette = { git = "https://github.com/zkat/miette", rev = "183ecb9", features = ["fancy"] }
# miette = { path = "../../../miette", features = ["fancy"] }
thiserror = "1.0.29" thiserror = "1.0.29"
nu-ansi-term = "0.36.0" nu-ansi-term = "0.36.0"
reedline = { git = "https://github.com/jntrnr/reedline", branch = "main" } reedline = { git = "https://github.com/jntrnr/reedline", branch = "main" }

View File

@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" } miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
# miette = { path = "../../../miette" }
thiserror = "1.0.29" thiserror = "1.0.29"
nu-protocol = { path = "../nu-protocol"} nu-protocol = { path = "../nu-protocol"}

View File

@ -7,4 +7,5 @@ edition = "2018"
[dependencies] [dependencies]
thiserror = "1.0.29" thiserror = "1.0.29"
miette = { git = "https://github.com/zkat/miette", branch = "release/3.0.0" } miette = { git = "https://github.com/zkat/miette", rev = "183ecb9" }
# miette = { path = "../../../miette" }

View File

@ -13,6 +13,8 @@ use reedline::DefaultCompletionActionHandler;
mod tests; mod tests;
fn main() -> Result<()> { fn main() -> Result<()> {
miette::set_panic_hook();
let engine_state = create_default_context(); let engine_state = create_default_context();
if let Some(path) = std::env::args().nth(1) { if let Some(path) = std::env::args().nth(1) {