Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow compiletest to pass down --extern flags #54020

Closed
wants to merge 14 commits into from

Conversation

qmx
Copy link
Member

@qmx qmx commented Sep 7, 2018

When cargo exposes a crate to rustc, it uses --extern, with the potential for crate name aliasing. This PR adds this support to compiletest via a aux-crate:foo=baz.rs header, where it exposes the crate baz under a foo alias.

This is specially useful for testing the new Rust 2018 edition module behaviors, since crates listed via --extern appear in the prelude.

Additionally, this also adds some tests to the existing compiletest parsing code.

Fixes #53737

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2018
@qmx
Copy link
Member Author

qmx commented Sep 7, 2018

r? @nikomatsakis

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! A few nits.

}

#[test]
fn test_parse_name_kv_directive() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woah tests. Totally not idiomatic for compiletest. 😛


fn main() {
let x = Yellow{};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we port the extern prelude test to use this?

What about your existing tests for suggestions?

@qmx
Copy link
Member Author

qmx commented Sep 8, 2018

after some fiddling I've learned more about some implied things for --extern calls. I've pushed something that works for linux at least and now I'm trying to find a cross-platform way of fixing this (and potentially less ugly too) 🙃

@nikomatsakis is there a standard call for doing naming normalization (like the ones that make the output for a some-crate.rs file that emits a rlib to be called libsome_crate.so)?

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

[00:05:30] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:05:30] tidy error: /checkout/src/tools/compiletest/src/runtest.rs:1502: line longer than 100 chars
[00:05:31] some tidy checks failed
[00:05:31] 
[00:05:31] 
[00:05:31] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:05:31] 
[00:05:31] 
[00:05:31] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:05:31] Build completed unsuccessfully in 0:00:54
[00:05:31] Build completed unsuccessfully in 0:00:54
[00:05:31] Makefile:79: recipe for target 'tidy' failed
[00:05:31] make: *** [tidy] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:159edb1e
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:06f9bde3:start=1536379586595081635,finish=1536379586602895809,duration=7814174
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1089e0f8
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1b8ac9c6
travis_time:start:1b8ac9c6
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:065d51d0
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:45:25] ....................................................................................................
[00:45:27] ....................................................................................................
[00:45:30] ....................................i...............................................................
[00:45:33] ...i................................................................................................
[00:45:36] ..................................................................................F.................
[00:45:41] ....................................................................................................
[00:45:44] ....................................................................................................
[00:45:46] ....................................................................................................
[00:45:49] ....................................................................................................
---
[00:51:11] 
[00:51:11] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:497:22
[00:51:11] 
[00:51:11] 
[00:51:11] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--qu

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nikomatsakis nikomatsakis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2018
rustc.arg(format!("{}={}/lib{}",
aux_crate.key,
aux_dir.display(),
&aux_crate.value.replace(".rs", ".so").replace("-","_")));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton is there a place on the compiler where I can get the official codepath that does this in a cross-platform way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can probably use std::env::consts::DLL_EXTENSION perhaps? We typically don't need to factor in cross compilation here

@nikomatsakis
Copy link
Contributor

I am very sad this hasn't landed yet. It would be very useful.

@TimNN
Copy link
Contributor

TimNN commented Oct 9, 2018

Ping from triage @qmx, what is the status of this PR?

@qmx
Copy link
Member Author

qmx commented Oct 16, 2018

closing this for now, will revisit it later

