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

Fix accidental stabilization in feature-detection macros #64534

Open
wants to merge 3 commits into
base: master
from

Conversation

@gnzlbg
Copy link
Contributor

gnzlbg commented Sep 17, 2019

This commit updates stdarch and fix the accidental stabilization
of unstable target-features in the stable is_x86_feature_detected
macros.

For example, the "mmx" feature is unstable, but
is_x86_feature_detected!("mmx") works on stable Rust.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Sep 17, 2019

r? @alexcrichton

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

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Sep 17, 2019

⚠️ Warning ⚠️

  • These commits modify submodules.
@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

The is_x86_target_feature_detected! macro is apparently able to perform an #[unstable] API call without enabling appropriate features, while calling the function directly does indeed fail.

Is this a bug in the staged_api ?

@gnzlbg gnzlbg closed this Sep 17, 2019
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Sep 17, 2019

cc @oli-obk ^---

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

I've pushed a couple of changes to stdarch that might fix that, but I'm not sure. There is quite a bit of a dance to be able to use the staged_api from within the macro.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Sep 17, 2019

The job x86_64-gnu-llvm-6.0 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-09-17T00:40:57.0877400Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-17T00:40:57.1082560Z ##[command]git config gc.auto 0
2019-09-17T00:40:57.1165378Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-17T00:40:57.1198368Z ##[command]git config --get-all http.proxy
2019-09-17T00:40:57.8409896Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64534/merge:refs/remotes/pull/64534/merge
---
2019-09-17T00:47:55.3443163Z    Compiling serde_json v1.0.40
2019-09-17T00:47:57.2211472Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-09-17T00:48:08.2323988Z     Finished release [optimized] target(s) in 1m 30s
2019-09-17T00:48:08.2401936Z tidy check
2019-09-17T00:48:09.1636013Z tidy error: /checkout/src/test/ui/stdarch/is_x86_feature_detected-gate.rs: leading newline
2019-09-17T00:48:10.4997865Z some tidy checks failed
2019-09-17T00:48:10.5018233Z 
2019-09-17T00:48:10.5018233Z 
2019-09-17T00:48:10.5019163Z 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"
2019-09-17T00:48:10.5019483Z 
2019-09-17T00:48:10.5019618Z 
2019-09-17T00:48:10.5030403Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-09-17T00:48:10.5030730Z Build completed unsuccessfully in 0:01:34
2019-09-17T00:48:10.5030730Z Build completed unsuccessfully in 0:01:34
2019-09-17T00:48:10.5081477Z == clock drift check ==
2019-09-17T00:48:10.5099209Z   local time: Tue Sep 17 00:48:10 UTC 2019
2019-09-17T00:48:10.6628983Z   network time: Tue, 17 Sep 2019 00:48:10 GMT
2019-09-17T00:48:10.6630736Z == end clock drift check ==
2019-09-17T00:48:11.9506749Z ##[error]Bash exited with code '1'.
2019-09-17T00:48:11.9546176Z ##[section]Starting: Checkout
2019-09-17T00:48:11.9547937Z ==============================================================================
2019-09-17T00:48:11.9548008Z Task         : Get sources
2019-09-17T00:48:11.9548052Z 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)

@gnzlbg gnzlbg reopened this Sep 17, 2019
This commit updates stdarch and fix the accidental stabilization
of unstable target-features in the stable is_x86_feature_detected
macros.

For example, the "mmx" feature is unstable, but
is_x86_feature_detected!("mmx") works on stable Rust.
@gnzlbg gnzlbg force-pushed the gnzlbg:uarch branch from e7f3227 to e106120 Sep 17, 2019
@gnzlbg gnzlbg changed the title [WIP] Update stdarch Fix accidental stabilization in feature-detection macros Sep 17, 2019
@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

I think I finally got this to work.

I'm not sure how to generate the error messages for the ui tests on some of the targets, but I suppose that those building Rust for those targets might be able to commit those once they run into them.

FWIW, having to ignore all targets for which a test does not run, as opposed os specifying for which targets a test must run, is horrible. Every time we add a new target all these tests will probably break.

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

^^^ pinging rust packagers that might be able to help producing those in some of the missing targets: @cuviper @djc @infinity0 (there should be a rust-lang/packagers team to make pinging packagers easy - @skade).

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Sep 17, 2019

I believe we added an only-linux or so for precisely that reason and compiletest does support it

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

I believe we added an only-linux or so for precisely that reason and compiletest does support it

Sadly that doesn't work with multiple only-, e.g.,

// only-x86_64
// only-x86

