Commit Graph

125144 Commits

Author SHA1 Message Date
Yuki Okushi
261773e185
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
2020-08-12 12:07:14 +09:00
Yuki Okushi
c423fdeb74
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
2020-08-12 12:07:12 +09:00
Yuki Okushi
0bdb83942d
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.
2020-08-12 12:07:10 +09:00
Yuki Okushi
43babed7e2
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`.
2020-08-12 12:07:08 +09:00
Yuki Okushi
7e503a09b5
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 86b120e6f3/llvm/cmake/modules/CheckCompilerVersion.cmake
2020-08-12 12:07:06 +09:00
bors
8da42ddbf6 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
2020-08-12 00:34:19 +00:00
bors
873fc463bd 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
2020-08-11 21:23:00 +00:00
Alexis Bourget
bd01bf9274 Remove two links by changing the doc for SystemTimeError::duration 2020-08-11 21:53:02 +02:00
Alexis Bourget
3ff06a9f2c Move the std::vec link back to a path-based link to make it compile with --stage 0 2020-08-11 21:30:20 +02:00
bors
e5e33ebd2b 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
2020-08-11 19:29:38 +00:00
Tyler Mandry
5d9a0b020c
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
2020-08-11 12:28:40 -07:00
Tyler Mandry
a028c3176a
Rollup merge of #75408 - mati865:update-ci-comment, r=pietroalbini
Update MinGW comments in ci.yml
2020-08-11 12:28:39 -07:00
Tyler Mandry
06eb274bfc
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
2020-08-11 12:28:37 -07:00
Tyler Mandry
d38997e4d9
Rollup merge of #75403 - giraffate:update_comment_in_fn, r=ecstatic-morse
Update comment for function

`rustc::lint::builtin` -> `rustc_session::lint::builtin`
2020-08-11 12:28:35 -07:00
Tyler Mandry
a4211977d7
Rollup merge of #75393 - GuillaumeGomez:fix-help-shortcut, r=pickfire
Fully handle "?" shortcut

Fixes #75386.

cc @runiq
2020-08-11 12:28:34 -07:00
Tyler Mandry
c18b64c866
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.
2020-08-11 12:28:32 -07:00
Tyler Mandry
dcccb47cb8
Rollup merge of #75036 - lzutao:pat, r=cuviper
Prefer pattern matching over indexing

Quite a bit nicer IMO.

r? @cuviper
2020-08-11 12:28:30 -07:00
Guillaume Gomez
fdf2fe18a1 Fully handle "?" shortcut 2020-08-11 18:28:01 +02:00
Lzu Tao
e8ea6e59f0 prefer pattern matching over indexing 2020-08-11 16:07:39 +00:00
Ivan Tham
e4f2de2e9a
Fix range term in alloc vec doc
`range` is not an element, it is a variable.
2020-08-11 23:57:13 +08:00
flip1995
d6b991d3a0
Merge commit '09bd400243ed6f7059fedc0c1623aae3792521d6' into clippyup 2020-08-11 17:50:45 +02:00
bors
cbe7c5ce70 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
2020-08-11 15:38:14 +00:00
Ralf Jung
307d0d8f51 move Deaggregate pass to post_borrowck_cleanup 2020-08-11 17:09:15 +02:00
Mateusz Mikuła
24177319ca Update MinGW comments in ci.yml 2020-08-11 16:31:32 +02:00
oliver-giersch
19c9674966 mentions provenance, changes argument type, adds must_use attr 2020-08-11 16:14:34 +02:00
Takayuki Nakata
62502a9403 Update comment for function
`rustc::lint::builtin` -> `rustc_session::lint::builtin`
2020-08-11 22:34:23 +09:00
bors
09bd400243 Auto merge of #5891 - flip1995:rustup, r=flip1995
Rustup

r? @ghost

Sync back rust-lang/rust#75098

changelog: none
2020-08-11 12:32:10 +00:00
bors
4b9ac51617 Auto merge of #75388 - JohnTitor:rollup-9tgkxnl, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #74744 (Update RELEASES.md for 1.46.0)
 - #75085 (Transmute big endian `s6_addr` and `[u16; 8]`)
 - #75226 (Miri: Renamed "undef" to "uninit")
 - #75333 (polymorphize: constrain unevaluated const handling)
 - #75338 (move stack size check to const_eval machine)
 - #75347 (Rustdoc: Fix natural ordering to look at all numbers.)
 - #75352 (Tweak conditions for E0026 and E0769)
 - #75353 (Tiny cleanup, remove unnecessary `unwrap`)
 - #75359 (unused_delims: trim expr)
 - #75360 (Add sample fix for E0749)

Failed merges:

r? @ghost
2020-08-11 12:31:56 +00:00
flip1995
9311c11d7c
Fix sync fallout 2020-08-11 14:21:27 +02:00
Yuki Okushi
532002853d
Rollup merge of #75360 - pickfire:patch-4, r=GuillaumeGomez
Add sample fix for E0749

Even though the description is clear but the solution may not be as straightforward.
Adding a suggested fix from documentation side.

r? @GuillaumeGomez

However, this suggestion should be shown in rustc itself for easy fix, the documentation should also reflect on the changes in rustc. Currently,
```
error[E0749]: negative impls cannot have any items
 --> test.rs:6:5
  |
