summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/issue-84973-blacklist.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/suggestions/issue-84973-blacklist.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/suggestions/issue-84973-blacklist.rs')
-rw-r--r--tests/ui/suggestions/issue-84973-blacklist.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/suggestions/issue-84973-blacklist.rs b/tests/ui/suggestions/issue-84973-blacklist.rs
new file mode 100644
index 000000000..6813b07a2
--- /dev/null
+++ b/tests/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: Copy>(t: T) {}
+fn f_clone<T: Clone>(t: T) {}
+fn f_unpin<T: Unpin>(t: T) {}
+fn f_sized<T: Sized>(t: T) {}
+fn f_send<T: 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]
+}