Skip to content

Commit

Permalink
Add extern type pointer cast tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 21, 2019
1 parent fdfb1ed commit f2c574a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Adapted from https://github.com/sunfishcode/mir2cranelift/blob/master/rust-examples/nocore-hello-world.rs

#![feature(no_core, unboxed_closures, start, lang_items, box_syntax, slice_patterns, never_type, linkage)]
#![feature(no_core, unboxed_closures, start, lang_items, box_syntax, slice_patterns, never_type, linkage, extern_types)]
#![no_core]
#![allow(dead_code)]

Expand Down Expand Up @@ -262,6 +262,20 @@ fn main() {
assert_eq!(*ANOTHER_STATIC, 42);

check_niche_behavior();

extern "C" {
type ExternType;
}

struct ExternTypeWrapper {
_a: ExternType,
}

let nullptr = 0 as *const ();
let extern_nullptr = nullptr as *const ExternTypeWrapper;
extern_nullptr as *const ();
let slice_ptr = &[] as *const [u8];
slice_ptr as *const u8;
}

// Copied ui/issues/issue-61696.rs
Expand Down

0 comments on commit f2c574a

Please sign in to comment.