about summary refs log tree commit diff
path: root/tests/ui/codegen
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-24 15:17:34 -0400
committerMichael Goulet <michael@errs.io>2024-05-24 21:53:39 -0400
commit045f448e26257c7b19bf6d68c8e5e9d09ab4df79 (patch)
tree9daae047b2d3724ae539d76d3a6cd05eb4949c00 /tests/ui/codegen
parent36153f1a4e3162f0a143c7b3e468ecb3beb0008e (diff)
downloadrust-045f448e26257c7b19bf6d68c8e5e9d09ab4df79.tar.gz
rust-045f448e26257c7b19bf6d68c8e5e9d09ab4df79.zip
Don't eagerly monomorphize drop for types that are impossible to instantiate
Diffstat (limited to 'tests/ui/codegen')
-rw-r--r--tests/ui/codegen/mono-impossible-drop.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/codegen/mono-impossible-drop.rs b/tests/ui/codegen/mono-impossible-drop.rs
new file mode 100644
index 00000000000..dec013cfe54
--- /dev/null
+++ b/tests/ui/codegen/mono-impossible-drop.rs
@@ -0,0 +1,18 @@
+//@ compile-flags: -Clink-dead-code=on --crate-type=lib
+//@ build-pass
+
+#![feature(trivial_bounds)]
+#![allow(trivial_bounds)]
+
+// Make sure we don't monomorphize the drop impl for `Baz`, since it has predicates
+// that don't hold under a reveal-all param env.
+
+trait Foo {
+    type Assoc;
+}
+
+struct Bar;
+
+struct Baz(<Bar as Foo>::Assoc)
+where
+    Bar: Foo;