Commit graph

125294 commits

Author SHA1 Message Date
bors
814bc4fe93 Auto merge of #75426 - ehuss:update-cargo, r=ehuss
Update cargo

7 commits in 1653f354644834073d6d2541e27fae94588e685e..ab32ee88dade1b50c77347599e82ca2de3fb8a51
2020-08-04 23:14:37 +0000 to 2020-08-10 17:44:43 +0000
- Build manpage archive deterministically (rust-lang/cargo#8600)
- doc: Qualify GNU licenses in example license field (rust-lang/cargo#8604)
- Fix jobserver_exists test on single-cpu systems (rust-lang/cargo#8598)
- Fix small typo in reference/profiles.md (rust-lang/cargo#8605)
- Default cargo publish to the alt registry if it's the only allowed one (rust-lang/cargo#8571)
- cargo install with specific yanked version gives confusing "not found" error (rust-lang/cargo#8565)
- Fix typo (rust-lang/cargo#8589)
2020-08-13 04:20:51 +00:00
kadmin
af32db21c8 Add drop check test & MaybeUninit::first_ptr_mut
Also in drop check test add hacky workaround for platforms that don't support
panic=unwind
2020-08-13 03:51:08 +00:00
kadmin
412417d807 Rm hiding feature gate & add 1 more example
Update order docs for `map`
2020-08-13 03:51:05 +00:00
kadmin
54b821ebc0 Add tracking issue #75243
Add note & example about iter order

Add doc changes

Update doc comments
2020-08-13 03:51:01 +00:00
kadmin
56a651ca15 Add recommend changes to array
Switch from indexing to zip, and also use `write` on `MaybeUninit`.

Add array_map feature to core/src/lib

Attempt to fix issue of no such feature

Update w/ pickfire's review

This changes a couple of names around, adds another small test of variable size,
and hides the rustdoc #![feature(..)].

Fmt doctest

Add suggestions from lcnr
2020-08-13 03:50:59 +00:00
kadmin
f6411e4c66 Add Array Impl Lang Item in various places
Add basic test

And also run fmt which is where the other changes are from

Fix mut issues

These only appear when running tests, so resolved by adding mut

Swap order of forget

Add pub and rm guard impl

Add explicit type to guard

Add safety note

Change guard type from T to S

It should never have been T, as it guards over [MaybeUninit<S>; N]
Also add feature to test
2020-08-13 03:50:57 +00:00
kadmin
d8718183b2 Create lang item array and add map fn
This creates the language item for arrays, and adds the map fn which is like map in options or
iterators. It currently allocates an extra array, unfortunately.

Added fixme for transmuting

Fix typo

Add drop guard
2020-08-13 03:50:54 +00:00
bors
9aa6cc025d Auto merge of #75476 - JohnTitor:rollup-ap1rqf1, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #75189 (Fix wasi::fs::OpenOptions to imply write when append is on)
 - #75201 (Fix some Clippy warnings in librustc_serialize)
 - #75372 (Fix suggestion to use lifetime in type and in assoc const)
 - #75400 (Fix minor things in the `f32` primitive docs)
 - #75449 (add regression test for #74739 (mir const-prop bug))
 - #75451 (Clean up E0751 explanation)
 - #75455 (Use explicit path link in place for doc in time)
 - #75457 (Remove some dead variants in LLVM FFI)
 - #75466 (Move to intra doc links whenever possible within std/src/lib.rs)
 - #75469 (Switch to intra-doc links in `std/io/mod.rs`)
 - #75473 (Flip order of const & type)

Failed merges:

r? @ghost
2020-08-13 02:26:20 +00:00
Yuki Okushi
76ac5d61e4
Rollup merge of #75473 - JulianKnodt:swap_order_oops, r=varkor
Flip order of const & type

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

r? @varkor cc @lcnr
2020-08-13 11:05:48 +09:00
Yuki Okushi
5526c1a8cd
Rollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAus
Switch to intra-doc links in `std/io/mod.rs`

Part of #75080.
2020-08-13 11:05:47 +09:00
Yuki Okushi
e94f7437bd
Rollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAus
Move to intra doc links whenever possible within std/src/lib.rs

Helps with #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.
2020-08-13 11:05:45 +09:00
Yuki Okushi
4cf55a67dd
Rollup merge of #75457 - Mark-Simulacrum:llvm-clean, r=cuviper
Remove some dead variants in LLVM FFI

r? @nikic or @cuviper
2020-08-13 11:05:44 +09:00
Yuki Okushi
9ea03ddd0b
Rollup merge of #75455 - pickfire:patch-3, r=jyn514
Use explicit path link in place for doc in time

r? @jyn514

More worth for your time. :P
2020-08-13 11:05:42 +09:00
Yuki Okushi
a62dd23c5c
Rollup merge of #75451 - GuillaumeGomez:cleanup-e0751, r=pickfire
Clean up E0751 explanation

r? @Dylan-DPC

cc @pickfire
2020-08-13 11:05:40 +09:00
Yuki Okushi
845fb94da4
Rollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
add regression test for #74739 (mir const-prop bug)

Fixes https://github.com/rust-lang/rust/issues/74739
2020-08-13 11:05:38 +09:00
Yuki Okushi
66157e27e2
Rollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAus
Fix minor things in the `f32` primitive docs

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

Thanks @the8472 for noticing.

r? @KodrAus
2020-08-13 11:05:37 +09:00
Yuki Okushi
d90a4b8ae9
Rollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnr
Fix suggestion to use lifetime in type and in assoc const

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

* Account for associated types
* Associated `const`s can't have generics (fix #74264)
* Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix #72404)
2020-08-13 11:05:35 +09:00
Yuki Okushi
d0414b57b4
Rollup merge of #75201 - Hirrolot:hirrolot/fix-clippy-warnings, r=varkor
Fix some Clippy warnings in librustc_serialize
2020-08-13 11:05:33 +09:00
Yuki Okushi
ed543ae2f6
Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus
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) }
```
2020-08-13 11:05:31 +09:00
kadmin
c48d45bf6b Flip order of const & type 2020-08-12 23:19:07 +00:00
Rich Kadel
d4593af78f Change registered "program name" for -Cllvm-args usage messages
While debugging a codegen issue, I tried adding LLVM options with
the rustc -Cllvm-args option, and was confused by the error and usage
messaging.

The LLVM "program name" argument is set to "rustc", and command line
error messages make it look like invalid arguments are "rustc"
arguments, not LLVM.

I changed this argument so error messages and the "-help" usage feedback
is easier to understand and react to. (Clang does something similar.)
2020-08-12 16:11:17 -07:00
bors
847ba835ce Auto merge of #74512 - LukasKalbertodt:debloat-copy-from-slice, r=KodrAus
Put panic code path from `copy_from_slice` into cold function

The previous `assert_eq` generated quite some code, which is especially problematic when this call is inlined. This commit also slightly improves the panic message from:

    assertion failed: `(left == right)`
      left: `3`,
     right: `2`: destination and source slices have different lengths

...to:

    source slice length (2) does not match destination slice length (3)

You can see the code bloat in assembly [here](https://rust.godbolt.org/z/74a3qo).
2020-08-12 23:03:28 +00:00
Camelid
a7749fe451 Fix intra-doc link 2020-08-12 15:30:15 -07:00
Camelid
bc8367617e Switch to intra-doc links in std/io/mod.rs 2020-08-12 15:11:17 -07:00
Ruben Gonzalez
b38e571e9c
Fix E0741 error code explanation
Use OK ! like other explanations
2020-08-12 23:42:10 +02:00
Alexis Bourget
3f16597a6a Move to intra doc links whenever possible within std/src/lib.rs 2020-08-12 23:23:07 +02:00
bors
576d27c5a6 Auto merge of #75396 - RalfJung:miri-spans, r=oli-obk
Miri: improve spans of required_const failures

In https://github.com/rust-lang/rust/pull/75339 I added a loop evaluating all consts required by a function body. Unfortunately, if one of their evaluations fails, then the span used for that was that of the first statement in the function body, which happened to work form some existing test but is not sensible in general.

This PR changes it to point to the whole function instead, which is at least not wrong.

r? @oli-obk
2020-08-12 20:44:19 +00:00
kadmin
5c0b416dde Update stderr files
And also fix some comments as suggested by lcnr
2020-08-12 20:04:36 +00:00
Mark Rousskov
bff104d4db Remove unused tcx parameter 2020-08-12 16:00:44 -04:00
Lukas Kalbertodt
db99f98c3e
Put panic code path from copy_from_slice into cold function
The previous `assert_eq` generated quite some code, which is especially
problematic when this call is inlined. This commit also slightly
improves the panic message from:

  assertion failed: `(left == right)`
    left: `3`,
   right: `2`: destination and source slices have different lengths

...to:

  source slice length (2) does not match destination slice length (3)
2020-08-12 21:12:21 +02:00
bors
ef1d58e7c9 Auto merge of #75354 - estebank:tuple-struct-as-struct-pat, r=petrochenkov
Detect tuple variants used as struct pattern and suggest correct pattern

Fix #61326

r? @petrochenkov
2020-08-12 18:50:20 +00:00
Ralf Jung
0e26f9b994 fix LocalInfo doc comment 2020-08-12 19:40:29 +02:00
bors
3df25ae186 Auto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt
Add Ipv6Addr::to_ipv4_mapped

* add Ipv6Addr::to_ipv4_mapped
* ~~deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4~~ reference: #75150

According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10), the "IPv4-Compatible IPv6 address" is deprecated.

> 2.5.5.1.  IPv4-Compatible IPv6 Address
>
>    The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6
>    transition.  The format of the "IPv4-Compatible IPv6 address" is as
>    follows:
>
>    |                80 bits               | 16 |      32 bits        |
>    +--------------------------------------+--------------------------+
>    |0000..............................0000|0000|    IPv4 address     |
>    +--------------------------------------+----+---------------------+
>
>    Note: The IPv4 address used in the "IPv4-Compatible IPv6 address"
>    must be a globally-unique IPv4 unicast address.
>
>    The "IPv4-Compatible IPv6 address" is now deprecated because the
>    current IPv6 transition mechanisms no longer use these addresses.
>    New or updated implementations are not required to support this
>    address type.

And the current implementation of `Ipv4Addr::to_ipv6_compatible`is incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.

Please let me know if there are any issues with this pull request.
2020-08-12 16:30:46 +00:00
Mark Rousskov
486c48b570 Remove ArchiveKind::Other
Also unused since introduction in #35174
2020-08-12 12:03:44 -04:00
Mark Rousskov
7a0b195188 Remove CodeGenOptLevel::Other
Also introduced in #35174, and immediately unused.
2020-08-12 12:01:31 -04:00
Mark Rousskov
fc163ed4ee Remove AsmDialect::Other
Added in #35174, this was already unused (and new uses have not been introduced
since then).
2020-08-12 11:59:17 -04:00
Mark Rousskov
f043c8fa48 Remove FileType::Other
Added in #35174, this was already unused (and new uses have not been introduced
since then).
2020-08-12 11:55:45 -04:00
Eric Huss
ce717476ff Add a script to verify the Platform Support page is up-to-date. 2020-08-12 08:40:22 -07:00
Guillaume Gomez
f11b2e521e Improve wording 2020-08-12 16:51:29 +02:00
bors
ded20c98be Auto merge of #75066 - poliorcetics:document-unsafety-in-core-slice, r=LukasKalbertodt
Document unsafety in library/core/src/slice/mod.rs

Restart where #73555 left off, helping with #66219.
2020-08-12 14:18:15 +00:00
Ivan Tham
cda660b5fc
Use explicit path link in place for doc in time 2020-08-12 22:17:12 +08:00
bors
cee14d8c30 Auto merge of #75450 - pietroalbini:fix-toolstate, r=pietroalbini
Remove embedded-resources alumni from toolstate

Some people left the embedded-resources working group (https://github.com/rust-lang/team/pull/401), making them unassignable in toolstate issues. This PR removes them from the toolstate assignees list, fixing CI.
2020-08-12 12:21:09 +00:00
Guillaume Gomez
d0704d5d36 Clean up E0751 explanation 2020-08-12 14:15:44 +02:00
Pietro Albini
8345f323b3
toolstate: remove embedded-resources alumni from toolstate 2020-08-12 13:53:50 +02:00
Ralf Jung
0d6ff997a5 add regression test for #74739 (mir const-prop bug) 2020-08-12 12:50:24 +02:00
Ralf Jung
fd32fe9bb9 fix span of stack size error 2020-08-12 11:14:49 +02:00
Ralf Jung
a505e773a5 fix typos
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-08-12 10:48:08 +02:00
Ralf Jung
d21e0118d0 more precise span for erroneous consts during CTFE/Miri 2020-08-12 10:48:08 +02:00
Ralf Jung
4b4d43fe6a bless tests 2020-08-12 10:48:08 +02:00
Ralf Jung
d6c988b3a7 miri: fall back to whole-function span when loc==None 2020-08-12 10:48:08 +02:00