about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-19 05:35:03 +0000
committerbors <bors@rust-lang.org>2023-02-19 05:35:03 +0000
commit73f40197ecabf77ed59028af61739404eb60dd2e (patch)
treed85c5175b2c1b33af686cef847865a64be4eea77 /tests/codegen
parentfcdbd1c07f0b6c8e7d8bbd727c6ca69a1af8c7e9 (diff)
parent7f798c2b216db0bb7ebeb9dd863fbdf7668094c5 (diff)
downloadrust-73f40197ecabf77ed59028af61739404eb60dd2e.tar.gz
rust-73f40197ecabf77ed59028af61739404eb60dd2e.zip
Auto merge of #107772 - compiler-errors:dyn-star-backend-is-ptr, r=eholk
Make `dyn*`'s value backend type a pointer

One tweak on top of Ralf's commit should fix using `usize` as a `dyn*`-coercible type, and should fix when we're using various other pointer types when LLVM opaque pointers is disabled.

r? `@eholk` but feel free to reassign
cc https://github.com/rust-lang/rust/pull/107728#issuecomment-1421231823 `@RalfJung`
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/function-arguments.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs
index 96dfde18683..d6f019016a5 100644
--- a/tests/codegen/function-arguments.rs
+++ b/tests/codegen/function-arguments.rs
@@ -1,6 +1,7 @@
 // compile-flags: -O -C no-prepopulate-passes
 
 #![crate_type = "lib"]
+#![feature(dyn_star)]
 
 use std::mem::MaybeUninit;
 use std::num::NonZeroU64;
@@ -279,3 +280,11 @@ pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> {
 pub fn enum_id_2(x: Option<u8>) -> Option<u8> {
   x
 }
+
+// CHECK: { {{\{\}\*|ptr}}, {{.+}} } @dyn_star({{\{\}\*|ptr}} noundef %x.0, {{.+}} noalias noundef readonly align {{.*}} dereferenceable({{.*}}) %x.1)
+// Expect an ABI something like `{ {}*, [3 x i64]* }`, but that's hard to match on generically,
+// so do like the `trait_box` test and just match on `{{.+}}` for the vtable.
+#[no_mangle]
+pub fn dyn_star(x: dyn* Drop) -> dyn* Drop {
+  x
+}