about summary refs log tree commit diff
path: root/tests/ui/codegen
diff options
context:
space:
mode:
authorLuv-Ray <zhuoxun.yang777@outlook.com>2024-09-23 15:25:52 +0800
committerLuv-Ray <zhuoxun.yang777@outlook.com>2024-09-23 15:25:52 +0800
commit16093faea8a004832053146f2299b4aed6990fa0 (patch)
treeb945b1e72bfc23857aa17e942e1dbb330ffc77e4 /tests/ui/codegen
parentc0838c8ebec23fb87855bb6de3a287981cb1df98 (diff)
downloadrust-16093faea8a004832053146f2299b4aed6990fa0.tar.gz
rust-16093faea8a004832053146f2299b4aed6990fa0.zip
fix ices on vfe about principal trait
Diffstat (limited to 'tests/ui/codegen')
-rw-r--r--tests/ui/codegen/virtual-function-elimination.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/codegen/virtual-function-elimination.rs b/tests/ui/codegen/virtual-function-elimination.rs
new file mode 100644
index 00000000000..3cbeb1293e5
--- /dev/null
+++ b/tests/ui/codegen/virtual-function-elimination.rs
@@ -0,0 +1,17 @@
+//@ build-pass
+//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true
+//@ only-x86_64
+//@ no-prefer-dynamic
+
+// issue #123955
+pub fn test0() {
+    _ = Box::new(()) as Box<dyn Send>;
+}
+
+// issue #124092
+const X: for<'b> fn(&'b ()) = |&()| ();
+pub fn test1() {
+    let _dyn_debug = Box::new(X) as Box<fn(&'static ())> as Box<dyn Send>;
+}
+
+fn main() {}