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

Rollup of 8 pull requests #66417

Closed
wants to merge 28 commits into from
Closed

Conversation

tmandry
Copy link
Member

@tmandry tmandry commented Nov 14, 2019

Successful merges:

Failed merges:

r? @ghost

haraldh and others added 28 commits October 22, 2019 16:52
Rename
* Error::iter_chain() -> Error::chain()
* ErrorIter -> Chain

Removed
* Error::iter_sources()

according to
rust-lang#58520

Rationale:

   1. Such iterators are helpful. They should better be stabilized sooner
      than later.
   2. self should be included. It is easy to .skip(1) it.
      Not including self is harmful because it is harder to add self
      to the iterator than to remove it.
   3. The chosen name should be telling and reflect the fact that self is
      included. `.chain()` was chosen because the iterator iterates over
      the chain of errors that is somehow included in self.
   4. The resulting iterator is named `Chain` because the `error::Chain`
      is what we want to have.
The `Context` argument is currently smuggled through TLS for
async-generated futures. The current infrastructure is closure-based,
and results in an extra 6 stack frames when .awaiting an async-generated
future!

```
  12: foo::async_b::{{closure}}
             at src/main.rs:10
  13: <std::future::GenFuture<T> as core::future::future::Future>::poll::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  14: std::future::set_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:79
  15: <std::future::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  16: std::future::poll_with_tls_context::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  17: std::future::get_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:111
  18: std::future::poll_with_tls_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  19: foo::async_a::{{closure}}
             at src/main.rs:6
```

While the long (medium?) term solution is to remove the use of TLS
entirely, we can improve things a bit in the meantime. In particular,
this commit does 2 things:

1. `get_task_context` has been inlined into `poll_with_tls_context`,
    removing 2 frames (16 and 17 above).
2. `set_task_context` now returns a guard type that resets the TLS
    rather than taking a closure, removing 2 frames (13 and 14 above).

We can also remove frame 18 by removing `poll_with_tls_context` in favor
of a `get_task_context` function which returns a guard, but that
requires adjusting the code generated for .await, so I've left that off
for now.
rename Error::iter_chain() and remove Error::iter_sources()

~~Rename~~
* ~~Error::iter_chain() -> Error::chained()~~
* ~~Error::iter_sources() -> Error::ancestors()~~
* ~~ErrorIter -> Chained and Ancestors~~

according to
rust-lang#58520 (comment)

Tracker:
rust-lang#58520

Edit:

Rename
* Error::iter_chain() -> Error::chained()
* ErrorIter -> Chain

So, it seems, that even Path::ancestors() includes itself. So, to avoid confusion and simplify it more, I reduced PR  rust-lang#65557 to only have `chained` and `Chain`.

Rationale:

   1. Such iterators are helpful. They should better be stabilized sooner than later.
   1. self should be included. It is easy to .skip(1) it.  Not including self is harmful because it is harder to add self to the iterator than to remove it.
   1. The chosen name should be telling and reflect the fact that self is included. `.chained()` was chosen in honor of error-chain and because the iterator iterates over the chain of errors that is somehow included in self.
   1. The resulting iterator is named `Chain` because the `error::Chain` is what we want to have.
Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering

We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per rust-lang/rfcs#2515, this needs to change to allow `impl Trait` in nested positions.  This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported.

r? @varkor
…miri, r=oli-obk

Remove cannot mutate statics in initializer of another static error

r? @oli-obk

This is just a refactoring. As the removed code itself said, it only a heuristic catching a few cases early instead of leaving it all to const eval. It's easy to work around the static check and then run into the miri-engine check.
Update mdbook.

This brings in some important updates to fix some rendering issues in the books. In particular fixing hidden lines in code blocks, and some escaping issues.  More details at https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md

This also requires updating mdbook-linkcheck.
Make a test compatible across python versions.

Progress on rust-lang#65063

This PR allows this test to work on both python2 and python3, and it also allows `./x.py test` to fully complete on my system without python2 installed at all.
Remove some stack frames from `.async` calls

The `Context` argument is currently smuggled through TLS for
async-generated futures. The current infrastructure is closure-based,
and results in an extra 6 stack frames when .awaiting an async-generated
future!

