diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 6ce3fa3535dc..a602f8e52c9d 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -2019,7 +2019,7 @@ impl HumanEmitter { let offset: isize = offsets .iter() .filter_map( - |(start, v)| if span_start_pos <= *start { None } else { Some(v) }, + |(start, v)| if span_start_pos < *start { None } else { Some(v) }, ) .sum(); let underline_start = (span_start_pos + start) as isize + offset; diff --git a/tests/ui/parser/issues/issue-24375.stderr b/tests/ui/parser/issues/issue-24375.stderr index c05e3a522ed2..25c81d62ebc3 100644 --- a/tests/ui/parser/issues/issue-24375.stderr +++ b/tests/ui/parser/issues/issue-24375.stderr @@ -7,7 +7,7 @@ LL | tmp[0] => {} help: check the value in an arm guard | LL | val if val == tmp[0] => {} - | ~~~ ++++++++++++++++ + | ~~~ ++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = tmp[0]; diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr index 27ad2c3e5be1..0eaa5efd525f 100644 --- a/tests/ui/parser/issues/issue-32505.stderr +++ b/tests/ui/parser/issues/issue-32505.stderr @@ -9,7 +9,7 @@ LL | foo(|_|) help: you might have meant to open the body of the closure | LL | foo(|_| {}) - | ++ + | ++ error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-32505.rs:2:5 diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 18f755fc6b50..29905757bd85 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -58,7 +58,7 @@ LL | x._0 => (), help: check the value in an arm guard | LL | val if val == x._0 => (), - | ~~~ ++++++++++++++ + | ~~~ ++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x._0; @@ -82,7 +82,7 @@ LL | x.0.1 => (), help: check the value in an arm guard | LL | val if val == x.0.1 => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x.0.1; @@ -106,7 +106,7 @@ LL | x.4.y.17.__z => (), help: check the value in an arm guard | LL | val if val == x.4.y.17.__z => (), - | ~~~ ++++++++++++++++++++++ + | ~~~ ++++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x.4.y.17.__z; @@ -130,7 +130,7 @@ LL | x.f() => (), help: check the value in an arm guard | LL | val if val == x.f() => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x.f(); @@ -151,7 +151,7 @@ LL | x._f() => (), help: check the value in an arm guard | LL | val if val == x._f() => (), - | ~~~ ++++++++++++++++ + | ~~~ ++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x._f(); @@ -173,7 +173,7 @@ LL | x? => (), help: check the value in an arm guard | LL | val if val == x? => (), - | ~~~++++++++++++ + | ~~~ ++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x?; @@ -196,7 +196,7 @@ LL | ().f() => (), help: check the value in an arm guard | LL | val if val == ().f() => (), - | ~~~ ++++++++++++++++ + | ~~~ ++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = ().f(); @@ -220,7 +220,7 @@ LL | (0, x)?.f() => (), help: check the value in an arm guard | LL | val if val == (0, x)?.f() => (), - | ~~~ +++++++++++++++++++++ + | ~~~ +++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = (0, x)?.f(); @@ -244,7 +244,7 @@ LL | x.f().g() => (), help: check the value in an arm guard | LL | val if val == x.f().g() => (), - | ~~~ +++++++++++++++++++ + | ~~~ +++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x.f().g(); @@ -268,7 +268,7 @@ LL | 0.f()?.g()?? => (), help: check the value in an arm guard | LL | val if val == 0.f()?.g()?? => (), - | ~~~ ++++++++++++++++++++++ + | ~~~ ++++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = 0.f()?.g()??; @@ -292,7 +292,7 @@ LL | x as usize => (), help: check the value in an arm guard | LL | val if val == x as usize => (), - | ~~~ ++++++++++++++++++++ + | ~~~ ++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x as usize; @@ -313,7 +313,7 @@ LL | 0 as usize => (), help: check the value in an arm guard | LL | val if val == 0 as usize => (), - | ~~~ ++++++++++++++++++++ + | ~~~ ++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = 0 as usize; @@ -335,7 +335,7 @@ LL | x.f().0.4 as f32 => (), help: check the value in an arm guard | LL | val if val == x.f().0.4 as f32 => (), - | ~~~ ++++++++++++++++++++++++++ + | ~~~ ++++++++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = x.f().0.4 as f32; @@ -358,7 +358,7 @@ LL | 1 + 1 => (), help: check the value in an arm guard | LL | val if val == 1 + 1 => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = 1 + 1; @@ -379,7 +379,7 @@ LL | (1 + 2) * 3 => (), help: check the value in an arm guard | LL | val if val == (1 + 2) * 3 => (), - | ~~~ +++++++++++++++++++++ + | ~~~ +++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = (1 + 2) * 3; @@ -418,7 +418,7 @@ LL | u8::MAX.abs() => (), help: check the value in an arm guard | LL | val if val == u8::MAX.abs() => (), - | ~~~ +++++++++++++++++++++++ + | ~~~ +++++++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = u8::MAX.abs(); @@ -439,7 +439,7 @@ LL | z @ w @ v.u() => (), help: check the value in an arm guard | LL | z @ w @ val if val == v.u() => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = v.u(); @@ -463,7 +463,7 @@ LL | y.ilog(3) => (), help: check the value in an arm guard | LL | val if val == y.ilog(3) => (), - | ~~~ +++++++++++++++++++ + | ~~~ +++++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = y.ilog(3); @@ -487,7 +487,7 @@ LL | n + 1 => (), help: check the value in an arm guard | LL | val if val == n + 1 => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = n + 1; @@ -535,7 +535,7 @@ LL | f?() => (), help: check the value in an arm guard | LL | val if val == f?() => (), - | ~~~ ++++++++++++++ + | ~~~ ++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = f?(); diff --git a/tests/ui/parser/recover/recover-pat-ranges.stderr b/tests/ui/parser/recover/recover-pat-ranges.stderr index d285b1e2ed8f..1ce4b5a83772 100644 --- a/tests/ui/parser/recover/recover-pat-ranges.stderr +++ b/tests/ui/parser/recover/recover-pat-ranges.stderr @@ -91,7 +91,7 @@ LL | ..=1 + 2 => (), help: check the value in an arm guard | LL | ..=val if val == 1 + 2 => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = 1 + 2; @@ -163,7 +163,7 @@ LL | (1 + 4)...1 * 2 => (), help: check the value in an arm guard | LL | (1 + 4)...val if val == 1 * 2 => (), - | ~~~ +++++++++++++++ + | ~~~ +++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = 1 * 2; @@ -211,7 +211,7 @@ LL | 0.x()..="y".z() => (), help: check the value in an arm guard | LL | 0.x()..=val if val == "y".z() => (), - | ~~~ +++++++++++++++++ + | ~~~ +++++++++++++++++ help: extract the expression into a `const` and refer to it | LL + const VAL: _ = "y".z();