Skip to content

Commit 74f2d21

Browse files
committed
compiletest: Don't look for aux-crate .so if //@ no-prefer-dynamic
Since it does not make sense to do so. If someone prefers no dynamic stuff, the last thing they want to look for is an .so file. Also add a regression test. Without the fix, the test fails with: error: test compilation failed although it shouldn't! --- stderr ------------------------------- error: extern location for no_prefer_dynamic_lib does not exist: \ .../auxiliary/libno_prefer_dynamic_lib.so --> .../no-prefer-dynamic-means-no-so.rs:9:5 | LL | no_prefer_dynamic_lib::return_42(); | ^^^^^^^^^^^^^^^^^^^^^
1 parent db6bc0f commit 74f2d21

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/tools/compiletest/src/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ impl<'test> TestCx<'test> {
14251425
} else if aux_type.is_some() {
14261426
panic!("aux_type {aux_type:?} not expected");
14271427
} else if aux_props.no_prefer_dynamic {
1428-
(AuxType::Dylib, None)
1428+
(AuxType::Lib, None)
14291429
} else if self.config.target.contains("emscripten")
14301430
|| (self.config.target.contains("musl")
14311431
&& !aux_props.force_host
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ no-prefer-dynamic
2+
3+
//! Since this is `no-prefer-dynamic` we expect compiletest to _not_ look for
4+
//! this create as `libno_prefer_dynamic_lib.so`.
5+
6+
#![crate_type = "rlib"]
7+
8+
pub fn return_42() -> i32 {
9+
42
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//! Since we and our aux-crate is `no-prefer-dynamic` we expect compiletest to
2+
//! _not_ look for `libno_prefer_dynamic_lib.so`.
3+
4+
//@ check-pass
5+
//@ no-prefer-dynamic
6+
//@ aux-crate: no_prefer_dynamic_lib=no_prefer_dynamic_lib.rs
7+
8+
fn main() {
9+
no_prefer_dynamic_lib::return_42();
10+
}

0 commit comments

Comments
 (0)