miette icon indicating copy to clipboard operation
miette copied to clipboard

Possible issue in 5.3.1

Open jakeswenson opened this issue 1 year ago • 3 comments

I just wanted to give a heads up that nushell is seeing an assertion error/panic with the latest version of miette (5.3.1)

nushell/nushell#6541

  × External command failed
   ╭─[entry #1:1:1]
 1 │ asdf
   · thread 'main' panicked at 'assertion failed: line_range.contains(&offset)', /Users/.../.cargo/registry/src/github.com-1ecc6299db9ec823/miette-5.3.1/src/handlers/graphical.rs:622:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: miette::handlers::graphical::GraphicalReportHandler::visual_offset
   4: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   5: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
   6: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
   7: miette::handlers::graphical::GraphicalReportHandler::render_single_line_highlights
   8: miette::handlers::graphical::GraphicalReportHandler::render_context
   9: miette::handlers::graphical::GraphicalReportHandler::render_snippets
  10: miette::handlers::graphical::GraphicalReportHandler::render_report
  11: <nu_protocol::cli_error::CliError as core::fmt::Debug>::fmt

Thanks for the hard work on this awesome library!

jakeswenson avatar Sep 11 '22 17:09 jakeswenson

This looks like it's happening after #97 /cc @Benjamin-L

Thanks for the heads-up. I'm going to yank 5.3.1 so it stops propagating. Sorry for the trouble!

zkat avatar Sep 11 '22 22:09 zkat

Hey, I should have been more specific... I don't actually know if 5.3.1 specifically caused the issue. (I'll leave that up to you to figure out.) Nushell locks against two different versions of miette

I'm guessing my build lock build is against 5.1.1, so the problem could be in any version since then...

So that's not more helpful... someone from nushell can help with a small repro on this to help you out!

jakeswenson avatar Sep 12 '22 00:09 jakeswenson

That assert was added in #202, so pretty sure it's specific to 5.3.1. I'll see I can figure out what's going on here. A small test case would be great, if you have one.

Benjamin-L avatar Sep 12 '22 01:09 Benjamin-L