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 9 pull requests #98455

Closed
wants to merge 34 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joboet and others added 30 commits May 18, 2022 12:18
rust-lang#91318 introduced a trait for infallible folders distinct from the fallible version.  For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible.  Moreover the `Error` associated type was defined on the infallible trait!  It's so absurd that it has me questioning whether I was entirely sane.

This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation).  This of course makes much more sense!  It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs.

There is one downside however: folders expose a `tcx` accessor method.  Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate.  Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate.  If desired, I can submit that as a separate PR.

r? @jackh726
Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
Co-authored-by: Wesley Wiser <[email protected]>
Add a test for issue rust-lang#33172

Adds a test confirming that rust-lang#33172 has been fixed.

CDB has some surprising results as it looks like the supposedly unmangled static's symbol name is prefixed when it shouldn't be.

r? `@wesleywiser`

Closes rust-lang#33172
std: use an event-flag-based thread parker on SOLID

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see rust-lang#93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used, which, after rust-lang#96393, are SOLID, SGX and Hermit (more PRs coming soon).

SOLID, conforming to the [μITRON specification](http://www.ertl.jp/ITRON/SPEC/FILE/mitron-400e.pdf), has event flags, which are a thread parking primitive very similar to `Parker`. However, they do not make any atomic ordering guarantees (even though those can probably be assumed) and necessitate a system call even when the thread token is already available. Hence, this `Parker`, like the Windows parker, uses an extra atomic state variable.

I future-proofed the code by wrapping the event flag in a `WaitFlag` structure, as both SGX and Hermit can share the Parker implementation, they just have slightly different primitives (SGX uses signals and Hermit has a thread blocking API (which is unfortunately [broken](hermit-os/kernel#442), I think).

``@kawadakk`` I assume you are the target maintainer? Could you test this for me?
…vulnerability, r=cuviper

Mitigate MMIO stale data vulnerability

Intel publicly disclosed the MMIO stale data vulnerability on June 14. To mitigate this vulnerability, compiler changes are required for the `x86_64-fortanix-unknown-sgx` target.
cc: `@jethrogb`
Pull Derefer before ElaborateDrops

_Follow up work to rust-lang#97025 rust-lang#96549 rust-lang#96116 rust-lang#95887 #95649_

This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.

r? `@oli-obk`
…nkov

Set relocation_model to Pic on emscripten target

So we can support dynamically linking libraries with Emscripten (otherwise we need to use nightly and `-Zbuild-std` to rebuild std with relocations).
`@sbc100`
Support setting file accessed/modified timestamps

Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
…notriddle

Transform help popup into a pocket menu

Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup.

You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot:

![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png)

r? `@jsha`
…jackh726

Reverse folder hierarchy

rust-lang#91318 introduced a trait for infallible folders distinct from the fallible version.  For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible.  Moreover the `Error` associated type was defined on the infallible trait!  It's so absurd that it has me questioning whether I was entirely sane.

This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation).  This of course makes much more sense!  It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs.

There is one downside however: folders expose a `tcx` accessor method.  Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate.  Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate.  If desired, I can submit that as a separate PR.

r? `@jackh726`
[RFC 2011] Optimize non-consuming operators

Tracking issue: rust-lang#44838
Fifth step of rust-lang#96496

The most non-invasive approach that will probably have very little to no performance impact.

## Current behaviour

Captures are handled "on-the-fly", i.e., they are performed in the same place expressions are located.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !(
  { ***try capture `a` and then return `a`*** } > 1 && { ***try capture `b` and then return `b`*** } < 100
) {
  panic!( ... );
}
```

As such, some overhead is likely to occur (Specially with very large chains of conditions).

## New behaviour for non-consuming operators

When an operator is known to not take `self`, then it is possible to capture variables **AFTER** the condition.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !( a > 1 && b < 100 ) {
  { ***try capture `a`*** }
  { ***try capture `b`*** }
  panic!( ... );
}
```

So the possible impact on the runtime execution time will be diminished.

r? ``@oli-obk``
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jun 24, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jun 24, 2022

📌 Commit 68c94cd has been approved by Dylan-DPC

@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 Jun 24, 2022
@bors
Copy link
Contributor

bors commented Jun 24, 2022

⌛ Testing commit 68c94cd with merge 9140d15a5af4cfc8ab887073a95b1cbf1804f0a4...

@rust-log-analyzer
Copy link
Collaborator

The job dist-various-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

error[E0308]: mismatched types
   --> library/std/src/sys/wasi/fs.rs:123:25
    |
123 |         self.accessed = t.to_wasi_timestamp_or_panic();
    |         -------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found `u64`
    |         expected due to the type of this binding
    |
    = note: expected enum `Option<u64>`
               found type `u64`
               found type `u64`
help: try wrapping the expression in `core::prelude::v1::Some`
    |
123 |         self.accessed = core::prelude::v1::Some(t.to_wasi_timestamp_or_panic());

error[E0308]: mismatched types
   --> library/std/src/sys/wasi/fs.rs:127:25
    |
    |
127 |         self.modified = t.to_wasi_timestamp_or_panic();
    |         -------------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `Option`, found `u64`
    |         expected due to the type of this binding
    |
    = note: expected enum `Option<u64>`
               found type `u64`
               found type `u64`
help: try wrapping the expression in `core::prelude::v1::Some`
    |
127 |         self.modified = core::prelude::v1::Some(t.to_wasi_timestamp_or_panic());

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
   --> library/std/src/sys/wasi/fs.rs:482:28
    |
    |
482 |             times.accessed.map_or(0, || wasi::FSTFLAGS_ATIM)
    |                            ^^^^^^    -- takes 0 arguments
    |                            expected closure that takes 1 argument
    |
help: consider changing the closure to take and ignore the expected argument
    |
    |
482 |             times.accessed.map_or(0, |_| wasi::FSTFLAGS_ATIM)

error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments
   --> library/std/src/sys/wasi/fs.rs:483:34
    |
    |
483 |                 | times.modified.map_or(0, || wasi::FSTFLAGS_MTIM),
    |                                  ^^^^^^    -- takes 0 arguments
    |                                  expected closure that takes 1 argument
    |
help: consider changing the closure to take and ignore the expected argument
    |
    |
483 |                 | times.modified.map_or(0, |_| wasi::FSTFLAGS_MTIM),

Some errors have detailed explanations: E0308, E0593.
For more information about an error, try `rustc --explain E0308`.
[RUSTC-TIMING] std test:false 1.823

@bors
Copy link
Contributor

bors commented Jun 24, 2022

💔 Test failed - checks-actions

@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 Jun 24, 2022
@Dylan-DPC Dylan-DPC closed this Jun 25, 2022
@Dylan-DPC Dylan-DPC deleted the rollup-qiuzi6y branch June 25, 2022 04:58
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-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.