summary refs log tree commit diff
path: root/tests/run-make/std-core-cycle
diff options
context:
space:
mode:
authorJoshua Nelson <github@jyn.dev>2023-03-30 07:34:55 -0500
committerJoshua Nelson <github@jyn.dev>2023-03-30 07:34:55 -0500
commit433da1fc047bb39a263eefca4bdb2b1972f1d2ce (patch)
tree28540e78fdd5fdf158267e67495121ac64f0866a /tests/run-make/std-core-cycle
parentf2d9a3d0771504f1ae776226a5799dcb4408a91a (diff)
downloadrust-433da1fc047bb39a263eefca4bdb2b1972f1d2ce.tar.gz
rust-433da1fc047bb39a263eefca4bdb2b1972f1d2ce.zip
Move almost all run-make-fulldeps to run-make
They pass fine.
Diffstat (limited to 'tests/run-make/std-core-cycle')
-rw-r--r--tests/run-make/std-core-cycle/Makefile16
-rw-r--r--tests/run-make/std-core-cycle/bar.rs16
-rw-r--r--tests/run-make/std-core-cycle/foo.rs11
3 files changed, 43 insertions, 0 deletions
diff --git a/tests/run-make/std-core-cycle/Makefile b/tests/run-make/std-core-cycle/Makefile
new file mode 100644
index 00000000000..4f252863767
--- /dev/null
+++ b/tests/run-make/std-core-cycle/Makefile
@@ -0,0 +1,16 @@
+include ../tools.mk
+
+ifeq ($(UNAME),Darwin)
+FLAGS :=
+else
+ifdef IS_WINDOWS
+FLAGS :=
+else
+FLAGS := -C link-args=-Wl,--no-undefined
+endif
+endif
+
+all:
+	$(RUSTC) bar.rs
+	$(RUSTC) foo.rs $(FLAGS)
+	$(RUSTC) foo.rs $(FLAGS) -C panic=abort
diff --git a/tests/run-make/std-core-cycle/bar.rs b/tests/run-make/std-core-cycle/bar.rs
new file mode 100644
index 00000000000..9f5e7c29bdd
--- /dev/null
+++ b/tests/run-make/std-core-cycle/bar.rs
@@ -0,0 +1,16 @@
+#![feature(allocator_api)]
+#![crate_type = "rlib"]
+
+use std::alloc::*;
+
+pub struct A;
+
+unsafe impl GlobalAlloc for A {
+    unsafe fn alloc(&self, _: Layout) -> *mut u8 {
+        loop {}
+    }
+
+    unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) {
+        loop {}
+    }
+}
diff --git a/tests/run-make/std-core-cycle/foo.rs b/tests/run-make/std-core-cycle/foo.rs
new file mode 100644
index 00000000000..6aa6e1ac3c5
--- /dev/null
+++ b/tests/run-make/std-core-cycle/foo.rs
@@ -0,0 +1,11 @@
+#![crate_type = "cdylib"]
+
+extern crate bar;
+
+#[global_allocator]
+static A: bar::A = bar::A;
+
+#[no_mangle]
+pub extern "C" fn a(a: u32, b: u32) -> u32 {
+    a / b
+}