/// Lines are overlapping, but the offsets themselves aren't, so they _look_
/// disjunct if you only look at offsets.
Lines are overlapping, but the offsets themselves aren't, so they _look_
disjunct if you only look at offsets.
Lines are overlapping but the offsets themselves aren ' t so they _look_ disjunct if you only look at offsets .
fn multiple_multiline_highlights_overlapping_lines() -> Result<(), MietteError> {
    #[derive(Debug, Diagnostic, Error)]
    #[error("oops!")]
    #[diagnostic(code(oops::my::bad), help("try doing it better next time?"))]
    struct MyBad {
        #[source_code]
        src: NamedSource,
        #[label = "this bit here"]
        highlight1: SourceSpan,
        #[label = "also this bit"]
        highlight2: SourceSpan,
    }
    let src = "source\n  text\n    here".to_string();
    let err = MyBad {
        src: NamedSource::new("bad_file.rs", src),
        highlight1: (0, 8).into(),
        highlight2: (9, 10).into(),
    };
    let out = fmt_report(err.into());
    println!("Error: {}", out);
    assert_eq!("Error [oops::my::bad]: oops!\n\n[bad_file.rs] This is the part that broke:\n\n 1 │ source\n 2 │   text\n   ·   ──┬─\n   ·     ╰── this bit here\n 3 │     here\n\n﹦ try doing it better next time?\n".to_string(), out);
    Ok(())
}
fn multiple_multiline_highlights_overlapping_lines ( ) -> Result < ( ) , MietteError > { # [ derive ( Debug Diagnostic Error ) ] # [ error ( " " ) ] # [ diagnostic ( code ( oops my bad ) help ( " " ) ) ] struct MyBad { # [ source_code ] src : NamedSource , # [ label = " " ] highlight1 : SourceSpan , # [ label = " " ] highlight2 : SourceSpan , } let src = " \n \n " . to_string ( ) ; let err = MyBad { src : NamedSource :: new ( " " , src ) , highlight1 : ( 0 , 8 ) . into ( ) , highlight2 : ( 9 , 10 ) . into ( ) , } ; let out = fmt_report ( err . into ( ) ) ; println ! ( " " out ) ; assert_eq ! ( " \n \n \n \n  2  · ─   t te r  Ok ( ( ) ) }
Lines are overlapping, but the offsets themselves aren't, so they _look_
disjunct if you only look at offsets.
Lines are overlapping but the offsets themselves aren ' t so they _look_ disjunct if you only look at offsets .