mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
compiletest: Don't assume aux-crate becomes a *.so with 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();
| ^^^^^^^^^^^^^^^^^^^^^
This commit is contained in:
@@ -1438,7 +1438,7 @@ fn build_auxiliary(
|
||||
} else if aux_type.is_some() {
|
||||
panic!("aux_type {aux_type:?} not expected");
|
||||
} else if aux_props.no_prefer_dynamic {
|
||||
(AuxType::Dylib, None)
|
||||
(AuxType::Lib, None)
|
||||
} else if self.config.target.contains("emscripten")
|
||||
|| (self.config.target.contains("musl")
|
||||
&& !aux_props.force_host
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//@ no-prefer-dynamic
|
||||
|
||||
//! Since this is `no-prefer-dynamic` we expect compiletest to _not_ look for
|
||||
//! this create as `libno_prefer_dynamic_lib.so`.
|
||||
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
pub fn return_42() -> i32 {
|
||||
42
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//! Since we and our `aux-crate` is `no-prefer-dynamic`, we expect compiletest
|
||||
//! to _not_ look for `libno_prefer_dynamic_lib.so`.
|
||||
|
||||
//@ check-pass
|
||||
//@ no-prefer-dynamic
|
||||
//@ aux-crate: no_prefer_dynamic_lib=no_prefer_dynamic_lib.rs
|
||||
|
||||
fn main() {
|
||||
no_prefer_dynamic_lib::return_42();
|
||||
}
|
||||
Reference in New Issue
Block a user