Skip to content

Fix accidental stabilization in feature-detection macros #64534

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

Closed
wants to merge 3 commits into from

Conversation

gnzlbg
Copy link
Contributor

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

r? @alexcrichton

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

@rust-highfive
Copy link
Contributor

⚠️ Warning ⚠️

  • These commits modify submodules.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 17, 2019
@gnzlbg
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
Copy link
Contributor

Centril commented Sep 17, 2019

cc @oli-obk ^---

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

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 changed the title [WIP] Update stdarch Fix accidental stabilization in feature-detection macros Sep 17, 2019
@gnzlbg
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
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
Copy link
Member

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

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

djc commented Sep 17, 2019

cc @gyakovlev

@gnzlbg
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
Copy link
Member

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

@rust-highfive
Copy link
Contributor

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
Copy link
Contributor Author

gnzlbg commented Sep 17, 2019

Could we do a try build ?

@Mark-Simulacrum
Copy link
Member

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

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Sep 17, 2019 via email

@Mark-Simulacrum
Copy link
Member

@bors try

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

@bors
Copy link
Collaborator

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.
@alexcrichton
Copy link
Member

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
Copy link
Collaborator

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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Sep 30, 2019
@joelpalmer joelpalmer 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 Oct 7, 2019
@joelpalmer
Copy link

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

@JohnCSimon
Copy link
Member

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
Copy link
Contributor

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
Copy link
Contributor

Centril commented Oct 26, 2019

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

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Oct 26, 2019
@rfcbot
Copy link
Collaborator

rfcbot commented Oct 26, 2019

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

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Oct 26, 2019
@SimonSapin
Copy link
Contributor

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

@rfcbot
Copy link
Collaborator

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.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 5, 2019
@alexcrichton
Copy link
Member

@gnzlbg want to rebase and I can r+?

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

@JohnCSimon
Copy link
Member

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

Thanks!

@JohnCSimon JohnCSimon 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 Nov 16, 2019
@JohnCSimon
Copy link
Member

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

Thanks!

@JohnCSimon
Copy link
Member

Pinging again from triage:
@gnzlbg - Can you please address the conflict and comment from Alex so this can be merged?
@alexcrichton not sure what else to do with this.

@alexcrichton
Copy link
Member

Well this needs a rebase to get approved, and we need to wait for that to happen. If that doesn't happen we can't merge.

@Dylan-DPC-zz
Copy link

Closing this due to inactivity after a discussion with the author.

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 28, 2019
@djc
Copy link
Contributor

djc commented Nov 28, 2019

Would it help if someone else rebased this? Seems really sad if the effort spent on this goes to waste.

@Dylan-DPC-zz
Copy link

@djc definitely. Though I'd recommend creating a new pull request and picking these changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.