6 |     type Foo = i32; // error!
  |     ^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0749`.
```
rustc should tell the user to remove it.
2020-08-11 16:23:59 +09:00
Yuki Okushi
ca462d36ff
Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk
unused_delims: trim expr

improves rustfix output.
2020-08-11 16:23:57 +09:00
Yuki Okushi
0a8d4db4d8
Rollup merge of #75353 - estebank:tiny, r=jyn514
Tiny cleanup, remove unnecessary `unwrap`

Remove unnecessary `unwrap`.
2020-08-11 16:23:56 +09:00
Yuki Okushi
e51a839030
Rollup merge of #75352 - estebank:incorrect-tuple-struct-pat, r=oli-obk
Tweak conditions for E0026 and E0769

When we have a tuple struct used with struct we don't want to suggest using the (valid) struct syntax with numeric field names. Instead we want to suggest the expected syntax.

Given

```rust
fn main() {
    match MyOption::MySome(42) {
        MyOption::MySome { x: 42 } => (),
        _ => (),
    }
}
```

We now emit E0769 "tuple variant `MyOption::MySome` written as struct variant" instead of E0026 "variant `MyOption::MySome` does not have a field named `x`".
2020-08-11 16:23:54 +09:00
Yuki Okushi
a75bdfa230
Rollup merge of #75347 - fusion-engineering-forks:rustdoc-nat-sort, r=GuillaumeGomez
Rustdoc: Fix natural ordering to look at all numbers.

The old implementation only looks at numbers at the end, but not in other places in a name: `u8` and `u16` got sorted properly, but `u8_bla` and `u16_bla` did not.