@qmx qmx closed this Oct 16, 2018
@qmx qmx reopened this Oct 19, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:47:25] .................................................................................................... 1400/4637
[00:47:28] ......................................................................i............................. 1500/4637
[00:47:31] .......................................i............................................................ 1600/4637
[00:47:34] .................................................................................................... 1700/4637
[00:47:38] ................................F................................................................... 1800/4637
[00:47:44] .................................................................................................... 2000/4637
[00:47:48] .................................................................................................... 2100/4637
[00:47:52] .................................................................................................... 2200/4637
[00:47:56] .................................................................................................... 2300/4637
---
[00:48:40] .................................................................................................... 3600/4637
[00:48:43] .................................................................................................... 3700/4637
[00:48:46] .................................................................................................... 3800/4637
[00:48:49] ...............................................i.................................................... 3900/4637
[00:48:55] .....................................................................F.............................. 4000/4637
[00:49:01] .................................................................................................... 4200/4637
[00:49:04] .....................i.............................................................................. 4300/4637
[00:49:08] .................................................................................................... 4400/4637
[00:49:11] .................................................................................................... 4500/4637
[00:49:11] .................................................................................................... 4500/4637
[00:49:13] ............................................................................i....................... 4600/4637
[00:49:14] .....................................
[00:49:14] failures:
[00:49:14] 
[00:49:14] ---- [ui] ui/issue-53737.rs stdout ----
[00:49:14] normalized stderr:
[00:49:14] error: extern location for myfoo does not exist: $TEST_BUILD_DIR/issue-53737/auxiliary/libbazso
[00:49:14] 
[00:49:14] error[E0463]: can't find crate for `myfoo`
[00:49:14]    |
[00:49:14]    |
[00:49:14] LL | use myfoo::Yellow;
[00:49:14] 
[00:49:14] error: aborting due to 2 previous errors
[00:49:14] 
[00:49:14] For more information about this error, try `rustc --explain E0463`.
[00:49:14] For more information about this error, try `rustc --explain E0463`.
[00:49:14] 
[00:49:14] 
[00:49:14] 
[00:49:14] The actual stderr differed from the expected stderr.
[00:49:14] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-53737/issue-53737.stderr
[00:49:14] To update references, rerun the tests and pass the `--bless` flag
[00:49:14] To only update this specific test, also pass `--test-args issue-53737.rs`
[00:49:14] error: 1 errors occurred comparing output.
[00:49:14] status: exit code: 1
[00:49:14] status: exit code: 1
[00:49:14] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-53.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/issue-53737.rs","byte_start":515,"byte_end":520,"line_start":15,"line_end":15,"column_start":5,"column_end":10,"is_primary":true,"text":[{"text":"use myfoo::Yellow;","highlight_start":5,"highlight_end":10}],"label":"can't find crate","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0463]: can't find crate for `myfoo`\n  --> /checkout/src/test/ui/issue-53737.rs:15:5\n   |\nLL | use myfoo::Yellow;\n   |     ^^^^^ can't find crate\n\n"}
[00:49:14] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:49:14] {"message":"For more information about this error, try `rustc --explain E0463`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0463`.\n"}
[00:49:14] ------------------------------------------
[00:49:14] 
[00:49:14] thread '[ui] ui/issue-53737.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3302:9
[00:49:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:49:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:49:14] 
[00:49:14] ---- [ui] ui/rust-2018/use-suggestions-extern-prelude.rs stdout ----
[00:49:14] diff of stderr:
[00:49:14] 
[00:49:14] + error: extern location for netted does not exist: $TEST_BUILD_DIR/rust-2018/use-suggestions-extern-prelude/auxiliary/libep_nested_libso
[00:49:14] + 
[00:49:14] 1 error[E0422]: cannot find struct, variant or union type `Bazz` in this scope
[00:49:14] 3    |
[00:49:14] 
[00:49:14] 
[00:49:14] 4 LL |     let _x = Bazz{};
[00:49:14] - help: possible candidate is found in another module, you can import it into scope
[00:49:14] -    |
[00:49:14] -    |
[00:49:14] - LL | use netted::foo::bar::Bazz;
[00:49:14] 10 
[00:49:14] - error: aborting due to previous error
[00:49:14] + error: aborting due to 2 previous errors
[00:49:14] 12 
[00:49:14] 12 
[00:49:14] 13 For more information about this error, try `rustc --explain E0422`.
[00:49:14] 14 
[00:49:14] 
[00:49:14] 
[00:49:14] The actual stderr differed from the expected stderr.
[00:49:14] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/use-suggestions-extern-prelude.stderr
[00:49:14] To update references, rerun the tests and pass the `--bless` flag
[00:49:14] To only update this specific test, also pass `--test-args rust-2018/use-suggestions-extern-prelude.rs`
[00:49:14] error: 1 errors occurred comparing output.
[00:49:14] status: exit code: 1
[00:49:14] status: exit code: 1
[00:49:14] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rust-2018/use-suggestions-extern-prelude.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/auxiliary" "-A" "unused" "--extern" "netted=/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/auxiliary/libep_nested_libso"
[00:49:14] ------------------------------------------
[00:49:14] 
[00:49:14] ------------------------------------------
[00:49:14] stderr:
[00:49:14] stderr:
[00:49:14] ------------------------------------------
[00:49:14] {"message":"extern location for netted does not exist: /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/auxiliary/libep_nested_libso","code":null,"level":"error","spans":[],"children":[],"rendered":"error: extern location for netted does not exist: /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2018/use-suggestions-extern-prelude/auxiliary/libep_nested_libso\n\n"}
[00:49:14] {"message":"cannot find struct, variant or union type `Bazz` in this scope","code":{"code":"E0422","explanation":"\nYou are trying to use an identifier that is either undefined or not a struct.\nErroneous code example:\n\n```compile_fail,E0422\nfn main () {\n    let x = Foo { x: 1, y: 2 };\n}\n```\n\nIn this case, `Foo` is undefined, so it inherently isn't anything, and\ndefinitely not a struct.\n\n```compile_fail\nfn main () {\n    let foo = 1;\n    let x = foo { x: 1, y: 2 };\n}\n```\n\nIn this case, `foo` is defined, but is not a struct, so Rust can't use it as\none.\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/rust-2018/use-suggestions-extern-prelude.rs","byte_start":546,"byte_end":550,"line_start":15,"line_end":15,"column_start":14,"column_end":18,"is_primary":true,"text":[{"text":"    let _x = Bazz{};","highlight_start":14,"highlight_end":18}],"label":"not found in this scope","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0422]: cannot find struct, variant or union type `Bazz` in this scope\n  --> /checkout/src/test/ui/rust-2018/use-suggestions-extern-prelude.rs:15:14\n   |\nLL |     let _x = Bazz{};\n   |              ^^^^ not found in this scope\n\n"}
[00:49:14] {"message":"aborting due to 2 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 2 previous errors\n\n"}
[00:49:14] {"message":"For more information about this error, try `rustc --explain E0422`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0422`.\n"}
[00:49:14] ------------------------------------------
[00:49:14] 
[00:49:14] thread '[ui] ui/rust-2018/use-suggestions-extern-prelude.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3302:9
[00:49:14] 
---
[00:49:14] 
[00:49:14] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:49:14] 
[00:49:14] 
[00:49:14] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "5.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[00:49:14] 
[00:49:14] 
[00:49:14] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[00:49:14] Build completed unsuccessfully in 0:03:33
[00:49:14] Build completed unsuccessfully in 0:03:33
[00:49:14] make: *** [check] Error 1
[00:49:14] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:079aca76
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:38681b80:start=1539976646286932967,finish=1539976646292447204,duration=5514237
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:056d4494
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!chec

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

