From 5706be1854db74d0aafcc4658423884689f139e9 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Thu, 3 Aug 2023 21:43:17 +0200 Subject: Improve spans for indexing expressions Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR. --- tests/ui/array-slice-vec/slice-2.stderr | 16 +++++------ .../borrowck/suggest-local-var-for-vector.stderr | 10 +++---- .../suggest-storing-local-var-for-vector.stderr | 10 +++---- .../borrowck/two-phase-nonrecv-autoref.base.stderr | 28 +++++++++---------- tests/ui/consts/issue-94675.stderr | 4 +-- tests/ui/error-codes/E0608.stderr | 4 +-- tests/ui/index-bot.rs | 3 -- tests/ui/index-bot.stderr | 9 ------ tests/ui/index-help.rs | 4 --- tests/ui/index-help.stderr | 13 --------- tests/ui/index_message.rs | 4 --- tests/ui/index_message.stderr | 9 ------ tests/ui/indexing-requires-a-uint.rs | 14 ---------- tests/ui/indexing-requires-a-uint.stderr | 32 ---------------------- tests/ui/indexing/index-bot.rs | 3 ++ tests/ui/indexing/index-bot.stderr | 9 ++++++ tests/ui/indexing/index-help.rs | 4 +++ tests/ui/indexing/index-help.stderr | 13 +++++++++ tests/ui/indexing/index_message.rs | 4 +++ tests/ui/indexing/index_message.stderr | 9 ++++++ tests/ui/indexing/indexing-requires-a-uint.rs | 14 ++++++++++ tests/ui/indexing/indexing-requires-a-uint.stderr | 32 ++++++++++++++++++++++ .../ui/indexing/indexing-spans-caller-location.rs | 27 ++++++++++++++++++ .../const-eval-select-backtrace-std.run.stderr | 2 +- tests/ui/issues/issue-27842.stderr | 12 ++++---- tests/ui/issues/issue-40861.stderr | 4 +-- tests/ui/lint/lint-unconditional-recursion.stderr | 2 +- tests/ui/span/suggestion-non-ascii.stderr | 4 +-- .../issue-112252-ptr-arithmetics-help.stderr | 4 +-- 29 files changed, 165 insertions(+), 138 deletions(-) delete mode 100644 tests/ui/index-bot.rs delete mode 100644 tests/ui/index-bot.stderr delete mode 100644 tests/ui/index-help.rs delete mode 100644 tests/ui/index-help.stderr delete mode 100644 tests/ui/index_message.rs delete mode 100644 tests/ui/index_message.stderr delete mode 100644 tests/ui/indexing-requires-a-uint.rs delete mode 100644 tests/ui/indexing-requires-a-uint.stderr create mode 100644 tests/ui/indexing/index-bot.rs create mode 100644 tests/ui/indexing/index-bot.stderr create mode 100644 tests/ui/indexing/index-help.rs create mode 100644 tests/ui/indexing/index-help.stderr create mode 100644 tests/ui/indexing/index_message.rs create mode 100644 tests/ui/indexing/index_message.stderr create mode 100644 tests/ui/indexing/indexing-requires-a-uint.rs create mode 100644 tests/ui/indexing/indexing-requires-a-uint.stderr create mode 100644 tests/ui/indexing/indexing-spans-caller-location.rs (limited to 'tests/ui') diff --git a/tests/ui/array-slice-vec/slice-2.stderr b/tests/ui/array-slice-vec/slice-2.stderr index 561feb90f0a..b122b46914c 100644 --- a/tests/ui/array-slice-vec/slice-2.stderr +++ b/tests/ui/array-slice-vec/slice-2.stderr @@ -1,26 +1,26 @@ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:7:6 + --> $DIR/slice-2.rs:7:7 | LL | &x[..]; - | ^^^^^ + | ^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:8:6 + --> $DIR/slice-2.rs:8:7 | LL | &x[Foo..]; - | ^^^^^^^^ + | ^^^^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:9:6 + --> $DIR/slice-2.rs:9:7 | LL | &x[..Foo]; - | ^^^^^^^^ + | ^^^^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:10:6 + --> $DIR/slice-2.rs:10:7 | LL | &x[Foo..Foo]; - | ^^^^^^^^^^^ + | ^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/tests/ui/borrowck/suggest-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-local-var-for-vector.stderr index ea92d76b4ec..c8d00f7b222 100644 --- a/tests/ui/borrowck/suggest-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-local-var-for-vector.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu | LL | vec[vec.len() - 1] = 123; | ----^^^----------- - | | | - | | immutable borrow occurs here + | | || + | | |immutable borrow occurs here + | | mutable borrow later used here | mutable borrow occurs here - | mutable borrow later used here | help: try adding a local storing this... --> $DIR/suggest-local-var-for-vector.rs:3:9 @@ -14,10 +14,10 @@ help: try adding a local storing this... LL | vec[vec.len() - 1] = 123; | ^^^^^^^^^ help: ...and then using that local here - --> $DIR/suggest-local-var-for-vector.rs:3:5 + --> $DIR/suggest-local-var-for-vector.rs:3:8 | LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr index 6007beb7753..368d728101c 100644 --- a/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr +++ b/tests/ui/borrowck/suggest-storing-local-var-for-vector.stderr @@ -3,10 +3,10 @@ error[E0502]: cannot borrow `vec` as immutable because it is also borrowed as mu | LL | vec[vec.len() - 1] = 123; | ----^^^----------- - | | | - | | immutable borrow occurs here + | | || + | | |immutable borrow occurs here + | | mutable borrow later used here | mutable borrow occurs here - | mutable borrow later used here | help: try adding a local storing this... --> $DIR/suggest-storing-local-var-for-vector.rs:3:9 @@ -14,10 +14,10 @@ help: try adding a local storing this... LL | vec[vec.len() - 1] = 123; | ^^^^^^^^^ help: ...and then using that local here - --> $DIR/suggest-storing-local-var-for-vector.rs:3:5 + --> $DIR/suggest-storing-local-var-for-vector.rs:3:8 | LL | vec[vec.len() - 1] = 123; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr index efd63a08aae..e122977b9f2 100644 --- a/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr +++ b/tests/ui/borrowck/two-phase-nonrecv-autoref.base.stderr @@ -50,42 +50,42 @@ error[E0502]: cannot borrow `i` as immutable because it is also borrowed as muta | LL | i[i[3]] = 4; | --^---- - | | | - | | immutable borrow occurs here + | ||| + | ||immutable borrow occurs here + | |mutable borrow later used here | mutable borrow occurs here - | mutable borrow later used here | help: try adding a local storing this... - --> $DIR/two-phase-nonrecv-autoref.rs:132:7 + --> $DIR/two-phase-nonrecv-autoref.rs:132:8 | LL | i[i[3]] = 4; - | ^^^^ + | ^^^ help: ...and then using that local here - --> $DIR/two-phase-nonrecv-autoref.rs:132:5 + --> $DIR/two-phase-nonrecv-autoref.rs:132:6 | LL | i[i[3]] = 4; - | ^^^^^^^ + | ^^^^^^ error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable --> $DIR/two-phase-nonrecv-autoref.rs:138:7 | LL | i[i[3]] = i[4]; | --^---- - | | | - | | immutable borrow occurs here + | ||| + | ||immutable borrow occurs here + | |mutable borrow later used here | mutable borrow occurs here - | mutable borrow later used here | help: try adding a local storing this... - --> $DIR/two-phase-nonrecv-autoref.rs:138:7 + --> $DIR/two-phase-nonrecv-autoref.rs:138:8 | LL | i[i[3]] = i[4]; - | ^^^^ + | ^^^ help: ...and then using that local here - --> $DIR/two-phase-nonrecv-autoref.rs:138:5 + --> $DIR/two-phase-nonrecv-autoref.rs:138:6 | LL | i[i[3]] = i[4]; - | ^^^^^^^ + | ^^^^^^ error: aborting due to 7 previous errors diff --git a/tests/ui/consts/issue-94675.stderr b/tests/ui/consts/issue-94675.stderr index cee4dfda2c9..f51f305ac38 100644 --- a/tests/ui/consts/issue-94675.stderr +++ b/tests/ui/consts/issue-94675.stderr @@ -7,10 +7,10 @@ LL | self.bar[0] = baz.len(); = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants error[E0015]: cannot call non-const operator in constant functions - --> $DIR/issue-94675.rs:11:9 + --> $DIR/issue-94675.rs:11:17 | LL | self.bar[0] = baz.len(); - | ^^^^^^^^^^^ + | ^^^ | note: impl defined here, but it is not `const` --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL diff --git a/tests/ui/error-codes/E0608.stderr b/tests/ui/error-codes/E0608.stderr index 3aec509934b..f23f9977ba0 100644 --- a/tests/ui/error-codes/E0608.stderr +++ b/tests/ui/error-codes/E0608.stderr @@ -1,8 +1,8 @@ error[E0608]: cannot index into a value of type `u8` - --> $DIR/E0608.rs:2:5 + --> $DIR/E0608.rs:2:8 | LL | 0u8[2]; - | ^^^^^^ + | ^^^ error: aborting due to previous error diff --git a/tests/ui/index-bot.rs b/tests/ui/index-bot.rs deleted file mode 100644 index e69c4019f61..00000000000 --- a/tests/ui/index-bot.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - (return)[0]; //~ ERROR cannot index into a value of type `!` -} diff --git a/tests/ui/index-bot.stderr b/tests/ui/index-bot.stderr deleted file mode 100644 index b5d78297505..00000000000 --- a/tests/ui/index-bot.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0608]: cannot index into a value of type `!` - --> $DIR/index-bot.rs:2:5 - | -LL | (return)[0]; - | ^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/index-help.rs b/tests/ui/index-help.rs deleted file mode 100644 index 66571ec41a0..00000000000 --- a/tests/ui/index-help.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let x = vec![1]; - x[0i32]; //~ ERROR E0277 -} diff --git a/tests/ui/index-help.stderr b/tests/ui/index-help.stderr deleted file mode 100644 index e020d029875..00000000000 --- a/tests/ui/index-help.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0277]: the type `[{integer}]` cannot be indexed by `i32` - --> $DIR/index-help.rs:3:7 - | -LL | x[0i32]; - | ^^^^ slice indices are of type `usize` or ranges of `usize` - | - = help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32` - = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required for `Vec<{integer}>` to implement `Index` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/index_message.rs b/tests/ui/index_message.rs deleted file mode 100644 index 88b848d6f85..00000000000 --- a/tests/ui/index_message.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - let z = (10,); - let _ = z[0]; //~ ERROR cannot index into a value of type `({integer},)` -} diff --git a/tests/ui/index_message.stderr b/tests/ui/index_message.stderr deleted file mode 100644 index 56d1d70809d..00000000000 --- a/tests/ui/index_message.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0608]: cannot index into a value of type `({integer},)` - --> $DIR/index_message.rs:3:13 - | -LL | let _ = z[0]; - | ^^^^ help: to access tuple elements, use: `z.0` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/indexing-requires-a-uint.rs b/tests/ui/indexing-requires-a-uint.rs deleted file mode 100644 index dbe9b44a138..00000000000 --- a/tests/ui/indexing-requires-a-uint.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Make sure that indexing an array is only valid with a `usize`, not any other -// integral type. - -fn main() { - fn bar(_: T) {} - [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` - - [0][0]; // should infer to be a usize - - let i = 0; // i is an IntVar - [0][i]; // i should be locked to usize - bar::(i); // i should not be re-coerced back to an isize - //~^ ERROR: mismatched types -} diff --git a/tests/ui/indexing-requires-a-uint.stderr b/tests/ui/indexing-requires-a-uint.stderr deleted file mode 100644 index 7a741cfc7de..00000000000 --- a/tests/ui/indexing-requires-a-uint.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0277]: the type `[{integer}]` cannot be indexed by `u8` - --> $DIR/indexing-requires-a-uint.rs:6:9 - | -LL | [0][0u8]; - | ^^^ slice indices are of type `usize` or ranges of `usize` - | - = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` - = help: the trait `SliceIndex<[T]>` is implemented for `usize` - = note: required for `[{integer}]` to implement `Index` - -error[E0308]: mismatched types - --> $DIR/indexing-requires-a-uint.rs:12:18 - | -LL | bar::(i); // i should not be re-coerced back to an isize - | ------------ ^ expected `isize`, found `usize` - | | - | arguments to this function are incorrect - | -note: function defined here - --> $DIR/indexing-requires-a-uint.rs:5:8 - | -LL | fn bar(_: T) {} - | ^^^ ---- -help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit - | -LL | bar::(i.try_into().unwrap()); // i should not be re-coerced back to an isize - | ++++++++++++++++++++ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/indexing/index-bot.rs b/tests/ui/indexing/index-bot.rs new file mode 100644 index 00000000000..e69c4019f61 --- /dev/null +++ b/tests/ui/indexing/index-bot.rs @@ -0,0 +1,3 @@ +fn main() { + (return)[0]; //~ ERROR cannot index into a value of type `!` +} diff --git a/tests/ui/indexing/index-bot.stderr b/tests/ui/indexing/index-bot.stderr new file mode 100644 index 00000000000..bf231c92cad --- /dev/null +++ b/tests/ui/indexing/index-bot.stderr @@ -0,0 +1,9 @@ +error[E0608]: cannot index into a value of type `!` + --> $DIR/index-bot.rs:2:13 + | +LL | (return)[0]; + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/indexing/index-help.rs b/tests/ui/indexing/index-help.rs new file mode 100644 index 00000000000..66571ec41a0 --- /dev/null +++ b/tests/ui/indexing/index-help.rs @@ -0,0 +1,4 @@ +fn main() { + let x = vec![1]; + x[0i32]; //~ ERROR E0277 +} diff --git a/tests/ui/indexing/index-help.stderr b/tests/ui/indexing/index-help.stderr new file mode 100644 index 00000000000..e020d029875 --- /dev/null +++ b/tests/ui/indexing/index-help.stderr @@ -0,0 +1,13 @@ +error[E0277]: the type `[{integer}]` cannot be indexed by `i32` + --> $DIR/index-help.rs:3:7 + | +LL | x[0i32]; + | ^^^^ slice indices are of type `usize` or ranges of `usize` + | + = help: the trait `SliceIndex<[{integer}]>` is not implemented for `i32` + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + = note: required for `Vec<{integer}>` to implement `Index` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/indexing/index_message.rs b/tests/ui/indexing/index_message.rs new file mode 100644 index 00000000000..88b848d6f85 --- /dev/null +++ b/tests/ui/indexing/index_message.rs @@ -0,0 +1,4 @@ +fn main() { + let z = (10,); + let _ = z[0]; //~ ERROR cannot index into a value of type `({integer},)` +} diff --git a/tests/ui/indexing/index_message.stderr b/tests/ui/indexing/index_message.stderr new file mode 100644 index 00000000000..80f2bd52314 --- /dev/null +++ b/tests/ui/indexing/index_message.stderr @@ -0,0 +1,9 @@ +error[E0608]: cannot index into a value of type `({integer},)` + --> $DIR/index_message.rs:3:14 + | +LL | let _ = z[0]; + | ^^^ help: to access tuple elements, use: `.0` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0608`. diff --git a/tests/ui/indexing/indexing-requires-a-uint.rs b/tests/ui/indexing/indexing-requires-a-uint.rs new file mode 100644 index 00000000000..dbe9b44a138 --- /dev/null +++ b/tests/ui/indexing/indexing-requires-a-uint.rs @@ -0,0 +1,14 @@ +// Make sure that indexing an array is only valid with a `usize`, not any other +// integral type. + +fn main() { + fn bar(_: T) {} + [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` + + [0][0]; // should infer to be a usize + + let i = 0; // i is an IntVar + [0][i]; // i should be locked to usize + bar::(i); // i should not be re-coerced back to an isize + //~^ ERROR: mismatched types +} diff --git a/tests/ui/indexing/indexing-requires-a-uint.stderr b/tests/ui/indexing/indexing-requires-a-uint.stderr new file mode 100644 index 00000000000..7a741cfc7de --- /dev/null +++ b/tests/ui/indexing/indexing-requires-a-uint.stderr @@ -0,0 +1,32 @@ +error[E0277]: the type `[{integer}]` cannot be indexed by `u8` + --> $DIR/indexing-requires-a-uint.rs:6:9 + | +LL | [0][0u8]; + | ^^^ slice indices are of type `usize` or ranges of `usize` + | + = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + = note: required for `[{integer}]` to implement `Index` + +error[E0308]: mismatched types + --> $DIR/indexing-requires-a-uint.rs:12:18 + | +LL | bar::(i); // i should not be re-coerced back to an isize + | ------------ ^ expected `isize`, found `usize` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/indexing-requires-a-uint.rs:5:8 + | +LL | fn bar(_: T) {} + | ^^^ ---- +help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit + | +LL | bar::(i.try_into().unwrap()); // i should not be re-coerced back to an isize + | ++++++++++++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/indexing/indexing-spans-caller-location.rs b/tests/ui/indexing/indexing-spans-caller-location.rs new file mode 100644 index 00000000000..2652f00211d --- /dev/null +++ b/tests/ui/indexing/indexing-spans-caller-location.rs @@ -0,0 +1,27 @@ +// run-pass + +// Regression test for https://github.com/rust-lang/rust/issues/114388 + +#[track_caller] +fn caller_line() -> u32 { + std::panic::Location::caller().line() +} + +fn main() { + let prev_line = caller_line(); // first line + (A { prev_line }) // second line + [0]; // third line +} + +struct A { + prev_line: u32, +} +impl std::ops::Index for A { + type Output = (); + + fn index(&self, _idx: usize) -> &() { + // Use the relative number to make it resistent to header changes. + assert_eq!(caller_line(), self.prev_line + 2); + &() + } +} diff --git a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr index 69c7491b2af..a0024c0920f 100644 --- a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr +++ b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr @@ -1,3 +1,3 @@ -thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:6: +thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8: byte index 1 is out of bounds of `` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/issues/issue-27842.stderr b/tests/ui/issues/issue-27842.stderr index 83333aa0c47..b18fe1512b5 100644 --- a/tests/ui/issues/issue-27842.stderr +++ b/tests/ui/issues/issue-27842.stderr @@ -1,24 +1,24 @@ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` - --> $DIR/issue-27842.rs:4:13 + --> $DIR/issue-27842.rs:4:16 | LL | let _ = tup[0]; - | ^^^^^^ help: to access tuple elements, use: `tup.0` + | ^^^ help: to access tuple elements, use: `.0` error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` - --> $DIR/issue-27842.rs:9:13 + --> $DIR/issue-27842.rs:9:16 | LL | let _ = tup[i]; - | ^^^^-^ + | ^-^ | | | cannot access tuple elements at a variable index | = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) error[E0608]: cannot index into a value of type `({integer},)` - --> $DIR/issue-27842.rs:14:13 + --> $DIR/issue-27842.rs:14:16 | LL | let _ = tup[3]; - | ^^^^^^ + | ^^^ | = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) diff --git a/tests/ui/issues/issue-40861.stderr b/tests/ui/issues/issue-40861.stderr index 84e38b9bb05..9b6469d05e9 100644 --- a/tests/ui/issues/issue-40861.stderr +++ b/tests/ui/issues/issue-40861.stderr @@ -1,8 +1,8 @@ error[E0608]: cannot index into a value of type `()` - --> $DIR/issue-40861.rs:4:5 + --> $DIR/issue-40861.rs:4:7 | LL | ()[f(&[1.0])]; - | ^^^^^^^^^^^^^ + | ^^^^^^^^^^^ | = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) diff --git a/tests/ui/lint/lint-unconditional-recursion.stderr b/tests/ui/lint/lint-unconditional-recursion.stderr index 9d200a7898e..d75754bf9f9 100644 --- a/tests/ui/lint/lint-unconditional-recursion.stderr +++ b/tests/ui/lint/lint-unconditional-recursion.stderr @@ -139,7 +139,7 @@ error: function cannot return without recursing LL | fn index(&self, x: usize) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | &self[x] - | ------- recursive call site + | --- recursive call site | = help: a `loop` may express intention better if this is on purpose diff --git a/tests/ui/span/suggestion-non-ascii.stderr b/tests/ui/span/suggestion-non-ascii.stderr index b14632d4e1b..21f8bb62a0c 100644 --- a/tests/ui/span/suggestion-non-ascii.stderr +++ b/tests/ui/span/suggestion-non-ascii.stderr @@ -1,8 +1,8 @@ error[E0608]: cannot index into a value of type `({integer},)` - --> $DIR/suggestion-non-ascii.rs:3:21 + --> $DIR/suggestion-non-ascii.rs:3:24 | LL | println!("☃{}", tup[0]); - | ^^^^^^ help: to access tuple elements, use: `tup.0` + | ^^^ help: to access tuple elements, use: `.0` error: aborting due to previous error diff --git a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr index c55930da225..f81736245f3 100644 --- a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr +++ b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr @@ -38,10 +38,10 @@ LL | let _c = unsafe { _ptr2.offset_from(_ptr1) }; | ++++++++ ~~~~~~~~~~~~~ +++ error[E0608]: cannot index into a value of type `*const u32` - --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:14 + --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:19 | LL | let _d = _ptr1[5]; - | ^^^^^^^^ + | ^^^ | help: consider using `wrapping_add` or `add` for indexing into raw pointer | -- cgit 1.4.1-3-g733a5