```
  12: foo::async_b::{{closure}}
             at src/main.rs:10
  13: <std::future::GenFuture<T> as core::future::future::Future>::poll::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  14: std::future::set_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:79
  15: <std::future::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:43
  16: std::future::poll_with_tls_context::{{closure}}
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  17: std::future::get_task_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:111
  18: std::future::poll_with_tls_context
             at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/future.rs:121
  19: foo::async_a::{{closure}}
             at src/main.rs:6
```

While the long (medium?) term solution is to remove the use of TLS
entirely, we can improve things a bit in the meantime. In particular,
this commit does 2 things:

1. `get_task_context` has been inlined into `poll_with_tls_context`,
    removing 2 frames (16 and 17 above).
2. `set_task_context` now returns a guard type that resets the TLS
    rather than taking a closure, removing 2 frames (13 and 14 above).

We can also remove frame 18 by removing `poll_with_tls_context` in favor
of a `get_task_context` function which returns a guard, but that
requires adjusting the code generated for .await, so I've left that off
for now.
miri: helper methods for max values of machine's usize/isize

We recently wanted this in Miri.

r? @oli-obk
@tmandry
Copy link
Member Author

tmandry commented Nov 14, 2019

@bors r+ p=8 rollup=never

@bors
Copy link
Contributor

bors commented Nov 14, 2019

📌 Commit e3bbc0d has been approved by tmandry

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 14, 2019
@bors
Copy link
Contributor

bors commented Nov 14, 2019

⌛ Testing commit e3bbc0d with merge d82770e98a6d964787e562157d173ced73d22b5b...

@tmandry tmandry added the rollup A PR which is a rollup label Nov 14, 2019
@rust-highfive
Copy link
Collaborator

