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

Add options to --extern flag. #67074

Merged
merged 2 commits into from
Dec 11, 2019
Merged

Add options to --extern flag. #67074

merged 2 commits into from
Dec 11, 2019

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Dec 6, 2019

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.

--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.

@ehuss
Copy link
Contributor Author

ehuss commented Dec 6, 2019

cc @alexcrichton
There is a companion branch for Cargo at https://github.com/ehuss/cargo/tree/build-std-no-sysroot

@eddyb
Copy link
Member

eddyb commented Dec 6, 2019

cc @petrochenkov

@petrochenkov petrochenkov self-assigned this Dec 6, 2019
@alexcrichton
Copy link
Member

👍

Looks great to me!

That Cargo patch is also 💯

src/tools/compiletest/src/header.rs Show resolved Hide resolved
src/librustc_session/config.rs Outdated Show resolved Hide resolved
src/librustc_session/config.rs Outdated Show resolved Hide resolved
src/librustc_session/config.rs Outdated Show resolved Hide resolved
src/librustc_session/config.rs Outdated Show resolved Hide resolved
src/librustc_session/config.rs Outdated Show resolved Hide resolved
src/librustdoc/core.rs Outdated Show resolved Hide resolved
src/librustc_resolve/lib.rs Outdated Show resolved Hide resolved
src/librustc_resolve/lib.rs Outdated Show resolved Hide resolved
src/librustc_metadata/locator.rs Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

r? @petrochenkov

@petrochenkov petrochenkov added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 6, 2019
@ehuss
Copy link
Contributor Author

ehuss commented Dec 7, 2019

Thanks for taking a look @petrochenkov !

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 8, 2019
@petrochenkov
Copy link
Contributor

r=me with the remaining nit addressed and non-compiletest commits squashed.

@petrochenkov petrochenkov 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 Dec 8, 2019
@ehuss
Copy link
Contributor Author

ehuss commented Dec 9, 2019

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Dec 9, 2019

📌 Commit 60d4e20 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 9, 2019
@bors
Copy link
Contributor

bors commented Dec 9, 2019

⌛ Testing commit 60d4e20 with merge ce0c20a...

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.
@bors
Copy link
Contributor

bors commented Dec 9, 2019

💔 Test failed - checks-azure

@rust-highfive
Copy link
Collaborator