qmx added 3 commits October 21, 2018 14:11
this still doesn't have the definitive answer, but at least is a working start
.
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:47:32] .................................................................................................... 1400/4661
[00:47:35] ......................................................................i............................. 1500/4661
[00:47:38] .......................................i............................................................ 1600/4661
[00:47:42] .................................................................................................... 1700/4661
[00:47:45] ...................................F................................................................ 1800/4661
[00:47:52] .................................................................................................... 2000/4661
[00:47:56] .................................................................................................... 2100/4661
[00:48:00] .................................................................................................... 2200/4661
[00:48:04] .................................................................................................... 2300/4661
---
[00:49:24] 
[00:49:24] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:503:22
[00:49:24] 
[00:49:24] 
[00:49:24] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-5.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options " "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "travis_time:start:1b00d4bd

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nikomatsakis
Copy link
Contributor

@TimNN ps this rust-highfive output seems to be excluding anything actionable

@TimNN
Copy link
Contributor

TimNN commented Oct 30, 2018

Ping from triage @qmx: It looks like this PR is failing on travis.


ps this rust-highfive output seems to be excluding anything actionable

Thanks for the notice, sadly I don't have the time to work on the bot right now.

@TimNN
Copy link
Contributor

TimNN commented Nov 6, 2018

Ping from triage @qmx: What is the status of this PR?

@qmx qmx closed this Nov 7, 2018
@qmx
Copy link
Member Author

qmx commented Nov 7, 2018

will reopen when I get around putting more time on it, sorry for the noise!

bors added a commit that referenced this pull request Dec 9, 2019
Add options to --extern flag.

This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.

```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```

`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.

This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
Centril added a commit to Centril/rust that referenced this pull request Dec 11, 2019
Add options to --extern flag.

This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.

```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```

`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.

This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on rust-lang#54020, and can be used in the future to replace and simplify some of the Makefile tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants