]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 #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 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 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 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 #75349 - nnethercote:tweak-confusable-idents-checking, r=petrochenkov
bors [Mon, 10 Aug 2020 21:47:29 +0000 (21:47 +0000)]
Auto merge of #75349 - nnethercote:tweak-confusable-idents-checking, r=petrochenkov

Tweak confusable idents checking

The confusable idents checking does some sub-optimal things with symbols.

r? @petrochenkov
cc @crlf0710

3 years agoUse intra-doc links
Denis Vasilik [Mon, 10 Aug 2020 21:16:01 +0000 (23:16 +0200)]
Use intra-doc links

3 years agoRemove links that are in scope
Denis Vasilik [Mon, 10 Aug 2020 21:14:43 +0000 (23:14 +0200)]
Remove links that are in scope

3 years agoFeature gate is always present
Mark Rousskov [Sun, 19 Jul 2020 22:20:01 +0000 (18:20 -0400)]
Feature gate is always present

3 years agoIntroduce `rustc_lexer::is_ident` and use it in couple of places
Vadim Petrochenkov [Mon, 10 Aug 2020 19:27:48 +0000 (22:27 +0300)]
Introduce `rustc_lexer::is_ident` and use it in couple of places

3 years agoAuto merge of #75127 - jyn514:impl-trait, r=pnkfelix
bors [Mon, 10 Aug 2020 19:33:25 +0000 (19:33 +0000)]
Auto merge of #75127 - jyn514:impl-trait, r=pnkfelix

Fix async-std by special-casing rustdoc in typeck

https://github.com/rust-lang/rust/issues/75100

3 years agoAdd missing primary label
Esteban Küber [Mon, 10 Aug 2020 04:24:05 +0000 (21:24 -0700)]
Add missing primary label

3 years agoPoint at item definition in foreign crates
Esteban Küber [Mon, 10 Aug 2020 04:14:59 +0000 (21:14 -0700)]
Point at item definition in foreign crates

3 years agoDo not suggest similarly named enclosing item
Esteban Küber [Mon, 10 Aug 2020 04:02:58 +0000 (21:02 -0700)]
Do not suggest similarly named enclosing item

3 years agoTweak ordering of suggestions
Esteban Küber [Mon, 10 Aug 2020 03:29:39 +0000 (20:29 -0700)]
Tweak ordering of suggestions

Modify logic to make it easier to follow and recover labels that would
otherwise be lost.

3 years agoRemove AsRef link as it is in the prelude
Denis Vasilik [Mon, 10 Aug 2020 18:29:20 +0000 (20:29 +0200)]
Remove AsRef link as it is in the prelude

3 years agoAuto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514
bors [Mon, 10 Aug 2020 17:12:42 +0000 (17:12 +0000)]
Auto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514

Don't print "const" keyword on non-nightly build if rustc_const_unstable is used on the item

Fixes #74579.

3 years agoRemove empty fn main from E0749
Ivan Tham [Mon, 10 Aug 2020 17:06:30 +0000 (01:06 +0800)]
Remove empty fn main from E0749

3 years agoAuto merge of #74953 - JulianKnodt:master, r=lcnr
bors [Mon, 10 Aug 2020 15:19:46 +0000 (15:19 +0000)]
Auto merge of #74953 - JulianKnodt:master, r=lcnr

Remove restriction on type parameters preceding consts w/ feature const-generics

Removed the restriction on type parameters preceding const parameters when the feature const-generics is enabled.

Builds on #74676, which deals with unsorted generic parameters. This just lifts the check in lowering the AST to HIR that permits consts and types to be reordered with respect to each other. Lifetimes still must precede both

This change is not intended for min-const-generics, and is gated behind the `#![feature(const_generics)]`.

One thing is that it also permits type parameters without a default to come after consts, which I expected to not work, and was hoping to get more guidance on whether that should be permitted or how to prevent it otherwise.

I did not go through the RFC process for this pull request because there was prior work to get this feature added. In the previous PR that was cited, work was done to enable this change.

r? @lcnr

3 years agoAdd test for rustc_const_unstable on methods
Guillaume Gomez [Tue, 4 Aug 2020 09:57:28 +0000 (11:57 +0200)]
Add test for rustc_const_unstable on methods

3 years agoAdd help button
Guillaume Gomez [Mon, 10 Aug 2020 14:42:11 +0000 (16:42 +0200)]
Add help button