will run on x86_64 but not on x86 :/

@djc

This comment has been minimized.

Copy link
Contributor

djc commented Sep 17, 2019

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

@Mark-Simulacrum

I extended the only-... patterns of compiletest to support | as an OR operator. So that you can write, e.g., only-powerpc64|powerpc64le and that matches if either powerpc64 or powerpc64le matches the target.

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Sep 17, 2019

That commit looks reasonable but it's hard for me to be entirely confident.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Sep 17, 2019

The job x86_64-gnu-llvm-6.0 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-09-17T11:57:17.6056770Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-17T11:57:18.2542503Z ##[command]git config gc.auto 0
2019-09-17T11:57:18.2547937Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-17T11:57:18.2555514Z ##[command]git config --get-all http.proxy
2019-09-17T11:57:18.2559809Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64534/merge:refs/remotes/pull/64534/merge
---
2019-09-17T13:02:48.3831055Z .................................................................................................... 1500/9077
2019-09-17T13:02:53.8842723Z .................................................................................................... 1600/9077
2019-09-17T13:03:06.9445282Z ...............................................................i...............i.................... 1700/9077
2019-09-17T13:03:14.6092741Z .................................................................................................... 1800/9077
2019-09-17T13:03:30.9492379Z ......................................................iiiii......................................... 1900/9077
2019-09-17T13:03:42.8298644Z .................................................................................................... 2100/9077
2019-09-17T13:03:45.5851304Z .................................................................................................... 2200/9077
2019-09-17T13:03:49.1726379Z .................................................................................................... 2300/9077
2019-09-17T13:03:58.0279369Z .................................................................................................... 2400/9077
---
2019-09-17T13:07:08.0719303Z ...........................................i...............i........................................ 4700/9077
2019-09-17T13:07:19.5316910Z .................................................................................................... 4800/9077
2019-09-17T13:07:27.0170110Z .................................................................................................... 4900/9077
2019-09-17T13:07:37.6266206Z .................................................................................................... 5000/9077
2019-09-17T13:07:45.8903565Z ...........................ii.ii.................................................................... 5100/9077
2019-09-17T13:07:56.5041115Z .................................................................................................... 5300/9077
2019-09-17T13:08:07.5704168Z ...........................................................................................i........ 5400/9077
2019-09-17T13:08:16.2513877Z .................................................................................................... 5500/9077
2019-09-17T13:08:21.3060296Z .................................................................................................... 5600/9077
2019-09-17T13:08:21.3060296Z .................................................................................................... 5600/9077
2019-09-17T13:08:32.4772718Z ......................................................................................ii...i..ii.... 5700/9077
2019-09-17T13:08:59.7080189Z .................................................................................................... 5900/9077
2019-09-17T13:09:10.9475453Z .................................................................................................... 6000/9077
2019-09-17T13:09:10.9475453Z .................................................................................................... 6000/9077
2019-09-17T13:09:16.8914365Z ........................................................................................i..ii....... 6100/9077
2019-09-17T13:09:47.4824427Z .................................................................................................... 6300/9077
2019-09-17T13:09:51.4909700Z ...............................................i.................................................... 6400/9077
2019-09-17T13:09:53.8355716Z .................................................................................................... 6500/9077
2019-09-17T13:09:56.4931726Z ...................i................................................................................ 6600/9077
---
2019-09-17T13:11:12.8987613Z .................................................................................................... 7400/9077
2019-09-17T13:11:21.3683718Z .................................................................................................... 7500/9077
2019-09-17T13:11:32.9344083Z .......................................................................ii......i.................... 7600/9077
2019-09-17T13:11:37.4897220Z .................................................................................................... 7700/9077
2019-09-17T13:11:44.8121581Z .............................................................................................iiiiiii 7800/9077
2019-09-17T13:11:55.5444050Z iiiiiiiiiiiiiiiiiiiiiiiiiiiii....................................................................... 7900/9077
2019-09-17T13:12:16.4712871Z .................................................................................................... 8100/9077
2019-09-17T13:12:58.4815721Z .................................................................................................... 8200/9077
2019-09-17T13:13:07.8895718Z .................................................................................................... 8300/9077
2019-09-17T13:13:15.9616183Z .................................................................................................... 8400/9077
---
2019-09-17T13:14:43.3858794Z  finished in 5.387
2019-09-17T13:14:43.4046770Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:14:43.6095306Z 
2019-09-17T13:14:43.6095473Z running 150 tests
2019-09-17T13:14:47.1129164Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-09-17T13:14:49.5771540Z ..iiii..............i.........iii.i.......ii......
2019-09-17T13:14:49.5772881Z 
2019-09-17T13:14:49.5773782Z  finished in 5.785
2019-09-17T13:14:49.5864070Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:14:49.5864152Z 
---
2019-09-17T13:14:51.6245359Z  finished in 2.413
2019-09-17T13:14:51.6439105Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:14:52.5811954Z 
2019-09-17T13:14:52.5812117Z running 9 tests
2019-09-17T13:14:52.5812974Z iiiiiiiii
2019-09-17T13:14:52.5813361Z 
2019-09-17T13:14:52.5813407Z  finished in 0.170
2019-09-17T13:14:52.5813703Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:14:52.5813759Z 
---
2019-09-17T13:15:11.3264925Z  finished in 19.493
2019-09-17T13:15:11.3478178Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:15:11.5500645Z 
2019-09-17T13:15:11.5501527Z running 123 tests
2019-09-17T13:15:36.5035541Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-17T13:15:41.3342362Z i.i.i......iii.i.....ii
2019-09-17T13:15:41.3345090Z 
2019-09-17T13:15:41.3346431Z  finished in 29.986
2019-09-17T13:15:41.3356636Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:15:41.3357307Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-17T13:30:17.6866294Z 
2019-09-17T13:30:17.6867201Z    Doc-tests core
2019-09-17T13:30:23.1354205Z 
2019-09-17T13:30:23.1355123Z running 2400 tests
2019-09-17T13:30:35.1143878Z ......iiiii......................................................................................... 100/2400
2019-09-17T13:30:46.5971433Z ...........................................................................ii....................... 200/2400
2019-09-17T13:30:59.9256598Z .................................................................................................i.. 300/2400
2019-09-17T13:31:14.0470560Z .................................................................................................... 400/2400
2019-09-17T13:31:25.1496071Z ............................................i..i.................iiii............................... 500/2400
2019-09-17T13:31:47.3022192Z .................................................................................................... 700/2400
2019-09-17T13:31:58.6230838Z .................................................................................................... 800/2400
2019-09-17T13:32:09.9040660Z .................................................................................................... 900/2400
2019-09-17T13:32:21.0391621Z .................................................................................................... 1000/2400
---
2019-09-17T13:35:09.5159098Z 
2019-09-17T13:35:09.5229905Z  finished in 3.920
2019-09-17T13:35:09.5231093Z Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-17T13:35:09.7535918Z    Compiling std v0.0.0 (/checkout/src/libstd)
2019-09-17T13:35:09.8054505Z error[E0658]: use of unstable library feature 'stdsimd'
2019-09-17T13:35:09.8054948Z   --> <::std::std_detect::detect::arch::is_x86_feature_detected macros>:6:6
2019-09-17T13:35:09.8055180Z    |
2019-09-17T13:35:09.8055684Z 1  | / ("aes") => { $crate :: detect :: __is_feature_detected :: aes () } ;
2019-09-17T13:35:09.8056055Z 2  | | ("pclmulqdq") => { $crate :: detect :: __is_feature_detected :: pclmulqdq () }
2019-09-17T13:35:09.8056424Z 3  | | ; ("rdrand") => { $crate :: detect :: __is_feature_detected :: rdrand () } ;
2019-09-17T13:35:09.8056784Z 4  | | ("rdseed") => { $crate :: detect :: __is_feature_detected :: rdseed () } ;
2019-09-17T13:35:09.8057132Z 5  | | ("tsc") => { $crate :: detect :: __is_feature_detected :: tsc () } ; ("mmx")
2019-09-17T13:35:09.8057483Z 6  | | => { $crate :: detect :: __is_feature_detected :: mmx () } ; ("sse") =>
2019-09-17T13:35:09.8058030Z ...  |
2019-09-17T13:35:09.8058030Z ...  |
2019-09-17T13:35:09.8058353Z 50 | |       (" target feature: ", $ t)))
2019-09-17T13:35:09.8058627Z 51 | | } ;
2019-09-17T13:35:09.8059201Z    | |___- in this expansion of `is_x86_feature_detected!`
2019-09-17T13:35:09.8059688Z   ::: src/libstd/tests/run-time-detect.rs:64:27
2019-09-17T13:35:09.8059889Z    |
2019-09-17T13:35:09.8059889Z    |
2019-09-17T13:35:09.8060714Z 64 |       println!("mmx: {:?}", is_x86_feature_detected!("mmx"));
2019-09-17T13:35:09.8061520Z    |
2019-09-17T13:35:09.8061520Z    |
2019-09-17T13:35:09.8061975Z    = note: for more information, see ***/issues/27731
2019-09-17T13:35:09.8068674Z    = help: add `#![feature(stdsimd)]` to the crate attributes to enable
2019-09-17T13:35:09.8528207Z error: aborting due to previous error
2019-09-17T13:35:09.8528301Z 
2019-09-17T13:35:09.8535243Z For more information about this error, try `rustc --explain E0658`.
2019-09-17T13:35:09.8613347Z error: Could not compile `std`.
---
2019-09-17T13:37:22.3148226Z == clock drift check ==
2019-09-17T13:37:22.3170367Z   local time: Tue Sep 17 13:37:22 UTC 2019
2019-09-17T13:37:22.4666332Z   network time: Tue, 17 Sep 2019 13:37:22 GMT
2019-09-17T13:37:22.4672841Z == end clock drift check ==
2019-09-17T13:37:23.0561171Z ##[error]Bash exited with code '1'.
2019-09-17T13:37:23.0656979Z ##[section]Starting: Checkout
2019-09-17T13:37:23.0659199Z ==============================================================================
2019-09-17T13:37:23.0659271Z Task         : Get sources
2019-09-17T13:37:23.0659332Z 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)

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

