about summary refs log tree commit diff
path: root/tests/ui/codegen/freeze-on-polymorphic-projection.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-16 23:07:18 +0000
committerMichael Goulet <michael@errs.io>2023-04-16 23:09:57 +0000
commite28e19034ffd49a50499e96da884be3ea9a950aa (patch)
tree74748d055723af2d2ce1ffccf1254083bdb8cf83 /tests/ui/codegen/freeze-on-polymorphic-projection.rs
parent8a778ca1e35e4a8df95c00d800100d95e63e7722 (diff)
downloadrust-e28e19034ffd49a50499e96da884be3ea9a950aa.tar.gz
rust-e28e19034ffd49a50499e96da884be3ea9a950aa.zip
Check freeze with right param-env
Diffstat (limited to 'tests/ui/codegen/freeze-on-polymorphic-projection.rs')
-rw-r--r--tests/ui/codegen/freeze-on-polymorphic-projection.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/codegen/freeze-on-polymorphic-projection.rs b/tests/ui/codegen/freeze-on-polymorphic-projection.rs
new file mode 100644
index 00000000000..edc79f8fd94
--- /dev/null
+++ b/tests/ui/codegen/freeze-on-polymorphic-projection.rs
@@ -0,0 +1,19 @@
+// build-pass
+// compile-flags: -Copt-level=1 --crate-type=lib
+
+#![feature(specialization)]
+//~^ WARN the feature `specialization` is incomplete
+
+pub unsafe trait Storage {
+    type Handle;
+}
+
+pub unsafe trait MultipleStorage: Storage {}
+
+default unsafe impl<S> Storage for S where S: MultipleStorage {}
+
+// Make sure that we call is_freeze on `(S::Handle,)` in the param-env of `ice`,
+// instead of in an empty, reveal-all param-env.
+pub fn ice<S: Storage>(boxed: (S::Handle,)) -> (S::Handle,) {
+    boxed
+}