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/suggestions/issue-84973-blacklist.rs | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/ui/suggestions/issue-84973-blacklist.rs (limited to 'src/test/ui/suggestions/issue-84973-blacklist.rs') diff --git a/src/test/ui/suggestions/issue-84973-blacklist.rs b/src/test/ui/suggestions/issue-84973-blacklist.rs new file mode 100644 index 000000000..6813b07a2 --- /dev/null +++ b/src/test/ui/suggestions/issue-84973-blacklist.rs @@ -0,0 +1,28 @@ +// Checks that certain traits for which we don't want to suggest borrowing +// are blacklisted and don't cause the suggestion to be issued. + +#![feature(generators)] + +fn f_copy(t: T) {} +fn f_clone(t: T) {} +fn f_unpin(t: T) {} +fn f_sized(t: T) {} +fn f_send(t: T) {} + +struct S; + +fn main() { + f_copy("".to_string()); //~ ERROR: the trait bound `String: Copy` is not satisfied [E0277] + f_clone(S); //~ ERROR: the trait bound `S: Clone` is not satisfied [E0277] + f_unpin(static || { yield; }); + //~^ ERROR: cannot be unpinned [E0277] + + let cl = || (); + let ref_cl: &dyn Fn() -> () = &cl; + f_sized(*ref_cl); + //~^ ERROR: the size for values of type `dyn Fn()` cannot be known at compilation time [E0277] + + use std::rc::Rc; + let rc = Rc::new(0); + f_send(rc); //~ ERROR: `Rc<{integer}>` cannot be sent between threads safely [E0277] +} -- cgit v1.2.3