Could we do a try build ?

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Sep 17, 2019

What for? try won't test anything that isn't already tested by PR CI I think? Unless you want to run crater?

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Sep 17, 2019

@bors try

Okay, let's kick this off. Crater queue is quite long these days though.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 17, 2019

⌛️ Trying commit 256cd36 with merge 951c8ac...

bors added a commit that referenced this pull request Sep 17, 2019
Fix accidental stabilization in feature-detection macros

This commit updates stdarch and fix the accidental stabilization
of unstable target-features in the stable is_x86_feature_detected
macros.

For example, the "mmx" feature is unstable, but
is_x86_feature_detected!("mmx") works on stable Rust.
@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 23, 2019

This is probably in the @rust-lang/libs ballpark. FWIW if the team thinks this doesn't need a crater run, then I'm fine with merging this as is. I just don't know if there is any stable Rust code using these.

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Sep 23, 2019

What version first had this on the stable channel?

@gnzlbg

This comment has been minimized.

Copy link
Contributor Author

gnzlbg commented Sep 23, 2019

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 23, 2019

I personally feel like this is one that's going to be difficult to run through crater and get a real sense of breakage, so I'd be fine landing this and then we can back it out if necessary.

@joelpalmer

This comment has been minimized.

Copy link

joelpalmer commented Sep 30, 2019