The job x86_64-msvc-cargo of your PR failed (pretty log, 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.
2019-12-09T17:17:32.0443453Z 
2019-12-09T17:17:32.0443781Z 
2019-12-09T17:17:32.0444096Z 
2019-12-09T17:17:32.0444381Z 
2019-12-09T17:17:32.0444747Z --extern noprelude:alloc=/path/to/liballoc.rlib
2019-12-09T17:17:32.0445298Z --extern priv:mylib=/path/to/libmylib.rlib
2019-12-09T17:17:32.0446684Z AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN=true
2019-12-09T17:17:32.0447408Z AGENT_DISABLELOGPLUGIN_TESTRESULTLOGPLUGIN=true
2019-12-09T17:17:32.0447551Z AGENT_HOMEDIRECTORY=C:\agents\2.160.1
2019-12-09T17:17:32.0447641Z AGENT_ID=525
---
2019-12-09T17:17:32.0471322Z TMP=/tmp
2019-12-09T17:17:32.0471391Z TOOLSTATE_ISSUES_API_URL=https://api.github.com/repos/rust-lang/rust/issues
2019-12-09T17:17:32.0471476Z TOOLSTATE_PUBLISH=1
2019-12-09T17:17:32.0471549Z TOOLSTATE_REPO=https://github.com/rust-lang-nursery/rust-toolstate
2019-12-09T17:17:32.0471717Z 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.
2019-12-09T17:17:32.0472192Z 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.
2019-12-09T17:17:32.0472436Z USERDOMAIN=fv-az425
2019-12-09T17:17:32.0472515Z USERDOMAIN_ROAMINGPROFILE=fv-az425
2019-12-09T17:17:32.0472581Z USERNAME=VssAdministrator
2019-12-09T17:17:32.0472661Z USERPROFILE=C:\Users\VssAdministrator
---
2019-12-09T17:17:32.0473251Z WIX=C:\Program Files (x86)\WiX Toolset v3.11\
2019-12-09T17:17:32.0473318Z _=/usr/bin/printenv
2019-12-09T17:17:32.0473393Z ```
2019-12-09T17:17:32.0473460Z ```text
2019-12-09T17:17:32.0473549Z `noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.
2019-12-09T17:17:32.0473698Z 
2019-12-09T17:17:32.0473769Z disk usage:
2019-12-09T17:17:32.1132644Z Filesystem            Size  Used Avail Use% Mounted on
2019-12-09T17:17:32.1143754Z C:/Program Files/Git  256G  141G  116G  55% /
---
2019-12-09T19:41:15.0714238Z test workspaces::ws_warn_unused ... ok
2019-12-09T19:41:15.0716645Z 
2019-12-09T19:41:15.0717566Z failures:
2019-12-09T19:41:15.0718277Z 
2019-12-09T19:41:15.0718650Z ---- registry::bad_cksum stdout ----
2019-12-09T19:41:15.0719034Z running `D:\a\1\s\build\x86_64-pc-windows-msvc\stage2-tools\x86_64-pc-windows-msvc\release\cargo.exe build -v`
2019-12-09T19:41:15.0719394Z thread 'registry::bad_cksum' panicked at '
2019-12-09T19:41:15.0719731Z Expected: execs
2019-12-09T19:41:15.0720041Z     but: differences:
2019-12-09T19:41:15.0720373Z   1 - |[DOWNLOADING] crates ...|
2019-12-09T19:41:15.0720715Z     + |error: process didn't exit successfully: `rustc -vV` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)|
2019-12-09T19:41:15.0721032Z 
2019-12-09T19:41:15.0721494Z   2 - |[DOWNLOADED] bad-cksum [..]|
2019-12-09T19:41:15.0722517Z 
2019-12-09T19:41:15.0722517Z 
2019-12-09T19:41:15.0722701Z   3 - |[ERROR] failed to download replaced source registry `https://[..]`|
2019-12-09T19:41:15.0722832Z 
2019-12-09T19:41:15.0722883Z   4 - ||
2019-12-09T19:41:15.0722956Z     +
2019-12-09T19:41:15.0722986Z 
2019-12-09T19:41:15.0722986Z 
2019-12-09T19:41:15.0723060Z   5 - |Caused by:|
2019-12-09T19:41:15.0723186Z 
2019-12-09T19:41:15.0723186Z 
2019-12-09T19:41:15.0723284Z   6 - |  failed to verify the checksum of `bad-cksum v0.0.1 (registry `D:/a/1/s/build/x86_64-pc-windows-msvc/stage2-tools/x86_64-pc-windows-msvc/cit/t1236[..]`)`|
2019-12-09T19:41:15.0723435Z 
2019-12-09T19:41:15.0723465Z 
2019-12-09T19:41:15.0723537Z other output:
2019-12-09T19:41:15.0723628Z ``', src\tools\cargo\crates\cargo-test-support\src\lib.rs:849:13
---
2019-12-09T19:41:15.3352615Z   local time: Mon Dec  9 19:41:15 CUT 2019
2019-12-09T19:41:15.7086160Z   network time: Mon, 09 Dec 2019 19:41:15 GMT
2019-12-09T19:41:15.7104106Z == end clock drift check ==
2019-12-09T19:41:15.7944607Z 
2019-12-09T19:41:16.1571651Z ##[error]Bash exited with code '1'.
2019-12-09T19:41:16.2288237Z ##[section]Starting: Checkout
2019-12-09T19:41:16.2866552Z ==============================================================================
2019-12-09T19:41:16.2866680Z Task         : Get sources
2019-12-09T19:41:16.2866766Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 9, 2019
@petrochenkov
Copy link
Contributor

@ehuss

|[ERROR] failed to download replaced source registry https://[..]|

I guess you know better whether it's spurious or not.

@petrochenkov petrochenkov 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 Dec 9, 2019
@ehuss
Copy link
Contributor Author

ehuss commented Dec 9, 2019

@bors retry
STATUS_ACCESS_VIOLATION on x86_64-msvc-cargo while running rustc -Vv on one of Cargo's tests (I don't think it is related to Cargo). Seems very unlikely to be related to this PR, I'm going to blame it on gremlins.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 9, 2019
@bors
Copy link
Contributor

bors commented Dec 10, 2019

⌛ Testing commit 60d4e20 with merge e574b81e5a06188176f2ec1696ad484f9dfccdf3...

@rust-highfive
Copy link
Collaborator

The job dist-powerpc64-linux of your PR failed (pretty log, 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.

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)

@bors
Copy link
Contributor

bors commented Dec 10, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 10, 2019
@ehuss
Copy link
Contributor Author

ehuss commented Dec 10, 2019

@bors retry
failed to get 200 response from https://crates.io/api/v1/crates/rustc-ap-rustc_errors/606.0.0/download, got 502

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 10, 2019
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.
bors added a commit that referenced this pull request Dec 11, 2019
Rollup of 6 pull requests

Successful merges:

 - #66881 (Optimize Ord trait implementation for bool)
 - #67015 (Fix constant propagation for scalar pairs)
 - #67074 (Add options to --extern flag.)
 - #67164 (Ensure that panicking in constants eventually errors)
 - #67174 (Remove `checked_add` in `Layout::repeat`)
 - #67205 (Make `publish_toolstate.sh` executable)

Failed merges:

r? @ghost
@bors bors merged commit 60d4e20 into rust-lang:master Dec 11, 2019
bors added a commit to rust-lang/cargo that referenced this pull request Dec 12, 2019
Switch build-std to use --extern

Switch `build-std` to use `--extern` flags instead of `--sysroot`.

This is mostly a revert of #7421. It uses the new extern flag options introduced in rust-lang/rust#67074. It avoids modifying the extern prelude which was the source of the problem of rust-lang/wg-cargo-std-aware#40.

Closes rust-lang/wg-cargo-std-aware#49
Reopens rust-lang/wg-cargo-std-aware#31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants