Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-include ../tools.mk | ||
|
||
# Test mixing pathless --extern with paths. | ||
|
||
all: | ||
$(RUSTC) bar-static.rs --crate-name=bar --crate-type=rlib | ||
$(RUSTC) bar-dynamic.rs --crate-name=bar --crate-type=dylib -C prefer-dynamic | ||
# rlib preferred over dylib | ||
$(RUSTC) foo.rs --extern bar | ||
$(call RUN,foo) | $(CGREP) 'static' | ||
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar | ||
$(call RUN,foo) | $(CGREP) 'static' | ||
# explicit --extern overrides pathless | ||
$(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar | ||
$(call RUN,foo) | $(CGREP) 'dynamic' | ||
# prefer-dynamic does what it says | ||
$(RUSTC) foo.rs --extern bar -C prefer-dynamic | ||
$(call RUN,foo) | $(CGREP) 'dynamic' |
3 changes: 3 additions & 0 deletions
3
src/test/run-make-fulldeps/extern-flag-pathless/bar-dynamic.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub fn f() { | ||
println!("dynamic"); | ||
} |
3 changes: 3 additions & 0 deletions
3
src/test/run-make-fulldeps/extern-flag-pathless/bar-static.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub fn f() { | ||
println!("static"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
bar::f(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ignore-stage1 | ||
// edition:2018 | ||
// compile-flags:--extern rustc | ||
|
||
// Test that `--extern rustc` fails with `rustc_private`. | ||
|
||
pub use rustc; | ||
//~^ use of unstable library feature 'rustc_private' | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? | ||
--> $DIR/pathless-extern-unstable.rs:7:9 | ||
| | ||
LL | pub use rustc; | ||
| ^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/27812 | ||
= help: add `#![feature(rustc_private)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// edition:2018 | ||
// compile-flags:--extern alloc | ||
// build-pass | ||
|
||
// Test that `--extern alloc` will load from the sysroot without error. | ||
|
||
fn main() { | ||
let _: Vec<i32> = alloc::vec::Vec::new(); | ||
} |