]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt
bors [Thu, 13 Aug 2020 12:43:12 +0000 (12:43 +0000)]
Auto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt

Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`

This introduces an `array` lang item so functions can be defined on top of `[T; N]`. This was previously not done because const-generics was not complete enough to allow for this. Now it is in a state that is usable enough to start adding functions.

The function added is a monadic (I think?) map from `[T; N] -> [S; N]`. Until transmute can function on arrays, it also allocates an extra temporary array, but this can be removed at some point.

r? @lcnr

3 years agoAuto merge of #75322 - JulianKnodt:revisions, r=lcnr
bors [Thu, 13 Aug 2020 10:31:57 +0000 (10:31 +0000)]
Auto merge of #75322 - JulianKnodt:revisions, r=lcnr

Add a bunch of const-generic revisions for `min_const_generics`

This adds a bunch of revisions to `const-generic` tests which is part of #75279, but doesn't cover everything.

r? @lcnr

3 years agoAuto merge of #75478 - RalfJung:miri, r=RalfJung
bors [Thu, 13 Aug 2020 08:24:00 +0000 (08:24 +0000)]
Auto merge of #75478 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/75441

3 years agoupdate miri
Ralf Jung [Thu, 13 Aug 2020 07:18:46 +0000 (09:18 +0200)]
update miri

3 years agoAuto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum
bors [Thu, 13 Aug 2020 06:17:25 +0000 (06:17 +0000)]
Auto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum

Move platform support to the rustc book.

This moves the [Platform Support](https://forge.rust-lang.org/release/platform-support.html) page from the forge to the rustc book. There are several reasons for doing this:

* The forge is not really oriented towards end-users (it mostly contains infrastructure, governance and policy, internal team pages, etc.). This platform support page is useful to user to know which targets are supported.
* This page can now be updated in-sync with any PRs that add or remove a target, or change its status.
* This is now automatically checked on CI to verify the list does not get out of sync. Currently it only checks the presence/absence of an entry, but more sophisticated checks could be added in the future.

I'm not 100% certain this is the best location, but I think it fits. I'd like to see the rustc guide continue to grow, including things like linking information and more platform-specific details.

3 years agoAuto merge of #75426 - ehuss:update-cargo, r=ehuss
bors [Thu, 13 Aug 2020 04:20:51 +0000 (04:20 +0000)]
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)

3 years agoAdd drop check test & MaybeUninit::first_ptr_mut
kadmin [Tue, 11 Aug 2020 18:39:12 +0000 (18:39 +0000)]
Add drop check test & MaybeUninit::first_ptr_mut

Also in drop check test add hacky workaround for platforms that don't support
panic=unwind

3 years agoRm hiding feature gate & add 1 more example
kadmin [Sat, 8 Aug 2020 23:20:28 +0000 (23:20 +0000)]
Rm hiding feature gate & add 1 more example

Update order docs for `map`

3 years agoAdd tracking issue #75243
kadmin [Fri, 7 Aug 2020 06:00:52 +0000 (06:00 +0000)]
Add tracking issue #75243

Add note & example about iter order

Add doc changes

Update doc comments

3 years agoAdd recommend changes to array
kadmin [Thu, 6 Aug 2020 23:36:50 +0000 (23:36 +0000)]
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

3 years agoAdd Array Impl Lang Item in various places
kadmin [Thu, 6 Aug 2020 22:08:56 +0000 (22:08 +0000)]
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

3 years agoCreate lang item array and add map fn
kadmin [Thu, 6 Aug 2020 07:40:06 +0000 (07:40 +0000)]
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

3 years agoAuto merge of #75476 - JohnTitor:rollup-ap1rqf1, r=JohnTitor
bors [Thu, 13 Aug 2020 02:26:20 +0000 (02:26 +0000)]
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

3 years agoRollup merge of #75473 - JulianKnodt:swap_order_oops, r=varkor
Yuki Okushi [Thu, 13 Aug 2020 02:05:48 +0000 (11:05 +0900)]
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

3 years agoRollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:47 +0000 (11:05 +0900)]
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.

3 years agoRollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:45 +0000 (11:05 +0900)]
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.

3 years agoRollup merge of #75457 - Mark-Simulacrum:llvm-clean, r=cuviper
Yuki Okushi [Thu, 13 Aug 2020 02:05:44 +0000 (11:05 +0900)]
Rollup merge of #75457 - Mark-Simulacrum:llvm-clean, r=cuviper

Remove some dead variants in LLVM FFI

r? @nikic or @cuviper

3 years agoRollup merge of #75455 - pickfire:patch-3, r=jyn514
Yuki Okushi [Thu, 13 Aug 2020 02:05:42 +0000 (11:05 +0900)]
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

3 years agoRollup merge of #75451 - GuillaumeGomez:cleanup-e0751, r=pickfire
Yuki Okushi [Thu, 13 Aug 2020 02:05:40 +0000 (11:05 +0900)]
Rollup merge of #75451 - GuillaumeGomez:cleanup-e0751, r=pickfire

Clean up E0751 explanation

r? @Dylan-DPC

cc @pickfire

3 years agoRollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
Yuki Okushi [Thu, 13 Aug 2020 02:05:38 +0000 (11:05 +0900)]
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

3 years agoRollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:37 +0000 (11:05 +0900)]
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

3 years agoRollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnr
Yuki Okushi [Thu, 13 Aug 2020 02:05:35 +0000 (11:05 +0900)]
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)

3 years agoRollup merge of #75201 - Hirrolot:hirrolot/fix-clippy-warnings, r=varkor
Yuki Okushi [Thu, 13 Aug 2020 02:05:33 +0000 (11:05 +0900)]
Rollup merge of #75201 - Hirrolot:hirrolot/fix-clippy-warnings, r=varkor

Fix some Clippy warnings in librustc_serialize

3 years agoRollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:31 +0000 (11:05 +0900)]
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) }
```

