port no-cdylib-as-rdylib test · rust-lang/rust@1f61cc3

File tree

3 files changed

lines changed

  • tests/run-make/no-cdylib-as-rdylib

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -185,7 +185,6 @@ run-make/native-link-modifier-whole-archive/Makefile

185185

run-make/no-alloc-shim/Makefile

186186

run-make/no-builtins-attribute/Makefile

187187

run-make/no-builtins-lto/Makefile

188-

run-make/no-cdylib-as-rdylib/Makefile

189188

run-make/no-duplicate-libs/Makefile

190189

run-make/no-intermediate-extras/Makefile

191190

run-make/obey-crate-type-flag/Makefile

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,16 @@

1+

// This test produces an rlib and a cdylib from bar.rs.

2+

// Then, foo.rs attempts to link to the bar library.

3+

// If the test passes, that means rustc favored the rlib and ignored the cdylib.

4+

// If the test fails, that is because the cdylib was picked, which does not export

5+

// any Rust symbols.

6+

// See https://github.com/rust-lang/rust/pull/113695

7+
8+

//@ ignore-cross-compile

9+
10+

use run_make_support::{run, rustc};

11+
12+

fn main() {

13+

rustc().input("bar.rs").crate_type("rlib").crate_type("cdylib").run();

14+

rustc().input("foo.rs").arg("-Cprefer-dynamic").run();

15+

run("foo");

16+

}