Skip to content

Rollup of 11 pull requests #75476

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

Merged
merged 32 commits into from
Aug 13, 2020
Merged

Rollup of 11 pull requests #75476

merged 32 commits into from
Aug 13, 2020

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

kawamuray and others added 30 commits August 5, 2020 20:30
All of these were review comments in rust-lang#74621 that I first fixed
in that PR, but later accidentally overwrote by a force push.
Added in b761538, it started out already
unused.
Added in rust-lang#35174, this was already unused (and new uses have not been introduced
since then).
Added in rust-lang#35174, this was already unused (and new uses have not been introduced
since then).
Also introduced in rust-lang#35174, and immediately unused.
Also unused since introduction in rust-lang#35174
…rAus

Fix wasi::fs::OpenOptions to imply write when append is on

This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled.
As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well.

## Reproduce

Given below simple Rust program:

```rust
use std::fs::OpenOptions;
use std::io::Write;

fn main() {
    let mut file = OpenOptions::new()
        .write(true)
        .create(true)
        .open("foo.txt")
        .unwrap();
    writeln!(file, "abc").unwrap();
}
```

it can successfully compiled into wasm and execute by `wasmtime` runtime:

```sh
$ rustc --target wasm32-wasi write.rs
$ ~/wasmtime/target/debug/wasmtime run --dir=. write.wasm
$ cat foo.txt
abc
```

However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient":

```sh
$ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: failed to run main module `append.wasm`
...
```

This is because of lacking "rights" on the opened file:

```sh
$ RUST_LOG=trace ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm 2>&1 | grep validate_rights
 TRACE wasi_common::entry                                  >      | validate_rights failed: required rights = HandleRights { base: fd_write (0x40), inheriting: empty (0x0) }; actual rights = HandleRights { base: fd_seek|fd_fdstat_set_flags|fd_sync|fd_tell|fd_advise|fd_filestat_set_times|poll_fd_readwrite (0x88000bc), inheriting: empty (0x0) }
```
…gs, r=varkor

Fix some Clippy warnings in librustc_serialize
Fix suggestion to use lifetime in type and in assoc const

_Do not merge until rust-lang#75363 has landed, as it has the test case for this._

* Account for associated types
* Associated `const`s can't have generics (fix rust-lang#74264)
* Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix rust-lang#72404)
…rAus

Fix minor things in the `f32` primitive docs

All of these were review comments in rust-lang#74621 that I first fixed in that PR, but later accidentally overwrote by a force push.

Thanks @the8472 for noticing.

r? @KodrAus
Use explicit path link in place for doc in time

r? @jyn514

More worth for your time. :P
…=KodrAus

Move to intra doc links whenever possible within std/src/lib.rs

Helps with rust-lang#75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

There are some things like

```rust
`//! [`Option<T>`]: option::Option`
```

that will either be fixed in the future or have open issues about them.
… r=KodrAus

Switch to intra-doc links in `std/io/mod.rs`

Part of rust-lang#75080.
Flip order of const & type

Fix swapped order of consts & types in error message introduced in rust-lang#74953

r? @varkor cc @lcnr
@JohnTitor
Copy link
Member Author

@rustbot modify labels: +rollup
@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Aug 13, 2020

📌 Commit 76ac5d6 has been approved by JohnTitor

@rustbot rustbot added the rollup A PR which is a rollup label Aug 13, 2020
@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 Aug 13, 2020
@bors
Copy link
Collaborator

bors commented Aug 13, 2020

⌛ Testing commit 76ac5d6 with merge 9aa6cc0...

@bors
Copy link
Collaborator

bors commented Aug 13, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: JohnTitor
Pushing 9aa6cc0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 13, 2020
@bors bors merged commit 9aa6cc0 into rust-lang:master Aug 13, 2020
@JohnTitor JohnTitor deleted the rollup-ap1rqf1 branch August 13, 2020 04:25
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup 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.