From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/str/str-idx.stderr | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/test/ui/str/str-idx.stderr (limited to 'src/test/ui/str/str-idx.stderr') diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr new file mode 100644 index 000000000..9079a18d6 --- /dev/null +++ b/src/test/ui/str/str-idx.stderr @@ -0,0 +1,60 @@ +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:3:19 + | +LL | let _: u8 = s[4]; + | ^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: + = help: the trait `SliceIndex<[T]>` is implemented for `usize` + = note: required because of the requirements on the impl of `Index<{integer}>` for `str` + +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:4:19 + | +LL | let _ = s.get(4); + | --- ^ string indices are ranges of `usize` + | | + | required by a bound introduced by this call + | + = help: the trait `SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: + = help: the trait `SliceIndex<[T]>` is implemented for `usize` +note: required by a bound in `core::str::::get` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub const fn get>(&self, i: I) -> Option<&I::Output> { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::::get` + +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:5:29 + | +LL | let _ = s.get_unchecked(4); + | ------------- ^ string indices are ranges of `usize` + | | + | required by a bound introduced by this call + | + = help: the trait `SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + for more information, see chapter 8 in The Book: + = help: the trait `SliceIndex<[T]>` is implemented for `usize` +note: required by a bound in `core::str::::get_unchecked` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL + | +LL | pub const unsafe fn get_unchecked>(&self, i: I) -> &I::Output { + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `core::str::::get_unchecked` + +error[E0277]: the type `str` cannot be indexed by `char` + --> $DIR/str-idx.rs:6:19 + | +LL | let _: u8 = s['c']; + | ^^^ string indices are ranges of `usize` + | + = help: the trait `SliceIndex` is not implemented for `char` + = note: required because of the requirements on the impl of `Index` for `str` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. -- cgit v1.2.3