]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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 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 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

3 years agoUpdate MinGW comments in ci.yml
Mateusz Mikuła [Tue, 11 Aug 2020 14:31:32 +0000 (16:31 +0200)]
Update MinGW comments in ci.yml

3 years agoRevert #tymethods
Prabakaran Kumaresshan [Tue, 11 Aug 2020 14:20:17 +0000 (19:50 +0530)]
Revert #tymethods

3 years agomentions provenance, changes argument type, adds must_use attr
oliver-giersch [Tue, 11 Aug 2020 14:14:34 +0000 (16:14 +0200)]
mentions provenance, changes argument type, adds must_use attr

3 years agoUpdate comment for function
Takayuki Nakata [Tue, 11 Aug 2020 13:34:23 +0000 (22:34 +0900)]
Update comment for function

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

3 years agoAuto merge of #5891 - flip1995:rustup, r=flip1995
bors [Tue, 11 Aug 2020 12:32:10 +0000 (12:32 +0000)]
Auto merge of #5891 - flip1995:rustup, r=flip1995

Rustup

r? @ghost

Sync back rust-lang/rust#75098

changelog: none

3 years agoAuto merge of #75388 - JohnTitor:rollup-9tgkxnl, r=JohnTitor
bors [Tue, 11 Aug 2020 12:31:56 +0000 (12:31 +0000)]
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

3 years agoFix sync fallout
flip1995 [Tue, 11 Aug 2020 11:57:32 +0000 (13:57 +0200)]
Fix sync fallout

3 years agoAdd a function to `TyCtxt` for computing an `Allocation` for a `static` item's initia...
Oliver Scherer [Tue, 11 Aug 2020 09:35:50 +0000 (11:35 +0200)]
Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer

3 years agoSwitch to intra-doc links in library/std/src/os/*/fs.rs
Prabakaran Kumaresshan [Tue, 11 Aug 2020 08:26:07 +0000 (13:56 +0530)]
Switch to intra-doc links in library/std/src/os/*/fs.rs

3 years agoRollup merge of #75360 - pickfire:patch-4, r=GuillaumeGomez
Yuki Okushi [Tue, 11 Aug 2020 07:23:59 +0000 (16:23 +0900)]
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.

3 years agoRollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:57 +0000 (16:23 +0900)]
Rollup merge of #75359 - lcnr:unused-delims-trim, r=oli-obk

unused_delims: trim expr

improves rustfix output.

3 years agoRollup merge of #75353 - estebank:tiny, r=jyn514
Yuki Okushi [Tue, 11 Aug 2020 07:23:56 +0000 (16:23 +0900)]
Rollup merge of #75353 - estebank:tiny, r=jyn514

Tiny cleanup, remove unnecessary `unwrap`

Remove unnecessary `unwrap`.

3 years agoRollup merge of #75352 - estebank:incorrect-tuple-struct-pat, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:54 +0000 (16:23 +0900)]
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`".

3 years agoRollup merge of #75347 - fusion-engineering-forks:rustdoc-nat-sort, r=GuillaumeGomez
Yuki Okushi [Tue, 11 Aug 2020 07:23:52 +0000 (16:23 +0900)]
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)

3 years agoRollup merge of #75338 - RalfJung:const-eval-stack-size-check, r=oli-obk
Yuki Okushi [Tue, 11 Aug 2020 07:23:50 +0000 (16:23 +0900)]
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.

3 years agoRollup merge of #75333 - davidtwco:polymorphization-75260-fixes, r=lcnr
Yuki Okushi [Tue, 11 Aug 2020 07:23:49 +0000 (16:23 +0900)]
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

3 years agoRollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJung
Yuki Okushi [Tue, 11 Aug 2020 07:23:47 +0000 (16:23 +0900)]
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

3 years agoRollup merge of #75085 - lzutao:ip_union, r=cuviper
Yuki Okushi [Tue, 11 Aug 2020 07:23:45 +0000 (16:23 +0900)]
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
* https://github.com/freebsd/freebsd/blob/1d6e4247415d264485ee94b59fdbc12e0c566fd0/contrib/ntp/lib/isc/include/isc/ipv6.h#L63
* https://github.com/zephyrproject-rtos/zephyr/blob/8b531aa996bba254c03129658490af59597acd78/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

3 years agoRollup merge of #74744 - XAMPPRocky:relnotes-1.46.0, r=Mark-Simulacrum
Yuki Okushi [Tue, 11 Aug 2020 07:23:43 +0000 (16:23 +0900)]
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

3 years agoAuto merge of #75329 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
bors [Tue, 11 Aug 2020 06:17:02 +0000 (06:17 +0000)]
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

3 years agoAuto merge of #74621 - LukasKalbertodt:float-docs, r=GuillaumeGomez
bors [Tue, 11 Aug 2020 04:10:39 +0000 (04:10 +0000)]
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

3 years agoAuto merge of #75383 - Dylan-DPC:rollup-6hi36zn, r=Dylan-DPC
bors [Tue, 11 Aug 2020 01:38:31 +0000 (01:38 +0000)]
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

3 years agoadd Ipv6Addr::to_ipv4_mapped
南浦月 [Mon, 10 Aug 2020 12:20:20 +0000 (20:20 +0800)]
add Ipv6Addr::to_ipv4_mapped

3 years agoRollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC
Dylan DPC [Mon, 10 Aug 2020 23:56:47 +0000 (01:56 +0200)]
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`]