![image](https://user-images.githubusercontent.com/783247/89740226-28e8b180-da87-11ea-885d-77a7c8a6ba00.png)
2020-08-11 16:23:52 +09:00
Yuki Okushi
f50f1c79b8
Rollup merge of #75338 - RalfJung:const-eval-stack-size-check, r=oli-obk
move stack size check to const_eval machine

This is consistent with how we enforce the step limit. In particular, we do not want this limit checked for Miri-the-tool.
2020-08-11 16:23:50 +09:00
Yuki Okushi
06f296a005
Rollup merge of #75333 - davidtwco:polymorphization-75260-fixes, r=lcnr
polymorphize: constrain unevaluated const handling

This PR constrains the support added for handling unevaluated consts in polymorphization (introduced in #75260) by:

- Skipping associated constants as this causes cycle errors.
- Skipping promoted constants when they contain `Self` as this ensures `T` is used in constants of the form `<Self as Foo<T>>`.

Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75260.

r? @lcnr
2020-08-11 16:23:49 +09:00
Yuki Okushi
c27779f59b
Rollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung
Miri: Renamed "undef" to "uninit"

Renamed remaining references to "undef" to "uninit" when referring to Miri.

Impacted directories are:

- `src/librustc_codegen_llvm/consts.rs`
- `src/librustc_middle/mir/interpret/`
- `src/librustc_middle/ty/print/pretty.rs`
- `src/librustc_mir/`
- `src/tools/clippy/clippy_lints/src/consts.rs`

Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project.

Related issue #71193
2020-08-11 16:23:47 +09:00
Yuki Okushi
f26f201d42
Rollup merge of #75085 - lzutao:ip_union, r=cuviper
Transmute big endian `s6_addr` and `[u16; 8]`

The old code already made the assumption to reinterpret
`Ipv6Addr` as `[u16; 8]`.

Glibc, Linux, FreeBSD, Win32 all makes this assumption.
The main motivation of using union it to better optimize code.
Godbolt: https://rust.godbolt.org/z/b4bGvo
Const is introducing unsafe when transmuting.

ref:
* https://docs.microsoft.com/en-us/windows/win32/api/in6addr/ns-in6addr-in6_addr
* 1d6e424741/contrib/ntp/lib/isc/include/isc/ipv6.h (L63)
* 8b531aa996/include/net/net_ip.h (L137)
* https://sourceware.org/git/?p=glibc.git;a=blob;f=inet/netinet/in.h;h=f6355c7efe5192b88337b136ef687fe9a5ed648c;hb=HEAD#l216
2020-08-11 16:23:45 +09:00
Yuki Okushi
fa853f3df0
Rollup merge of #74744 - XAMPPRocky:relnotes-1.46.0, r=Mark-Simulacrum
Update RELEASES.md for 1.46.0

### [Rendered](https://github.com/XAMPPRocky/rust/blob/relnotes-1.46.0/RELEASES.md)

r? @Mark-Simulacrum

cc @rust-lang/release
2020-08-11 16:23:43 +09:00
bors
441fd22557 Auto merge of #75329 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: better distinguish the root holder from the root node

Renames and intermediate variables
2020-08-11 06:17:02 +00:00
bors
a9025c571e Auto merge of #74621 - LukasKalbertodt:float-docs, r=GuillaumeGomez
Improve `f32` and `f64` primitive documentation

I noticed that the docs for the primitive floats were fairly short. I first only wanted to add the IEEE specification information (compare [the reference](https://doc.rust-lang.org/reference/types/numeric.html)), but then also added some more beginner-friendly docs. Let me know what you think!

Random doc team assign:
r? @rylev
2020-08-11 04:10:39 +00:00
bors
7189ca604a Auto merge of #75383 - Dylan-DPC:rollup-6hi36zn, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #75098 (Clippy pointer cast lint experiment)
 - #75249 (Only add a border for the rust logo)
 - #75315 (Avoid deleting temporary files on error)
 - #75316 (Don't try to use wasm intrinsics on vectors)
 - #75337 (instance: only polymorphize upvar substs)
 - #75339 (evaluate required_consts when pushing stack frame in Miri engine)
 - #75363 (Use existing `infcx` when emitting trait impl diagnostic)
 - #75366 (Add help button)
 - #75369 (Move to intra-doc links in /library/core/src/borrow.rs)
 - #75379 (Use intra-doc links in /library/core/src/cmp.rs)

Failed merges:

r? @ghost
2020-08-11 01:38:31 +00:00
Dylan DPC
0a738d41b1
Rollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC
Use intra-doc links in /library/core/src/cmp.rs

Helps with #75080.

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

Known issues:

* Links from `core` to `std` (#74481):
    * [`Vec::sort_by_key`]
2020-08-11 01:56:47 +02:00
Dylan DPC
d00c70363f
Rollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth
Move to intra-doc links in /library/core/src/borrow.rs

Helps with #75080.

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

Known issues:

* Links from `core` to `std` (#74481):
    * [`Box<T>`]
    * [`Mutex<T>`]
    * [`Rc<T>`]
    * [`String`]
    * [`HashMap<K, V>`]
2020-08-11 01:56:45 +02:00
Dylan DPC
51ed33d8c2
Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
Add help button

Part of #75197.

Here is a screenshot of the result:

![Screenshot from 2020-08-10 16-53-20](https://user-images.githubusercontent.com/3050060/89796547-14112a00-db2a-11ea-9f25-57b30ab68f9b.png)

r? @jyn514
2020-08-11 01:56:43 +02:00
Dylan DPC
dff868e3da
Rollup merge of #75363 - Aaron1011:fix/diag-infcx, r=lcnr
Use existing `infcx` when emitting trait impl diagnostic

Fixes #75361
Fixes #74918

Previously, we were creating a new `InferCtxt`, which caused an ICE when
used with type variables from the existing `InferCtxt`
2020-08-11 01:56:41 +02:00
Dylan DPC
9edec571cb
Rollup merge of #75339 - RalfJung:eval-required, r=oli-obk
evaluate required_consts when pushing stack frame in Miri engine

[Just like codegen](https://github.com/rust-lang/rust/pull/70820/files#diff-32c57af5c8e23eb048f55d1e955e5cd5R194), Miri needs to make sure all `required_consts` evaluate successfully, to catch post-monomorphization errors.

While at it I also moved the const_eval error reporting logic into rustc_mir::const_eval::error; there is no reason it should be in `rustc_middle`. I kept this in a separate commit for easier reviewing.

Helps with https://github.com/rust-lang/miri/issues/1382. I will add a test on the Miri side (done now: https://github.com/rust-lang/miri/pull/1504).
r? @oli-obk
2020-08-11 01:56:39 +02:00
Dylan DPC
1e41af3c8c
Rollup merge of #75337 - davidtwco:polymorphization-75255-fixes, r=eddyb
instance: only polymorphize upvar substs

This PR restricts the substitution polymorphization added in #75255 to only apply to the tupled upvar substitution, rather than all substitutions, fixing a bunch of regressions when polymorphization is
enabled.

Due to an oversight on my part, when landing #75260 and #75255, some tests started failing when polymorphization was enabled that I didn't notice until after landing - this PR fixes the regressions from #75255. #75336 has been filed to make sure that we don't forget to try make this change again in future, as it does enable some optimisations.

r? @lcnr
2020-08-11 01:56:38 +02:00
Dylan DPC
2932638d34
Rollup merge of #75316 - alexcrichton:fix-wasm-simd, r=oli-obk
Don't try to use wasm intrinsics on vectors

This commit fixes an issue with #74695 where the fptosi and fptoui
specializations on wasm were accidentally used on vector types by the
`simd_cast` intrinsic. This issue showed up as broken CI for the stdsimd
crate. Here this commit simply skips the specialization on vector kinds
flowing into `fpto{s,u}i`.
2020-08-11 01:56:36 +02:00
Dylan DPC
992988bbc5
Rollup merge of #75315 - Mark-Simulacrum:save-temps, r=ecstatic-morse
Avoid deleting temporary files on error

Previously if the compiler error'd, fatally, then temporary directories which
should be preserved by -Csave-temps would be deleted due to fatal compiler
errors being implemented as panics.

cc @infinity0

(Hopefully) fixes #75275, but I haven't tested
2020-08-11 01:56:34 +02:00