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 --- .../missing-trait-bounds/auxiliary/issue-69725.rs | 8 ++++ src/test/ui/missing-trait-bounds/issue-35677.fixed | 11 +++++ src/test/ui/missing-trait-bounds/issue-35677.rs | 11 +++++ .../ui/missing-trait-bounds/issue-35677.stderr | 17 +++++++ src/test/ui/missing-trait-bounds/issue-69725.fixed | 13 ++++++ src/test/ui/missing-trait-bounds/issue-69725.rs | 13 ++++++ .../ui/missing-trait-bounds/issue-69725.stderr | 22 +++++++++ .../missing-trait-bound-for-op.fixed | 7 +++ .../missing-trait-bound-for-op.rs | 7 +++ .../missing-trait-bound-for-op.stderr | 16 +++++++ .../missing-trait-bounds-for-method-call.rs | 31 +++++++++++++ .../missing-trait-bounds-for-method-call.stderr | 52 ++++++++++++++++++++++ 12 files changed, 208 insertions(+) create mode 100644 src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs create mode 100644 src/test/ui/missing-trait-bounds/issue-35677.fixed create mode 100644 src/test/ui/missing-trait-bounds/issue-35677.rs create mode 100644 src/test/ui/missing-trait-bounds/issue-35677.stderr create mode 100644 src/test/ui/missing-trait-bounds/issue-69725.fixed create mode 100644 src/test/ui/missing-trait-bounds/issue-69725.rs create mode 100644 src/test/ui/missing-trait-bounds/issue-69725.stderr create mode 100644 src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed create mode 100644 src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs create mode 100644 src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr create mode 100644 src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs create mode 100644 src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr (limited to 'src/test/ui/missing-trait-bounds') diff --git a/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs b/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs new file mode 100644 index 000000000..13606e498 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/auxiliary/issue-69725.rs @@ -0,0 +1,8 @@ +#[derive(Clone)] +pub struct Struct(A); + +impl Struct { + pub fn new() -> Self { + todo!() + } +} diff --git a/src/test/ui/missing-trait-bounds/issue-35677.fixed b/src/test/ui/missing-trait-bounds/issue-35677.fixed new file mode 100644 index 000000000..08174d8d8 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-35677.fixed @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code)] +use std::collections::HashSet; +use std::hash::Hash; + +fn is_subset(this: &HashSet, other: &HashSet) -> bool where T: Eq, T: Hash { + this.is_subset(other) + //~^ ERROR the method +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/issue-35677.rs b/src/test/ui/missing-trait-bounds/issue-35677.rs new file mode 100644 index 000000000..2cb394386 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-35677.rs @@ -0,0 +1,11 @@ +// run-rustfix +#![allow(dead_code)] +use std::collections::HashSet; +use std::hash::Hash; + +fn is_subset(this: &HashSet, other: &HashSet) -> bool { + this.is_subset(other) + //~^ ERROR the method +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/issue-35677.stderr b/src/test/ui/missing-trait-bounds/issue-35677.stderr new file mode 100644 index 000000000..a2201b946 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-35677.stderr @@ -0,0 +1,17 @@ +error[E0599]: the method `is_subset` exists for reference `&HashSet`, but its trait bounds were not satisfied + --> $DIR/issue-35677.rs:7:10 + | +LL | this.is_subset(other) + | ^^^^^^^^^ method cannot be called on `&HashSet` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `T: Eq` + `T: Hash` +help: consider restricting the type parameters to satisfy the trait bounds + | +LL | fn is_subset(this: &HashSet, other: &HashSet) -> bool where T: Eq, T: Hash { + | ++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/missing-trait-bounds/issue-69725.fixed b/src/test/ui/missing-trait-bounds/issue-69725.fixed new file mode 100644 index 000000000..d57badcfd --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-69725.fixed @@ -0,0 +1,13 @@ +// run-rustfix +// aux-build:issue-69725.rs +#![allow(dead_code)] + +extern crate issue_69725; +use issue_69725::Struct; + +fn crash() where A: Clone { + let _ = Struct::::new().clone(); + //~^ ERROR: the method +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/issue-69725.rs b/src/test/ui/missing-trait-bounds/issue-69725.rs new file mode 100644 index 000000000..9c88969c5 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-69725.rs @@ -0,0 +1,13 @@ +// run-rustfix +// aux-build:issue-69725.rs +#![allow(dead_code)] + +extern crate issue_69725; +use issue_69725::Struct; + +fn crash() { + let _ = Struct::::new().clone(); + //~^ ERROR: the method +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/issue-69725.stderr b/src/test/ui/missing-trait-bounds/issue-69725.stderr new file mode 100644 index 000000000..980d9dd16 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/issue-69725.stderr @@ -0,0 +1,22 @@ +error[E0599]: the method `clone` exists for struct `Struct`, but its trait bounds were not satisfied + --> $DIR/issue-69725.rs:9:32 + | +LL | let _ = Struct::::new().clone(); + | ^^^^^ method cannot be called on `Struct` due to unsatisfied trait bounds + | + ::: $DIR/auxiliary/issue-69725.rs:2:1 + | +LL | pub struct Struct(A); + | -------------------- doesn't satisfy `Struct: Clone` + | + = note: the following trait bounds were not satisfied: + `A: Clone` + which is required by `Struct: Clone` +help: consider restricting the type parameter to satisfy the trait bound + | +LL | fn crash() where A: Clone { + | ++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed new file mode 100644 index 000000000..6b24375e4 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.fixed @@ -0,0 +1,7 @@ +// run-rustfix + +pub fn foo(s: &[T], t: &[T]) { + let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]` +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs new file mode 100644 index 000000000..df47be070 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.rs @@ -0,0 +1,7 @@ +// run-rustfix + +pub fn foo(s: &[T], t: &[T]) { + let _ = s == t; //~ ERROR binary operation `==` cannot be applied to type `&[T]` +} + +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr new file mode 100644 index 000000000..cde075501 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/missing-trait-bound-for-op.stderr @@ -0,0 +1,16 @@ +error[E0369]: binary operation `==` cannot be applied to type `&[T]` + --> $DIR/missing-trait-bound-for-op.rs:4:15 + | +LL | let _ = s == t; + | - ^^ - &[T] + | | + | &[T] + | +help: consider restricting type parameter `T` + | +LL | pub fn foo(s: &[T], t: &[T]) { + | +++++++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0369`. diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs new file mode 100644 index 000000000..afd47f71c --- /dev/null +++ b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.rs @@ -0,0 +1,31 @@ +#[derive(Default, PartialEq)] +struct Foo { + bar: Box<[T]>, +} + +trait Bar { + fn foo(&self) {} +} + +impl Bar for Foo {} + +impl Foo { + fn bar(&self) { + self.foo(); + //~^ ERROR the method + } +} + +struct Fin where T: Bar { + bar: Box<[T]>, +} + +impl Bar for Fin {} + +impl Fin { + fn bar(&self) { + self.foo(); + //~^ ERROR the method + } +} +fn main() {} diff --git a/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr new file mode 100644 index 000000000..9e94aa2c7 --- /dev/null +++ b/src/test/ui/missing-trait-bounds/missing-trait-bounds-for-method-call.stderr @@ -0,0 +1,52 @@ +error[E0599]: the method `foo` exists for reference `&Foo`, but its trait bounds were not satisfied + --> $DIR/missing-trait-bounds-for-method-call.rs:14:14 + | +LL | struct Foo { + | ------------- doesn't satisfy `Foo: Bar` +... +LL | self.foo(); + | ^^^ method cannot be called on `&Foo` due to unsatisfied trait bounds + | +note: trait bound `T: Default` was not satisfied + --> $DIR/missing-trait-bounds-for-method-call.rs:10:9 + | +LL | impl Bar for Foo {} + | ^^^^^^^ --- ------ + | | + | unsatisfied trait bound introduced here +note: trait bound `T: Bar` was not satisfied + --> $DIR/missing-trait-bounds-for-method-call.rs:10:19 + | +LL | impl Bar for Foo {} + | ^^^ --- ------ + | | + | unsatisfied trait bound introduced here +help: consider restricting the type parameters to satisfy the trait bounds + | +LL | struct Foo where T: Bar, T: Default { + | ++++++++++++++++++++++++ + +error[E0599]: the method `foo` exists for reference `&Fin`, but its trait bounds were not satisfied + --> $DIR/missing-trait-bounds-for-method-call.rs:27:14 + | +LL | struct Fin where T: Bar { + | ------------- doesn't satisfy `Fin: Bar` +... +LL | self.foo(); + | ^^^ method cannot be called on `&Fin` due to unsatisfied trait bounds + | +note: trait bound `T: Default` was not satisfied + --> $DIR/missing-trait-bounds-for-method-call.rs:23:9 + | +LL | impl Bar for Fin {} + | ^^^^^^^ --- ------ + | | + | unsatisfied trait bound introduced here +help: consider restricting the type parameter to satisfy the trait bound + | +LL | struct Fin where T: Bar, T: Default { + | ++++++++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0599`. -- cgit v1.2.3