Ping from Triage: This appears to have been reviewed. I am setting the label to waiting on author and @gnzlbg and @rust-lang/libs can take the next step towards landing it.

@alexcrichton alexcrichton added the T-libs label Sep 30, 2019
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 30, 2019

We are in theory waiting for crater but I think I agree that it's probably not needed. I'd like to ask others though!

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Sep 30, 2019

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@joelpalmer

This comment has been minimized.

Copy link

joelpalmer commented Oct 14, 2019

Ping from Triage: Looks like one more review is needed here @sfackler @Amanieu @Kimundi @SimonSapin

@JohnCSimon

This comment has been minimized.

Copy link
Member

JohnCSimon commented Oct 26, 2019

Ping from Triage: Looks like one more review is needed here @sfackler @Kimundi @SimonSapin
@gnzlbg this also has a merge conflict
cc: @alexcrichton

Thanks

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Oct 26, 2019

I feel that I’m really not familiar enough with this feature to have an informed opinion on this and 1.27.0 seems like a long time ago, but I’ll defer to Alex’s judgment in #64534 (comment)

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 26, 2019

@SimonSapin rfcbot is a bit dumb sometimes, you might want to try @rfcbot reviewed

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Oct 26, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Oct 26, 2019

(I had clicked the checkbox, it’s also a bit slow sometimes.)

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Nov 5, 2019

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Nov 5, 2019

@gnzlbg want to rebase and I can r+?

Or does the merge conflict here mean that master already contains this change?

@JohnCSimon

This comment has been minimized.

Copy link
Member

JohnCSimon commented Nov 9, 2019

Pinging from triage:
@gnzlbg - Can you please address the conflict and comment from @alexcrichton so this can be merged?

Thanks!

@JohnCSimon

This comment has been minimized.

Copy link
Member

JohnCSimon commented Nov 16, 2019

Pinging again from triage:
@gnzlbg - Can you please address the conflict and comment from @alexcrichton so this can be merged?
CC: @Centril @SimonSapin

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.