The job i686-apple 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-11-14T18:50:12.1037510Z ---- [ui] ui/consts/issue-66342.rs stdout ----
2019-11-14T18:50:12.1037680Z 
2019-11-14T18:50:12.1038470Z error: test compilation failed although it shouldn't!
2019-11-14T18:50:12.1038640Z status: exit code: 1
2019-11-14T18:50:12.1040140Z command: "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage2/bin/rustc" "/Users/runner/runners/2.160.0/work/1/s/src/test/ui/consts/issue-66342.rs" "-Zthreads=1" "--target=i686-apple-darwin" "--error-format" "json" "-Zui-testing" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/test/ui/consts/issue-66342" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "-L" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/test/ui/consts/issue-66342/auxiliary" "-A" "unused"
2019-11-14T18:50:12.1041180Z ------------------------------------------
2019-11-14T18:50:12.1041250Z 
2019-11-14T18:50:12.1041880Z ------------------------------------------
2019-11-14T18:50:12.1041980Z stderr:
2019-11-14T18:50:12.1041980Z stderr:
2019-11-14T18:50:12.1042860Z ------------------------------------------
2019-11-14T18:50:12.1043010Z error[E0080]: evaluation of constant value failed
2019-11-14T18:50:12.1043770Z   --> /Users/runner/runners/2.160.0/work/1/s/src/test/ui/consts/issue-66342.rs:5:18
2019-11-14T18:50:12.1043920Z    |
2019-11-14T18:50:12.1044570Z LL | fn foo() -> [u8; 4 * 1024 * 1024 * 1024 * 1024] {
2019-11-14T18:50:12.1044720Z    |                  ^^^^^^^^^^^^^^^^^^^^^^ attempt to multiply with overflow
2019-11-14T18:50:12.1044870Z error: aborting due to previous error
2019-11-14T18:50:12.1044920Z 
2019-11-14T18:50:12.1045570Z For more information about this error, try `rustc --explain E0080`.
2019-11-14T18:50:12.1045680Z 
2019-11-14T18:50:12.1045680Z 
2019-11-14T18:50:12.1046440Z ------------------------------------------
2019-11-14T18:50:12.1046530Z 
2019-11-14T18:50:12.1046580Z 
2019-11-14T18:50:12.1047230Z ---- [ui] ui/consts/issue-66397.rs stdout ----
2019-11-14T18:50:12.1047310Z 
2019-11-14T18:50:12.1047940Z error: test compilation failed although it shouldn't!
2019-11-14T18:50:12.1048090Z status: exit code: 1
2019-11-14T18:50:12.1049560Z command: "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage2/bin/rustc" "/Users/runner/runners/2.160.0/work/1/s/src/test/ui/consts/issue-66397.rs" "-Zthreads=1" "--target=i686-apple-darwin" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/test/ui/consts/issue-66397" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "-L" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/test/ui/consts/issue-66397/auxiliary" "-A" "unused"
2019-11-14T18:50:12.1050880Z ------------------------------------------
2019-11-14T18:50:12.1050980Z 
2019-11-14T18:50:12.1051610Z ------------------------------------------
2019-11-14T18:50:12.1051730Z stderr:
2019-11-14T18:50:12.1051730Z stderr:
2019-11-14T18:50:12.1052370Z ------------------------------------------
2019-11-14T18:50:12.1052510Z error[E0080]: evaluation of constant value failed
2019-11-14T18:50:12.1053210Z   --> /Users/runner/runners/2.160.0/work/1/s/src/test/ui/consts/issue-66397.rs:6:9
2019-11-14T18:50:12.1053360Z    |
2019-11-14T18:50:12.1053450Z LL |     [0; 4 * 1024 * 1024 * 1024 * 1024];
2019-11-14T18:50:12.1053560Z    |         ^^^^^^^^^^^^^^^^^^^^^^ attempt to multiply with overflow
2019-11-14T18:50:12.1053710Z error: aborting due to previous error
2019-11-14T18:50:12.1053760Z 
2019-11-14T18:50:12.1054450Z For more information about this error, try `rustc --explain E0080`.
2019-11-14T18:50:12.1054540Z 
---
2019-11-14T18:50:12.1143260Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-14T18:50:12.1143500Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-14T18:50:12.1160830Z 
2019-11-14T18:50:12.1161150Z 
2019-11-14T18:50:12.1165070Z command did not execute successfully: "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage0-tools-bin/compiletest" "--compile-lib-path" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage2/lib" "--run-lib-path" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage2/lib/rustlib/i686-apple-darwin/lib" "--rustc-path" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/stage2/bin/rustc" "--src-base" "/Users/runner/runners/2.160.0/work/1/s/src/test/ui" "--build-base" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/test/ui" "--stage-id" "stage2-i686-apple-darwin" "--mode" "ui" "--target" "i686-apple-darwin" "--host" "i686-apple-darwin" "--llvm-filecheck" "/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/llvm/build/bin/FileCheck" "--nodejs" "/usr/local/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/Users/runner/runners/2.160.0/work/1/s/build/i686-apple-darwin/native/rust-test-helpers" "--docck-python" "/usr/local/bin/python2.7" "--lldb-python" "/usr/bin/python" "--lldb-version" "lldb-902.0.79.2\n  Swift-4.1\n" "--lldb-python-dir" "/Applications/Xcode_9.3.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" "--llvm-version" "9.0.0-rust-1.41.0-dev\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-11-14T18:50:12.1166170Z 
2019-11-14T18:50:12.1166230Z 
2019-11-14T18:50:12.1176780Z failed to run: /Users/runner/runners/2.160.0/work/1/s/build/bootstrap/debug/bootstrap test
2019-11-14T18:50:12.1177210Z Build completed unsuccessfully in 0:59:52
2019-11-14T18:50:12.1177210Z Build completed unsuccessfully in 0:59:52
2019-11-14T18:50:12.1251040Z == clock drift check ==
2019-11-14T18:50:12.1303190Z   local time: Thu Nov 14 18:50:12 UTC 2019
2019-11-14T18:50:12.2147450Z   network time: Thu, 14 Nov 2019 18:50:12 GMT
2019-11-14T18:50:12.2149900Z == end clock drift check ==
2019-11-14T18:50:12.2196910Z 
2019-11-14T18:50:12.2327770Z ##[error]Bash exited with code '1'.
2019-11-14T18:50:12.2373590Z ##[section]Starting: Checkout
2019-11-14T18:50:12.2376830Z ==============================================================================
2019-11-14T18:50:12.2376970Z Task         : Get sources
2019-11-14T18:50:12.2377060Z 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
Copy link
Contributor

bors commented Nov 14, 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 Nov 14, 2019
@kennytm
Copy link
Member

kennytm commented Nov 14, 2019

@bors r-

Broken by #66417 (comment)

@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 Nov 14, 2019
@kennytm kennytm closed this Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup 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.