summaryrefslogtreecommitdiffstats
path: root/src/test/ui/object-safety/object-safety-phantom-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/object-safety/object-safety-phantom-fn.rs')
-rw-r--r--src/test/ui/object-safety/object-safety-phantom-fn.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.rs b/src/test/ui/object-safety/object-safety-phantom-fn.rs
new file mode 100644
index 000000000..3ffeb81c1
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-phantom-fn.rs
@@ -0,0 +1,22 @@
+// Check that `Self` appearing in a phantom fn does not make a trait not object safe.
+
+// build-pass (FIXME(62277): could be check-pass?)
+#![allow(dead_code)]
+
+trait Baz {
+}
+
+trait Bar<T> {
+}
+
+fn make_bar<T:Bar<u32>>(t: &T) -> &dyn Bar<u32> {
+ t
+}
+
+fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
+ t
+}
+
+
+fn main() {
+}