3 years agoFlip order of const & type
kadmin [Wed, 12 Aug 2020 23:19:07 +0000 (23:19 +0000)]
Flip order of const & type

3 years agoAuto merge of #74512 - LukasKalbertodt:debloat-copy-from-slice, r=KodrAus
bors [Wed, 12 Aug 2020 23:03:28 +0000 (23:03 +0000)]
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).

3 years agoFix intra-doc link
Camelid [Wed, 12 Aug 2020 22:30:15 +0000 (15:30 -0700)]
Fix intra-doc link

3 years agoSwitch to intra-doc links in `std/io/mod.rs`
Camelid [Wed, 12 Aug 2020 22:09:55 +0000 (15:09 -0700)]
Switch to intra-doc links in `std/io/mod.rs`

3 years agoMove to intra doc links whenever possible within std/src/lib.rs
Alexis Bourget [Wed, 12 Aug 2020 21:23:07 +0000 (23:23 +0200)]
Move to intra doc links whenever possible within std/src/lib.rs

3 years agoAuto merge of #75396 - RalfJung:miri-spans, r=oli-obk
bors [Wed, 12 Aug 2020 20:44:19 +0000 (20:44 +0000)]
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

3 years agoUpdate stderr files
kadmin [Mon, 10 Aug 2020 18:50:58 +0000 (18:50 +0000)]
Update stderr files

And also fix some comments as suggested by lcnr

3 years agoPut panic code path from `copy_from_slice` into cold function
Lukas Kalbertodt [Sun, 19 Jul 2020 12:04:30 +0000 (14:04 +0200)]
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)

3 years agoAuto merge of #75354 - estebank:tuple-struct-as-struct-pat, r=petrochenkov
bors [Wed, 12 Aug 2020 18:50:20 +0000 (18:50 +0000)]
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

3 years agoAuto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt
bors [Wed, 12 Aug 2020 16:30:46 +0000 (16:30 +0000)]
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.

3 years agoRemove ArchiveKind::Other
Mark Rousskov [Wed, 12 Aug 2020 16:03:44 +0000 (12:03 -0400)]
Remove ArchiveKind::Other

Also unused since introduction in #35174

3 years agoRemove CodeGenOptLevel::Other
Mark Rousskov [Wed, 12 Aug 2020 16:01:20 +0000 (12:01 -0400)]
Remove CodeGenOptLevel::Other

Also introduced in #35174, and immediately unused.

3 years agoRemove AsmDialect::Other
Mark Rousskov [Wed, 12 Aug 2020 15:58:58 +0000 (11:58 -0400)]
Remove AsmDialect::Other

Added in #35174, this was already unused (and new uses have not been introduced
since then).