3 years agoUse : rather than . in example description
Ivan Tham [Mon, 10 Aug 2020 14:46:15 +0000 (22:46 +0800)]
Use : rather than . in example description

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
3 years agoSplit fix into another section for E0749
Ivan Tham [Mon, 10 Aug 2020 14:33:17 +0000 (22:33 +0800)]
Split fix into another section for E0749

3 years agoAuto merge of #75357 - RalfJung:miri, r=RalfJung
bors [Mon, 10 Aug 2020 13:01:44 +0000 (13:01 +0000)]
Auto merge of #75357 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/75274
Cc @rust-lang/miri r? @ghost

3 years agopolymorphize: constrain unevaluated const handling
David Wood [Sun, 9 Aug 2020 10:22:50 +0000 (11:22 +0100)]
polymorphize: constrain unevaluated const handling

This commit 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>>`.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoUse existing `infcx` when emitting trait impl diagnostic
Aaron Hill [Mon, 10 Aug 2020 12:05:43 +0000 (08:05 -0400)]
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 agoAdd sample fix for E0749
Ivan Tham [Mon, 10 Aug 2020 10:51:14 +0000 (18:51 +0800)]
Add sample fix for E0749

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

3 years agounused_delims: trim expr
Bastian Kauschke [Mon, 10 Aug 2020 10:04:51 +0000 (12:04 +0200)]
unused_delims: trim expr

3 years agoUpdate RELEASES.md for 1.46.0
Erin Power [Sat, 25 Jul 2020 14:36:17 +0000 (16:36 +0200)]
Update RELEASES.md for 1.46.0

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
Co-authored-by: Lonami <totufals@hotmail.com>
3 years agoadd test for unused erroneous const in CTFE
Ralf Jung [Mon, 10 Aug 2020 08:58:53 +0000 (10:58 +0200)]
add test for unused erroneous const in CTFE

3 years agoupdate Miri
Ralf Jung [Mon, 10 Aug 2020 08:06:23 +0000 (10:06 +0200)]
update Miri

3 years agoConvert `Eq` impl to check Ord::Equal
kadmin [Sun, 9 Aug 2020 07:50:56 +0000 (07:50 +0000)]
Convert `Eq` impl to check Ord::Equal

3 years agoAuto merge of #75204 - cuviper:freebsd11, r=Mark-Simulacrum
bors [Mon, 10 Aug 2020 05:34:53 +0000 (05:34 +0000)]
Auto merge of #75204 - cuviper:freebsd11, r=Mark-Simulacrum

Upgrade the FreeBSD toolchain to version 11.4

FreeBSD 10 reached its end-of-life in October 2018, and that toolchain
caused issues in the LLVM 11 upgrade (#73526) that are resolved with the
toolchain from FreeBSD 11.

Closes #72390.

3 years agoAuto merge of #74410 - mati865:mingw-no-self-contained-when-cross-compiling, r=petroc...
bors [Mon, 10 Aug 2020 02:08:35 +0000 (02:08 +0000)]
Auto merge of #74410 - mati865:mingw-no-self-contained-when-cross-compiling, r=petrochenkov

MinGW: disable self-contained mode when cross compiling

When cross compiling users have to provide own linker and libraries anyway.
Using rust provided MinGW crt objects is harmful here and has no benefits.

cc https://github.com/rust-lang/rust/issues/68887

3 years agoTransmute between big endian `s6_addr` and `[u16; 8]`.
Lzu Tao [Wed, 5 Aug 2020 10:29:38 +0000 (10:29 +0000)]
Transmute between 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.

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

Co-authored-by: Josh Stone <cuviper@gmail.com>
Co-authored-by: Peter Atashian <retep998@gmail.com>
3 years agoSmall cleanup
Esteban Küber [Mon, 10 Aug 2020 00:48:32 +0000 (17:48 -0700)]
Small cleanup

Remove unnecessary `unwrap`.

3 years agoTweak conditions for E0026 and E0769
Esteban Küber [Sun, 9 Aug 2020 23:56:47 +0000 (16:56 -0700)]
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 agoAuto merge of #75351 - JohnTitor:rollup-q9udsyx, r=JohnTitor
bors [Mon, 10 Aug 2020 00:09:45 +0000 (00:09 +0000)]
Auto merge of #75351 - JohnTitor:rollup-q9udsyx, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #74200 (Std panicking unsafe block in unsafe fn)
 - #75286 (Add additional case for Path starts with)
 - #75318 (Resolve `char` as a primitive even if there is a module in scope)
 - #75320 (Detect likely `for foo of bar` JS syntax)
 - #75328 (Cleanup E0749)
 - #75344 (Rename "Important traits" to "Notable traits")
 - #75348 (Move to intra-doc links in library/core/src/time.rs)
 - #75350 (Do not ICE when lowering invalid extern fn with bodies)

Failed merges:

r? @ghost

3 years agoRollup merge of #75350 - estebank:foreign-fn-with-body-ice, r=davidtwco
Yuki Okushi [Mon, 10 Aug 2020 00:08:03 +0000 (09:08 +0900)]
Rollup merge of #75350 - estebank:foreign-fn-with-body-ice, r=davidtwco

Do not ICE when lowering invalid extern fn with bodies

Fix #75283.

3 years agoRollup merge of #75348 - denisvasilik:intra-doc-links-core-time, r=jyn514
Yuki Okushi [Mon, 10 Aug 2020 00:08:01 +0000 (09:08 +0900)]
Rollup merge of #75348 - denisvasilik:intra-doc-links-core-time, r=jyn514

Move to intra-doc links in library/core/src/time.rs

Helps with #75080.

3 years agoRollup merge of #75344 - camelid:rename-important-to-notable-traits, r=Manishearth
Yuki Okushi [Mon, 10 Aug 2020 00:07:59 +0000 (09:07 +0900)]
Rollup merge of #75344 - camelid:rename-important-to-notable-traits, r=Manishearth

Rename "Important traits" to "Notable traits"

Fixes #75245.

---

* Rename it in the UI
* Rename the CSS classes

3 years agoRollup merge of #75328 - GuillaumeGomez:cleanup-e0749, r=Dylan-DPC
Yuki Okushi [Mon, 10 Aug 2020 00:07:57 +0000 (09:07 +0900)]
Rollup merge of #75328 - GuillaumeGomez:cleanup-e0749, r=Dylan-DPC

Cleanup E0749

r? @pickfire

3 years agoRollup merge of #75320 - estebank:js-for-i-of-x, r=davidtwco
Yuki Okushi [Mon, 10 Aug 2020 00:07:56 +0000 (09:07 +0900)]
Rollup merge of #75320 - estebank:js-for-i-of-x, r=davidtwco

Detect likely `for foo of bar` JS syntax

Fix #75311.

3 years agoRollup merge of #75318 - jyn514:primitive, r=manishearth
Yuki Okushi [Mon, 10 Aug 2020 00:07:54 +0000 (09:07 +0900)]
Rollup merge of #75318 - jyn514:primitive, r=manishearth

Resolve `char` as a primitive even if there is a module in scope

Closes https://github.com/rust-lang/rust/issues/58699.
r? @Manishearth

3 years agoRollup merge of #75286 - pickfire:patch-9, r=jyn514
Yuki Okushi [Mon, 10 Aug 2020 00:07:52 +0000 (09:07 +0900)]
Rollup merge of #75286 - pickfire:patch-9, r=jyn514

Add additional case for Path starts with

Show what happens if there is an extra extension

3 years agoRollup merge of #74200 - poliorcetics:std-panicking-unsafe-block-in-unsafe-fn, r...
Yuki Okushi [Mon, 10 Aug 2020 00:07:46 +0000 (09:07 +0900)]
Rollup merge of #74200 - poliorcetics:std-panicking-unsafe-block-in-unsafe-fn, r=Mark-Simulacrum

Std panicking unsafe block in unsafe fn

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/panicking.rs`.