3 years agoRollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth
Dylan DPC [Mon, 10 Aug 2020 23:56:45 +0000 (01:56 +0200)]
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>`]

3 years agoRollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
Dylan DPC [Mon, 10 Aug 2020 23:56:43 +0000 (01:56 +0200)]
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

3 years agoRollup merge of #75363 - Aaron1011:fix/diag-infcx, r=lcnr
Dylan DPC [Mon, 10 Aug 2020 23:56:41 +0000 (01:56 +0200)]
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`

3 years agoRollup merge of #75339 - RalfJung:eval-required, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:39 +0000 (01:56 +0200)]
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

3 years agoRollup merge of #75337 - davidtwco:polymorphization-75255-fixes, r=eddyb
Dylan DPC [Mon, 10 Aug 2020 23:56:38 +0000 (01:56 +0200)]
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

3 years agoRollup merge of #75316 - alexcrichton:fix-wasm-simd, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:36 +0000 (01:56 +0200)]
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`.

3 years agoRollup merge of #75315 - Mark-Simulacrum:save-temps, r=ecstatic-morse
Dylan DPC [Mon, 10 Aug 2020 23:56:34 +0000 (01:56 +0200)]
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

3 years agoRollup merge of #75249 - GuillaumeGomez:rust-logo-border, r=Manishearth
Dylan DPC [Mon, 10 Aug 2020 23:56:32 +0000 (01:56 +0200)]
Rollup merge of #75249 - GuillaumeGomez:rust-logo-border, r=Manishearth

Only add a border for the rust logo

![Screenshot from 2020-08-07 11-22-51](https://user-images.githubusercontent.com/3050060/89631113-9dadc700-d8a0-11ea-8063-ad40207decaa.png)
![Screenshot from 2020-08-07 11-19-47](https://user-images.githubusercontent.com/3050060/89631114-9e465d80-d8a0-11ea-96ba-1d6926c8e7a9.png)
![Screenshot from 2020-08-07 11-19-41](https://user-images.githubusercontent.com/3050060/89631117-9edef400-d8a0-11ea-9c66-0df3d8c1ac2d.png)

I didn't add a border for the light theme though, as I felt it as unnecessary.

r? @Manishearth

3 years agoRollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:30 +0000 (01:56 +0200)]
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk

Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk

3 years agoRollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk
Dylan DPC [Mon, 10 Aug 2020 23:56:30 +0000 (01:56 +0200)]
Rollup merge of #75098 - Ryan1729:clippy-pointer-cast-lint-experiment, r=oli-obk

Clippy pointer cast lint experiment

This PR is an experiment about exposing more parts of `rustc_typeck` for use in `clippy`. In particular, the code that checks where a cast is valid or not was exposed, which necessitated exposing [`FnCtxt`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_typeck/check/struct.FnCtxt.html), and figuring out how to create an instance of that type inside `clippy`.

This was prompted by [this clippy issue](https://github.com/rust-lang/rust-clippy/issues/2064).

r? @oli-obk

3 years agoAuto merge of #74005 - estebank:type-ascription-redux, r=petrochenkov
bors [Mon, 10 Aug 2020 23:50:39 +0000 (23:50 +0000)]
Auto merge of #74005 - estebank:type-ascription-redux, r=petrochenkov

Clean up errors in typeck and resolve

* Tweak ordering of suggestions
* Do not suggest similarly named enclosing item
* Point at item definition in foreign crates
* Add missing primary label

CC #34255.

3 years agoAuto merge of #5888 - matthiaskrgr:lints, r=yaahc
bors [Mon, 10 Aug 2020 22:40:42 +0000 (22:40 +0000)]
Auto merge of #5888 - matthiaskrgr:lints, r=yaahc

make a bunch of lints texts adhere to rustc dev guide

According to the rustc-dev guide: "The text should be matter of fact and avoid capitalization and periods, unless multiple sentences are needed"

changelog: make some lint output adhere to the rustc-dev guide

3 years agoupdate test stderr
Matthias Krüger [Mon, 10 Aug 2020 22:27:55 +0000 (00:27 +0200)]
update test stderr

3 years agoAuto merge of #5889 - ebroto:5886_or_fun_call_const_0_args, r=Manishearth
bors [Mon, 10 Aug 2020 22:12:38 +0000 (22:12 +0000)]
Auto merge of #5889 - ebroto:5886_or_fun_call_const_0_args, r=Manishearth

Avoid or_fun_call for const_fn with no args

Based on #5682 by @lzutao

This avoids a subset of false positives, specifically those related to `const fn`s that take no arguments.
For the rest, a much more involved fix would be needed, see https://github.com/rust-lang/rust-clippy/pull/5682#issuecomment-638681210.

So this does *not* solve #5658

changelog: Avoid triggering [`or_fun_call`] with `const fn`s that take no arguments.

Fixes #5886

3 years agorun cargo dev update-lints
Matthias Krüger [Mon, 10 Aug 2020 21:55:15 +0000 (23:55 +0200)]
run cargo dev update-lints

3 years agoUpdate clippy_lints/src/unwrap.rs
Matthias Krüger [Mon, 10 Aug 2020 21:50:52 +0000 (23:50 +0200)]
Update clippy_lints/src/unwrap.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
3 years agoUpdate clippy_lints/src/neg_cmp_op_on_partial_ord.rs
Matthias Krüger [Mon, 10 Aug 2020 21:50:40 +0000 (23:50 +0200)]
Update clippy_lints/src/neg_cmp_op_on_partial_ord.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
3 years agoneg-cmp-op-on-partial-ord: make lint adhere to lint message convention
Matthias Krüger [Tue, 28 Jul 2020 10:13:22 +0000 (12:13 +0200)]
neg-cmp-op-on-partial-ord: make lint adhere to lint message convention

3 years agoneg-multiply: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:24:11 +0000 (00:24 +0200)]
neg-multiply: make lint adhere to lint message convention

3 years agooverflow-check-conditional: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:18:34 +0000 (00:18 +0200)]
overflow-check-conditional: make lint adhere to lint message convention

3 years agopath-buf-push-overwrite: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:16:28 +0000 (00:16 +0200)]
path-buf-push-overwrite: make lint adhere to lint message convention

3 years agorange-zip-with-len: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 22:12:21 +0000 (00:12 +0200)]
range-zip-with-len: make lint adhere to lint message convention

3 years agoredundant-static-lifetimes: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:54:34 +0000 (23:54 +0200)]
redundant-static-lifetimes: make lint adhere to lint message convention

3 years agoalso change "deprecated-attribute" message
Matthias Krüger [Thu, 23 Jul 2020 21:46:52 +0000 (23:46 +0200)]
also change "deprecated-attribute" message

3 years agosuspicious-arithmetic-impl: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:45:24 +0000 (23:45 +0200)]
suspicious-arithmetic-impl: make lint adhere to lint message convention

3 years agounknown: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:37:16 +0000 (23:37 +0200)]
unknown: make lint adhere to lint message convention

3 years agoref_in_deref: make lint adhere to lint message convention
Matthias Krüger [Thu, 23 Jul 2020 21:36:20 +0000 (23:36 +0200)]
ref_in_deref: make lint adhere to lint message convention