We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 115b4dd commit f84b95aCopy full SHA for f84b95a
tests/pass/unsized.rs
@@ -2,6 +2,7 @@
2
//@[tree]compile-flags: -Zmiri-tree-borrows
3
#![feature(unsized_tuple_coercion)]
4
#![feature(unsized_fn_params)]
5
+#![feature(custom_mir, core_intrinsics)]
6
7
use std::mem;
8
@@ -32,7 +33,30 @@ fn unsized_params() {
32
33
f3(*p);
34
}
35
36
+fn unsized_field_projection() {
37
+ use std::intrinsics::mir::*;
38
+
39
+ pub struct S<T: ?Sized>(T);
40
41
+ #[custom_mir(dialect = "runtime", phase = "optimized")]
42
+ fn f(x: S<[u8]>) {
43
+ mir! {
44
+ {
45
+ let idx = 0;
46
+ // Project to an unsized field of an unsized local.
47
+ x.0[idx] = 0;
48
+ let _val = x.0[idx];
49
+ Return()
50
+ }
51
52
53
54
+ let x: Box<S<[u8]>> = Box::new(S([0]));
55
+ f(*x);
56
+}
57
58
fn main() {
59
unsized_tuple();
60
unsized_params();
61
+ unsized_field_projection();
62
0 commit comments