I also made a two lines change to `libstd/thread/local.rs` to add the necessary `unsafe` block without breaking everything else.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn

3 years agoDo not ICE when lowering invalid extern fn with bodies
Esteban Küber [Sun, 9 Aug 2020 22:12:59 +0000 (15:12 -0700)]
Do not ICE when lowering invalid extern fn with bodies

Fix #75283.

3 years agoAuto merge of #75345 - Aaron1011:fix/no-std-hygiene, r=petrochenkov
bors [Sun, 9 Aug 2020 22:08:02 +0000 (22:08 +0000)]
Auto merge of #75345 - Aaron1011:fix/no-std-hygiene, r=petrochenkov

Remove normalization of `Span` debug output in proc-macro tests

Fixes #74800

The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.

Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".

This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.

Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.

3 years agoAdd link for Duration
Denis Vasilik [Sun, 9 Aug 2020 21:26:42 +0000 (23:26 +0200)]
Add link for Duration

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRemove `CowBoxSymStr`.
Nicholas Nethercote [Thu, 6 Aug 2020 02:48:53 +0000 (12:48 +1000)]
Remove `CowBoxSymStr`.

`CowBoxSymStr` is a type that either holds a `SymbolStr` (which is much
the same as a `Symbol`), or an owned string. When computing skeletons,
a `SymbolStr` is stored if the skeleton is the same as the original
string, otherwise an owned string is stored.

