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

Refactorings in preparation for const value trees #77227

Merged
merged 26 commits into from
Nov 4, 2020

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 26, 2020

cc #72396

This PR changes the Scalar::Bits { data: u128, size: u8 } variant to Scalar::Bits(ScalarInt) where ScalarInt contains the same information, but is repr(packed). The reason for using a packed struct is to allow enum variant packing to keep the original size of Scalar instead of adding another word to its size due to padding.
Other than that the PR just gets rid of all the inspection of the internal fields of Scalar::Bits which were frankly scary. These fields have invariants that we need to uphold and we can't do that without making the fields private.

r? @ghost

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 26, 2020
@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 26, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Sep 26, 2020

⌛ Trying commit 89f2ad1a114cc01b7a4c62d6d0ebf6f77d21622b with merge 134bd8a017e8ebd9440a86f3e0e8e17c74265fac...

@RalfJung
Copy link
Member

Other than that the PR just gets rid of all the inspection of the internal fields of Scalar::Bits which were frankly scary. These fields have invariants that we need to uphold and we can't do that without making the fields private.

I'm a big fan just for this alone. :) I had started proper encapsulation a year ago or so but gave up when I realized how many things I'd have to change/duplicate. Thanks for pushing it through!

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-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.
   Compiling rand v0.7.3
   Compiling rustc-rayon v0.3.0
   Compiling tempfile v3.1.0
   Compiling rustdoc v0.0.0 (/checkout/src/librustdoc)
error[E0026]: variant `rustc_mir::interpret::Scalar::Raw` does not have a field named `data`
   --> src/librustdoc/clean/utils.rs:501:64
    |
501 |         (ty::ConstKind::Value(ConstValue::Scalar(Scalar::Raw { data, .. })), ty::Uint(ui)) => {
    |                                                                ^^^^ variant `rustc_mir::interpret::Scalar::Raw` does not have this field

error[E0026]: variant `rustc_mir::interpret::Scalar::Raw` does not have a field named `data`
   --> src/librustdoc/clean/utils.rs:504:64
    |
504 |         (ty::ConstKind::Value(ConstValue::Scalar(Scalar::Raw { data, .. })), ty::Int(i)) => {
    |                                                                ^^^^ variant `rustc_mir::interpret::Scalar::Raw` does not have this field
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0026`.
error: could not compile `rustdoc`.
---
== clock drift check ==
  local time: Sat Sep 26 13:50:56 UTC 2020
  network time: Sat, 26 Sep 2020 13:50:57 GMT
== end clock drift check ==
##[error]Process completed with exit code 1.
Terminate orphan process: pid (3931) (python)

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Sep 26, 2020

💔 Test failed - checks-actions

@bors bors 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 26, 2020
@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 26, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Sep 26, 2020

⌛ Trying commit 80ba12b12c3223608dd35bf0f6ab637f4107c397 with merge 29ff7ae431118bb8c870e65f059956edd80d72bd...

@rust-log-analyzer
Copy link
Collaborator

The job dist-x86_64-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.
Documenting stage2 std (x86_64-unknown-linux-gnu)
Uplifting stage1 std (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Copying stage2 std from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
 Documenting core v0.0.0 (/checkout/library/core)
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: InterpErrorInfo { kind: scalar size mismatch: expected 4 bytes but got 8 bytes instead, backtrace: None }', compiler/rustc_middle/src/ty/print/pretty.rs:1019:57

error: internal compiler error: unexpected panic


error: Unrecognized option: 'markdown-css'

error: Could not document `core`.
Caused by:
Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2018 --crate-type lib --crate-name core library/core/src/lib.rs --target x86_64-unknown-linux-gnu -o /checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/doc --error-format=json --json=diagnostic-rendered-ansi --markdown-css rust.css --markdown-no-toc -Z unstable-options --resource-suffix 1.48.0 --index-page /checkout/src/doc/index.md -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/deps -Dwarnings -Winvalid_codeblock_attributes --crate-version '1.48.0-nightly
  (29ff7ae43
  2020-09-26)'` (exit code: 1)


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "rustdoc" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace profiler compiler-builtins-c" "--manifest-path" "/checkout/library/test/Cargo.toml" "-p" "core" "--" "--markdown-css" "rust.css" "--markdown-no-toc" "-Z" "unstable-options" "--resource-suffix" "1.48.0" "--index-page" "/checkout/src/doc/index.md"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap dist --host x86_64-unknown-linux-gnu --target x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:19:38
Build completed unsuccessfully in 0:19:38
== clock drift check ==
  local time: Sat Sep 26 15:00:57 UTC 2020
  network time: Sat, 26 Sep 2020 15:00:57 GMT
== end clock drift check ==
##[error]Process completed with exit code 1.
Terminate orphan process: pid (4977) (python)

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 @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Sep 26, 2020

💔 Test failed - checks-actions

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 26, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Sep 26, 2020

⌛ Trying commit 4a76f0c2e42d903fa47034b0e38409189c4aab56 with merge 048704194617fee95a0d314d059abe90713b565a...

@bors
Copy link
Contributor

bors commented Sep 26, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: 048704194617fee95a0d314d059abe90713b565a (048704194617fee95a0d314d059abe90713b565a)

@rust-timer
Copy link
Collaborator

Queued 048704194617fee95a0d314d059abe90713b565a with parent 6f9a8a7, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (048704194617fee95a0d314d059abe90713b565a): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 27, 2020

I think there's two regressions, one for serializing data, one for check_match, so I'm testing just the first part in #77261

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 28, 2020
…r, r=matthewjasper

Deduplicate and generalize some (de/)serializer impls

I noticed this while implementing rust-lang#77227 and getting a "not implemented for [T; 16]" error. There's likely more things we can deduplicate in this file, but I didn't need any additional changes.
@RalfJung
Copy link
Member

RalfJung commented Nov 4, 2020

after the last nits are fixed, r=me for the Miri and CTFE changes. @bjorn3 can you check the cranelift changes?

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 4, 2020

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Nov 4, 2020

📌 Commit 6e6c8a8 has been approved by RalfJung

@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 Nov 4, 2020
oli-obk and others added 2 commits November 4, 2020 15:12
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: Ralf Jung <post@ralfj.de>
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 4, 2020

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Nov 4, 2020

📌 Commit 332750f has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Nov 4, 2020

⌛ Testing commit 332750f with merge 75f1db1...

@bors
Copy link
Contributor

bors commented Nov 4, 2020

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 75f1db1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 4, 2020
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #77227!

Tested on commit 75f1db1.
Direct link to PR: #77227

💔 miri on windows: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Nov 4, 2020
Tested on commit rust-lang/rust@75f1db1.
Direct link to PR: <rust-lang/rust#77227>

💔 miri on windows: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).
@bors bors merged commit 75f1db1 into rust-lang:master Nov 4, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 4, 2020
camsteffen added a commit to camsteffen/rust-clippy that referenced this pull request Nov 4, 2020
camsteffen added a commit to camsteffen/rust-clippy that referenced this pull request Nov 4, 2020
@oli-obk oli-obk deleted the const_val_🌳_prelude branch March 16, 2021 12:14
@lcnr lcnr added the A-const-generics Area: const generics (parameters and arguments) label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) merged-by-bors This PR was explicitly merged by bors. 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.

None yet