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/methods/issues/issue-61525.rs | 20 ++++++++++++++ src/test/ui/methods/issues/issue-61525.stderr | 39 +++++++++++++++++++++++++++ src/test/ui/methods/issues/issue-84495.rs | 4 +++ src/test/ui/methods/issues/issue-84495.stderr | 13 +++++++++ src/test/ui/methods/issues/issue-90315.rs | 7 +++++ src/test/ui/methods/issues/issue-90315.stderr | 13 +++++++++ src/test/ui/methods/issues/issue-94581.rs | 7 +++++ src/test/ui/methods/issues/issue-94581.stderr | 15 +++++++++++ 8 files changed, 118 insertions(+) create mode 100644 src/test/ui/methods/issues/issue-61525.rs create mode 100644 src/test/ui/methods/issues/issue-61525.stderr create mode 100644 src/test/ui/methods/issues/issue-84495.rs create mode 100644 src/test/ui/methods/issues/issue-84495.stderr create mode 100644 src/test/ui/methods/issues/issue-90315.rs create mode 100644 src/test/ui/methods/issues/issue-90315.stderr create mode 100644 src/test/ui/methods/issues/issue-94581.rs create mode 100644 src/test/ui/methods/issues/issue-94581.stderr (limited to 'src/test/ui/methods/issues') diff --git a/src/test/ui/methods/issues/issue-61525.rs b/src/test/ui/methods/issues/issue-61525.rs new file mode 100644 index 000000000..c5ca0326e --- /dev/null +++ b/src/test/ui/methods/issues/issue-61525.rs @@ -0,0 +1,20 @@ +pub trait Example { + fn query(self, q: Q); +} + +impl Example for i32 { + fn query(self, _: Q) { + unimplemented!() + } +} + +mod nested { + use super::Example; + fn example() { + 1.query::("") + //~^ ERROR the size for values of type `dyn ToString` cannot be known at compilation time + //~| ERROR mismatched types + } +} + +fn main() {} diff --git a/src/test/ui/methods/issues/issue-61525.stderr b/src/test/ui/methods/issues/issue-61525.stderr new file mode 100644 index 000000000..aec968d7c --- /dev/null +++ b/src/test/ui/methods/issues/issue-61525.stderr @@ -0,0 +1,39 @@ +error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time + --> $DIR/issue-61525.rs:14:33 + | +LL | 1.query::("") + | ----- ^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `dyn ToString` +note: required by a bound in `Example::query` + --> $DIR/issue-61525.rs:2:14 + | +LL | fn query(self, q: Q); + | ^ required by this bound in `Example::query` +help: consider relaxing the implicit `Sized` restriction + | +LL | fn query(self, q: Q); + | ++++++++ + +error[E0308]: mismatched types + --> $DIR/issue-61525.rs:14:33 + | +LL | 1.query::("") + | --------------------- ^^ expected trait object `dyn ToString`, found `&str` + | | + | arguments to this function are incorrect + | + = note: expected trait object `dyn ToString` + found reference `&'static str` +note: associated function defined here + --> $DIR/issue-61525.rs:2:8 + | +LL | fn query(self, q: Q); + | ^^^^^ + +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/src/test/ui/methods/issues/issue-84495.rs b/src/test/ui/methods/issues/issue-84495.rs new file mode 100644 index 000000000..28c094bf2 --- /dev/null +++ b/src/test/ui/methods/issues/issue-84495.rs @@ -0,0 +1,4 @@ +fn main() { + let x: i32 = 1; + println!("{:?}", x.count()); //~ ERROR is not an iterator +} diff --git a/src/test/ui/methods/issues/issue-84495.stderr b/src/test/ui/methods/issues/issue-84495.stderr new file mode 100644 index 000000000..b0217a7c8 --- /dev/null +++ b/src/test/ui/methods/issues/issue-84495.stderr @@ -0,0 +1,13 @@ +error[E0599]: `i32` is not an iterator + --> $DIR/issue-84495.rs:3:24 + | +LL | println!("{:?}", x.count()); + | ^^^^^ `i32` is not an iterator + | + = note: the following trait bounds were not satisfied: + `i32: Iterator` + which is required by `&mut i32: Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/methods/issues/issue-90315.rs b/src/test/ui/methods/issues/issue-90315.rs new file mode 100644 index 000000000..01bf9f484 --- /dev/null +++ b/src/test/ui/methods/issues/issue-90315.rs @@ -0,0 +1,7 @@ +fn main() { + let arr = &[0,1,2,3]; + for _i in 0..arr.len().rev() { //~ERROR not an iterator + // The above error used to say “the method `rev` exists for type `usize`”. + // This regression test ensures it doesn't say that any more. + } +} diff --git a/src/test/ui/methods/issues/issue-90315.stderr b/src/test/ui/methods/issues/issue-90315.stderr new file mode 100644 index 000000000..c6a76c9e7 --- /dev/null +++ b/src/test/ui/methods/issues/issue-90315.stderr @@ -0,0 +1,13 @@ +error[E0599]: `usize` is not an iterator + --> $DIR/issue-90315.rs:3:26 + | +LL | for _i in 0..arr.len().rev() { + | ^^^ `usize` is not an iterator + | + = note: the following trait bounds were not satisfied: + `usize: Iterator` + which is required by `&mut usize: Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/methods/issues/issue-94581.rs b/src/test/ui/methods/issues/issue-94581.rs new file mode 100644 index 000000000..df393e91d --- /dev/null +++ b/src/test/ui/methods/issues/issue-94581.rs @@ -0,0 +1,7 @@ +fn get_slice() -> &'static [i32] { + &[1, 2, 3, 4] +} + +fn main() { + let sqsum = get_slice().map(|i| i * i).sum(); //~ ERROR [E0599] +} diff --git a/src/test/ui/methods/issues/issue-94581.stderr b/src/test/ui/methods/issues/issue-94581.stderr new file mode 100644 index 000000000..d6be29cf5 --- /dev/null +++ b/src/test/ui/methods/issues/issue-94581.stderr @@ -0,0 +1,15 @@ +error[E0599]: `&'static [i32]` is not an iterator + --> $DIR/issue-94581.rs:6:29 + | +LL | let sqsum = get_slice().map(|i| i * i).sum(); + | ^^^ `&'static [i32]` is not an iterator; try calling `.iter()` + | + = note: the following trait bounds were not satisfied: + `&'static [i32]: Iterator` + which is required by `&mut &'static [i32]: Iterator` + `[i32]: Iterator` + which is required by `&mut [i32]: Iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. -- cgit v1.2.3