3 years agoRemove FileType::Other
Mark Rousskov [Wed, 12 Aug 2020 15:53:05 +0000 (11:53 -0400)]
Remove FileType::Other

Added in #35174, this was already unused (and new uses have not been introduced
since then).

3 years agoAdd a script to verify the Platform Support page is up-to-date.
Eric Huss [Tue, 11 Aug 2020 23:49:39 +0000 (16:49 -0700)]
Add a script to verify the Platform Support page is up-to-date.

3 years agoImprove wording
Guillaume Gomez [Wed, 12 Aug 2020 14:46:40 +0000 (16:46 +0200)]
Improve wording

3 years agoAuto merge of #75066 - poliorcetics:document-unsafety-in-core-slice, r=LukasKalbertodt
bors [Wed, 12 Aug 2020 14:18:15 +0000 (14:18 +0000)]
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.

3 years agoUse explicit path link in place for doc in time
Ivan Tham [Wed, 12 Aug 2020 14:17:12 +0000 (22:17 +0800)]
Use explicit path link in place for doc in time

3 years agoAuto merge of #75450 - pietroalbini:fix-toolstate, r=pietroalbini
bors [Wed, 12 Aug 2020 12:21:09 +0000 (12:21 +0000)]
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.

3 years agoClean up E0751 explanation
Guillaume Gomez [Wed, 12 Aug 2020 12:15:44 +0000 (14:15 +0200)]
Clean up E0751 explanation

3 years agotoolstate: remove embedded-resources alumni from toolstate
Pietro Albini [Wed, 12 Aug 2020 11:53:50 +0000 (13:53 +0200)]
toolstate: remove embedded-resources alumni from toolstate

3 years agoadd regression test for #74739 (mir const-prop bug)
Ralf Jung [Wed, 12 Aug 2020 10:50:24 +0000 (12:50 +0200)]
add regression test for #74739 (mir const-prop bug)

3 years agofix span of stack size error
Ralf Jung [Wed, 12 Aug 2020 08:18:21 +0000 (10:18 +0200)]
fix span of stack size error

3 years agofix typos
Ralf Jung [Wed, 12 Aug 2020 06:50:17 +0000 (08:50 +0200)]
fix typos

Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
3 years agomore precise span for erroneous consts during CTFE/Miri
Ralf Jung [Tue, 11 Aug 2020 12:54:02 +0000 (14:54 +0200)]
more precise span for erroneous consts during CTFE/Miri

3 years agobless tests
Ralf Jung [Tue, 11 Aug 2020 10:42:05 +0000 (12:42 +0200)]
bless tests

3 years agomiri: fall back to whole-function span when loc==None
Ralf Jung [Tue, 11 Aug 2020 10:38:40 +0000 (12:38 +0200)]
miri: fall back to whole-function span when loc==None

3 years agoAuto merge of #75321 - estebank:js-goes-gaga, r=davidtwco
bors [Wed, 12 Aug 2020 08:40:36 +0000 (08:40 +0000)]
Auto merge of #75321 - estebank:js-goes-gaga, r=davidtwco

Detect JS-style `===` and `!==` and recover

Fix #75312.

3 years agoAdd missing tests in root const-gen dir
kadmin [Sun, 9 Aug 2020 06:19:57 +0000 (06:19 +0000)]
Add missing tests in root const-gen dir

3 years agoAdd a bunch of revisions
kadmin [Sun, 9 Aug 2020 05:01:19 +0000 (05:01 +0000)]
Add a bunch of revisions

This adds a bunch of revisions to const-generic tests

3 years agoonly set frame location during push after preamble is done
Ralf Jung [Tue, 11 Aug 2020 10:38:20 +0000 (12:38 +0200)]
only set frame location during push after preamble is done

3 years agoAuto merge of #75205 - Aaron1011:fix/auto-trait-proj-ice, r=nikomatsakis
bors [Wed, 12 Aug 2020 06:42:49 +0000 (06:42 +0000)]
Auto merge of #75205 - Aaron1011:fix/auto-trait-proj-ice, r=nikomatsakis

Handle projection predicates in the param env for auto-trait docs

Fixes #72213

Any predicates in the param env are guaranteed to hold, so we don't need
to do any additional processing of them if we come across them as
sub-obligations of a different predicate. This allows us to avoid adding
the same predicate to the computed ParamEnv multiple times (but with
different regions each time), which causes an ambiguity error during
fulfillment.