So, basically, `CowBoxSymStr` is a type for string interning. But we
already have one of those: `Symbol` itself. This PR removes
`CowBoxSymStr`, using `Symbol` instead. A good thing about this is that
it avoids storing `SymbolStr` values in `skeleton_map`, something that
is discouraged.

The PR also inlines and removes the `calc_skeleton()` function because
that simplifies the code.

3 years agoFix symbol ordering for confusable idents detection.
Nicholas Nethercote [Wed, 5 Aug 2020 07:29:13 +0000 (17:29 +1000)]
Fix symbol ordering for confusable idents detection.

Confusable idents detection uses a type `BTreeMap<Symbol, Span>`. This is
highly dubious given that `Symbol` doesn't guarantee a meaningful order. (In
practice, it currently gives an order that mostly matches source code order.)

As a result, changes in `Symbol` representation make the
`lint-confusable-idents.rs` test fail, because this error message:

> identifier pair considered confusable between `s` and `s`

is changed to this:

> identifier pair considered confusable between `s` and `s`

and the corresponding span pointers get swapped erroneously, leading to
an incorrect "previous identifier" label.

This commit sorts the relevant symbols by span before doing the checking,
which ensures that the ident that appears first in the code will be mentioned
first in the message. The commit also extends the test slightly to be more
thorough.

3 years agoRemove liNone as it is in the prelude
Denis Vasilik [Sun, 9 Aug 2020 21:12:30 +0000 (23:12 +0200)]
Remove liNone as it is in the prelude

3 years agoUse intra-doc links
Denis Vasilik [Sun, 9 Aug 2020 21:06:44 +0000 (23:06 +0200)]
Use intra-doc links

3 years agoRustdoc: Fix natural ordering to look at all numbers.
Mara Bos [Sun, 9 Aug 2020 19:23:19 +0000 (21:23 +0200)]
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.

3 years agoAuto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum
bors [Sun, 9 Aug 2020 20:08:50 +0000 (20:08 +0000)]
Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum

Upgrade indexmap and use it more

First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order.

Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`.

Closes #60608.
r? @eddyb

3 years agorustc_span: note the perf loss seen from IndexSet in symbol::Interner
Josh Stone [Sun, 9 Aug 2020 19:41:09 +0000 (12:41 -0700)]
rustc_span: note the perf loss seen from IndexSet in symbol::Interner

3 years agorustc_typeck: use IndexSet in InteriorVisitor
Josh Stone [Sat, 8 Aug 2020 03:55:01 +0000 (20:55 -0700)]
rustc_typeck: use IndexSet in InteriorVisitor

3 years agorustc_typeck: use IndexSet in UniquePredicates
Josh Stone [Sat, 8 Aug 2020 03:54:09 +0000 (20:54 -0700)]
rustc_typeck: use IndexSet in UniquePredicates

3 years agorustc_span: use IndexSet in SpanInterner
Josh Stone [Sat, 8 Aug 2020 03:50:53 +0000 (20:50 -0700)]
rustc_span: use IndexSet in SpanInterner

3 years agorustc_mir_build: use IndexMap in TestKind::SwitchInt
Josh Stone [Sat, 8 Aug 2020 03:49:51 +0000 (20:49 -0700)]
rustc_mir_build: use IndexMap in TestKind::SwitchInt

3 years agorustc_mir: use IndexSet in PlaceholderIndices
Josh Stone [Sat, 8 Aug 2020 03:48:00 +0000 (20:48 -0700)]
rustc_mir: use IndexSet in PlaceholderIndices

3 years agorustc_mir: use IndexMap in BorrowSet
Josh Stone [Sat, 8 Aug 2020 03:47:33 +0000 (20:47 -0700)]
rustc_mir: use IndexMap in BorrowSet

3 years agorustc_middle: use IndexSet in OnDiskCache
Josh Stone [Sat, 8 Aug 2020 03:44:47 +0000 (20:44 -0700)]
rustc_middle: use IndexSet in OnDiskCache