3 years agoAuto merge of #75436 - JohnTitor:rollup-ss0lxds, r=JohnTitor
bors [Wed, 12 Aug 2020 04:43:38 +0000 (04:43 +0000)]
Auto merge of #75436 - JohnTitor:rollup-ss0lxds, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #74521 (older toolchains not valid anymore)
 - #74960 (Fix regionck failure when converting Index to IndexMut)
 - #75234 (Update asm! documentation in unstable book)
 - #75368 (Move to doc links inside the prelude)
 - #75371 (Move to doc links inside std/time.rs)
 - #75394 (Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer)
 - #75395 (Switch to intra-doc links in library/std/src/os/*/fs.rs)
 - #75422 (Accept more safety comments)
 - #75424 (fix wrong word in documentation)

Failed merges:

r? @ghost

3 years agoRollup merge of #75424 - joseluis:patch-1, r=joshtriplett
Yuki Okushi [Wed, 12 Aug 2020 03:07:21 +0000 (12:07 +0900)]
Rollup merge of #75424 - joseluis:patch-1, r=joshtriplett

fix wrong word in documentation

Change "two" to "three", since there are three significantly different things printed below that sentence:

---

While these:
```rust
println!("{}, `{name:.*}` has 3 fractional digits", "Hello", 3, name=1234.56);
println!("{}, `{name:.*}` has 3 characters", "Hello", 3, name="1234.56");
println!("{}, `{name:>8.*}` has 3 right-aligned characters", "Hello", 3, name="1234.56");
```

print two significantly different things:

``` rust
Hello, `1234.560` has 3 fractional digits
Hello, `123` has 3 characters
Hello, `     123` has 3 right-aligned characters
```
---
[`https://doc.rust-lang.org/std/fmt/#precision`](https://doc.rust-lang.org/std/fmt/#precision)

3 years agoRollup merge of #75422 - poliorcetics:tidy-accept-more-safety-comments, r=Mark-Simulacrum
Yuki Okushi [Wed, 12 Aug 2020 03:07:19 +0000 (12:07 +0900)]
Rollup merge of #75422 - poliorcetics:tidy-accept-more-safety-comments, r=Mark-Simulacrum

Accept more safety comments

This accepts more `// SAFETY:` comments from `tidy`.

This is done after the current behaviour of requiring text one the same line (because spaces are stripped so the last space never pass if there is no text on the same line) bit me once more in #75066

This could potentially accept empty `// SAFETY:` comments but `tidy` is an internal tool used only here so my reasoning is reviews will catch those.

3 years agoRollup merge of #75395 - nixphix:docs/os-fs, r=jyn514
Yuki Okushi [Wed, 12 Aug 2020 03:07:17 +0000 (12:07 +0900)]
Rollup merge of #75395 - nixphix:docs/os-fs, r=jyn514

Switch to intra-doc links in library/std/src/os/*/fs.rs

Partial fix for #75080

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

3 years agoRollup merge of #75394 - oli-obk:get_static, r=RalfJung
Yuki Okushi [Wed, 12 Aug 2020 03:07:15 +0000 (12:07 +0900)]
Rollup merge of #75394 - oli-obk:get_static, r=RalfJung

Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer

r? @RalfJung

miri-side: https://github.com/rust-lang/miri/issues/1507

split out of https://github.com/rust-lang/rust/pull/74949#discussion_r468100991 to make that PR leaner

3 years agoRollup merge of #75371 - poliorcetics:intra-doc-links-std-time, r=jyn514
Yuki Okushi [Wed, 12 Aug 2020 03:07:14 +0000 (12:07 +0900)]
Rollup merge of #75371 - poliorcetics:intra-doc-links-std-time, r=jyn514

Move to doc links inside std/time.rs

Helps with #75080.

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

3 years agoRollup merge of #75368 - poliorcetics:intra-doc-links-std-prelude, r=jyn514
Yuki Okushi [Wed, 12 Aug 2020 03:07:12 +0000 (12:07 +0900)]
Rollup merge of #75368 - poliorcetics:intra-doc-links-std-prelude, r=jyn514

Move to doc links inside the prelude

Helps with #75080.

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

3 years agoRollup merge of #75234 - Amanieu:asm_unstable_book, r=nikomatsakis
Yuki Okushi [Wed, 12 Aug 2020 03:07:10 +0000 (12:07 +0900)]
Rollup merge of #75234 - Amanieu:asm_unstable_book, r=nikomatsakis

Update asm! documentation in unstable book

- Update the list of supported architectures.
- Clarify issues with LLVM's use of reserved registers.

3 years agoRollup merge of #74960 - nbdd0121:typeck, r=nikomatsakis
Yuki Okushi [Wed, 12 Aug 2020 03:07:08 +0000 (12:07 +0900)]
Rollup merge of #74960 - nbdd0121:typeck, r=nikomatsakis

Fix regionck failure when converting Index to IndexMut

Fixes #74933

Consider an overloaded index expression `base[index]`. Without knowing whether it will be mutated, this will initially be desugared into `<U as Index<T>>::index(&base, index)` for some `U` and `T`. Let `V` be the `expr_ty_adjusted` of `index`.

If this expression ends up being used in any mutable context (or used in a function call with `&mut self` receiver before #72280), we will need to fix it up. The current code will rewrite it to `<U as IndexMut<V>>::index_mut(&mut base, index)`. In most cases this is fine as `V` will be equal to `T`, however this is not always true when `V/T` are references, as they may have different region.

This issue is quite subtle before #72280 as this code path is only used to fixup function receivers, but after #72280 we've made this a common path.

The solution is basically just rewrite it to `<U as IndexMut<T>>::index_mut(&mut base, index)`. `T` can retrieved in the fixup path using `node_substs`.

3 years agoRollup merge of #74521 - andjo403:readme, r=nikic
Yuki Okushi [Wed, 12 Aug 2020 03:07:06 +0000 (12:07 +0900)]
Rollup merge of #74521 - andjo403:readme, r=nikic

older toolchains not valid anymore

with the change to llvm 10 the parameter
LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN do not do anything as min and soft error is the same.
see https://github.com/rust-lang/llvm-project/blob/86b120e6f302d39cd6973b6391fb299d7bc22122/llvm/cmake/modules/CheckCompilerVersion.cmake

3 years agoAuto merge of #75427 - Xanewok:update-rls, r=Dylan-DPC
bors [Wed, 12 Aug 2020 02:49:01 +0000 (02:49 +0000)]
Auto merge of #75427 - Xanewok:update-rls, r=Dylan-DPC

Update RLS and Rustfmt

Closes #74811
Closes #74812

r? @calebcartwright

3 years agoAuto merge of #75405 - flip1995:clippyup, r=Manishearth
bors [Wed, 12 Aug 2020 00:34:19 +0000 (00:34 +0000)]
Auto merge of #75405 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update (2 days late, since I wanted to wait for https://github.com/rust-lang/rust/pull/75098)

r? @Manishearth

3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Tue, 11 Aug 2020 23:25:46 +0000 (01:25 +0200)]
Update RLS and Rustfmt

3 years agoPlatform Support page updates.
Eric Huss [Tue, 11 Aug 2020 23:05:43 +0000 (16:05 -0700)]
Platform Support page updates.

A few updates:
- Some minor wording and formatting changes.
- Remove the `cargo` column.
- Explain the columns up-front.
- Add no-wrap on the target-triple, which looks better to me.
- Minor mention on how to install support for a built-in target via rustup.

3 years agoMove forge platform-support to the rustc book.
Eric Huss [Tue, 11 Aug 2020 23:02:00 +0000 (16:02 -0700)]
Move forge platform-support to the rustc book.

3 years agoAuto merge of #74802 - Mark-Simulacrum:reland-74069, r=nnethercote
bors [Tue, 11 Aug 2020 21:23:00 +0000 (21:23 +0000)]
Auto merge of #74802 - Mark-Simulacrum:reland-74069, r=nnethercote

Reland #74069

Investigation in #74716 has concluded that this PR is indeed not a regression (and in fact the rollup itself is not either).

This reverts the revert in #74611.

r? @nnethercote cc @eddyb

3 years agoUpdate cargo
Eric Huss [Tue, 11 Aug 2020 20:59:37 +0000 (13:59 -0700)]
Update cargo

3 years agoword change
José Luis Cruz [Tue, 11 Aug 2020 20:33:11 +0000 (22:33 +0200)]
word change

there are three significantly different things printed below

3 years agoRemove SynchronizationScope::Other
Mark Rousskov [Tue, 11 Aug 2020 20:16:26 +0000 (16:16 -0400)]
Remove SynchronizationScope::Other

Added in b7615389978eae2ae9f3cba9a776fd8da3f743ca, it started out already
unused.

3 years agoSuggest using `'static` in assoc consts and suggest when multiple lts are needed
Esteban Küber [Tue, 11 Aug 2020 20:02:14 +0000 (13:02 -0700)]
Suggest using `'static` in assoc consts and suggest when multiple lts are needed

3 years agoAccept more safety comments (notably those that are on multiple lines without text...
Alexis Bourget [Tue, 11 Aug 2020 19:59:25 +0000 (21:59 +0200)]
Accept more safety comments (notably those that are on multiple lines without text after SAFETY:)

3 years agoRemove two links by changing the doc for SystemTimeError::duration
Alexis Bourget [Tue, 11 Aug 2020 19:53:02 +0000 (21:53 +0200)]
Remove two links by changing the doc for SystemTimeError::duration

3 years agoAdd some texts to make the tidy check for unsafe documentation pass
Poliorcetics [Tue, 11 Aug 2020 19:37:22 +0000 (21:37 +0200)]
Add some texts to make the tidy check for unsafe documentation pass

3 years agoMove the std::vec link back to a path-based link to make it compile with --stage 0
Alexis Bourget [Tue, 11 Aug 2020 19:30:20 +0000 (21:30 +0200)]
Move the std::vec link back to a path-based link to make it compile with --stage 0

3 years agoAuto merge of #75421 - tmandry:rollup-ctzmzn1, r=tmandry
bors [Tue, 11 Aug 2020 19:29:38 +0000 (19:29 +0000)]
Auto merge of #75421 - tmandry:rollup-ctzmzn1, r=tmandry

Rollup of 7 pull requests

Successful merges:

 - #75036 (Prefer pattern matching over indexing)
 - #75378 (Introduce `rustc_lexer::is_ident` and use it in couple of places)
 - #75393 (Fully handle "?" shortcut)
 - #75403 (Update comment for function)
 - #75407 (Requested changes to [*mut T|*const T]::set_ptr_value)
 - #75408 (Update MinGW comments in ci.yml)
 - #75409 (Fix range term in alloc vec doc)

Failed merges:

r? @ghost

3 years agoRollup merge of #75409 - pickfire:patch-4, r=GuillaumeGomez
Tyler Mandry [Tue, 11 Aug 2020 19:28:40 +0000 (12:28 -0700)]
Rollup merge of #75409 - pickfire:patch-4, r=GuillaumeGomez

Fix range term in alloc vec doc

`range` is not an element, it is a variable.

r? @GuillaumeGomez

3 years agoRollup merge of #75408 - mati865:update-ci-comment, r=pietroalbini
Tyler Mandry [Tue, 11 Aug 2020 19:28:39 +0000 (12:28 -0700)]
Rollup merge of #75408 - mati865:update-ci-comment, r=pietroalbini

Update MinGW comments in ci.yml

3 years agoRollup merge of #75407 - oliver-giersch:set_ptr_value, r=RalfJung
Tyler Mandry [Tue, 11 Aug 2020 19:28:37 +0000 (12:28 -0700)]
Rollup merge of #75407 - oliver-giersch:set_ptr_value, r=RalfJung

Requested changes to [*mut T|*const T]::set_ptr_value

This is a follow-up to PR #74774 (tracking issue #75091), acting on some change requests made after approval:

- adds `#[must_use]` attribute
- changes type of `val` pointer argument from `()` to `u8`
- adjusts documentation mentioning pointer provenance

3 years agoRollup merge of #75403 - giraffate:update_comment_in_fn, r=ecstatic-morse
Tyler Mandry [Tue, 11 Aug 2020 19:28:35 +0000 (12:28 -0700)]
Rollup merge of #75403 - giraffate:update_comment_in_fn, r=ecstatic-morse

Update comment for function

`rustc::lint::builtin` -> `rustc_session::lint::builtin`

3 years agoRollup merge of #75393 - GuillaumeGomez:fix-help-shortcut, r=pickfire
Tyler Mandry [Tue, 11 Aug 2020 19:28:34 +0000 (12:28 -0700)]
Rollup merge of #75393 - GuillaumeGomez:fix-help-shortcut, r=pickfire

Fully handle "?" shortcut

Fixes #75386.

cc @runiq

3 years agoRollup merge of #75378 - petrochenkov:isident, r=Mark-Simulacrum
Tyler Mandry [Tue, 11 Aug 2020 19:28:32 +0000 (12:28 -0700)]
Rollup merge of #75378 - petrochenkov:isident, r=Mark-Simulacrum

Introduce `rustc_lexer::is_ident` and use it in couple of places

Implements the suggestion from https://github.com/rust-lang/rust/pull/74537#issuecomment-662261979.

3 years agoRollup merge of #75036 - lzutao:pat, r=cuviper
Tyler Mandry [Tue, 11 Aug 2020 19:28:30 +0000 (12:28 -0700)]
Rollup merge of #75036 - lzutao:pat, r=cuviper

Prefer pattern matching over indexing

Quite a bit nicer IMO.

r? @cuviper

3 years agoChange safety comment for usize with the one from LukasKalbertodt review
Alexis Bourget [Tue, 11 Aug 2020 19:23:00 +0000 (21:23 +0200)]
Change safety comment for usize with the one from LukasKalbertodt review

3 years agoreview comment: simplify code by using slice pat
Esteban Küber [Tue, 11 Aug 2020 18:05:59 +0000 (11:05 -0700)]
review comment: simplify code by using slice pat

3 years agoWhen suggesting `for` lts, consider existing lifetime names
Esteban Küber [Mon, 10 Aug 2020 23:42:57 +0000 (16:42 -0700)]
When suggesting `for` lts, consider existing lifetime names

Fix #72404.

3 years agoAssoc `const`s don't have generics
Esteban Küber [Mon, 10 Aug 2020 20:26:16 +0000 (13:26 -0700)]
Assoc `const`s don't have generics

Fix #74264.

3 years agoFix suggestion to use lifetime in type
Esteban Küber [Mon, 10 Aug 2020 19:30:31 +0000 (12:30 -0700)]
Fix suggestion to use lifetime in type

3 years agoDetect tuple variants used as struct pattern and suggest correct pattern
Esteban Küber [Mon, 10 Aug 2020 00:52:29 +0000 (17:52 -0700)]
Detect tuple variants used as struct pattern and suggest correct pattern

3 years agoFully handle "?" shortcut
Guillaume Gomez [Tue, 11 Aug 2020 09:30:50 +0000 (11:30 +0200)]
Fully handle "?" shortcut

3 years agoprefer pattern matching over indexing
Lzu Tao [Tue, 11 Aug 2020 16:07:39 +0000 (16:07 +0000)]
prefer pattern matching over indexing

3 years agoFix range term in alloc vec doc
Ivan Tham [Tue, 11 Aug 2020 15:57:13 +0000 (23:57 +0800)]
Fix range term in alloc vec doc

`range` is not an element, it is a variable.

3 years agoMerge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup
flip1995 [Tue, 11 Aug 2020 13:43:21 +0000 (15:43 +0200)]
Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup

3 years agoAuto merge of #73656 - oli-obk:deaggregate-is-cleanup, r=wesleywiser
bors [Tue, 11 Aug 2020 15:38:14 +0000 (15:38 +0000)]
Auto merge of #73656 - oli-obk:deaggregate-is-cleanup, r=wesleywiser

move Deaggregate pass to post_borrowck_cleanup

Reopen of #71946

Only the second commit is from this PR, the other commit is a bugfix that's in the process of getting merged. I'll rebase once that's done

In #70073 MIR pass handling got reorganized, but with the goal of not changing behavior (except for disabling some optimizations on opt-level = 0). But there we realized that the Deaggregator pass, while conceptually more of a "cleanup" pass (and one that should be run before optimizations), was run in the middle of the optimization chain. Likely this is an accident of history, so I suggest we try and clean that up by making it a proper cleanup pass.

This does change mir-opt output, because deaggregation now runs before const-prop instead of after.

r? @wesleywiser @rust-lang/wg-mir-opt

cc @RalfJung

3 years agomove Deaggregate pass to post_borrowck_cleanup
Ralf Jung [Sun, 17 May 2020 13:39:35 +0000 (15:39 +0200)]
move Deaggregate pass to post_borrowck_cleanup