]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #80100 - mark-i-m:pattORns-2, r=petrochenkov
bors [Sun, 20 Dec 2020 04:10:44 +0000 (04:10 +0000)]
Auto merge of #80100 - mark-i-m:pattORns-2, r=petrochenkov

or_patterns: implement :pat edition-specific behavior

cc #54883 `@joshtriplett`

This PR implements the edition-specific behavior of `:pat` wrt or-patterns, as determined by the crater runs and T-lang consensus in https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090.

I believe this can unblock stabilization of or_patterns.

r? `@petrochenkov`

3 years agoSkip `dsymutil` by default for compiler bootstrap
J. Ryan Stinnett [Sun, 20 Dec 2020 02:49:18 +0000 (02:49 +0000)]
Skip `dsymutil` by default for compiler bootstrap

`dsymutil` adds time to builds on Apple platforms for no clear benefit, and also
makes it more difficult for debuggers to find debug info. The compiler currently
defaults to running `dsymutil` to preserve its historical default, but when
compiling the compiler itself, we skip it by default since we know it's safe to
do so in that case.

3 years agoHandle desugaring in impl trait bound suggestion
William Bain [Sat, 19 Dec 2020 21:52:19 +0000 (16:52 -0500)]
Handle desugaring in impl trait bound suggestion

3 years agoAuto merge of #79635 - lcnr:const-eval-idk, r=oli-obk
bors [Sun, 20 Dec 2020 00:50:46 +0000 (00:50 +0000)]
Auto merge of #79635 - lcnr:const-eval-idk, r=oli-obk

const_evaluatable_checked: fix occurs check

fixes #79615

this is kind of a hack because we use `TypeRelation` for both the `Generalizer` and the `ConstInferUnifier` but i am not sure if there is a useful way to disentangle this without unnecessarily duplicating some code.

The error in the added test is kind of unavoidable until we erase the unused substs of `ConstKind::Unevaluated`. We talked a bit about this in the cg lazy norm meeting (https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/lazy_normalization_consts)

3 years agoUse pointer type in AtomicPtr::swap implementation
Tomasz Miąsko [Sun, 20 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Use pointer type in AtomicPtr::swap implementation

3 years agoReserve necessary space for params in generics_of
Dániel Buga [Sat, 19 Dec 2020 23:50:06 +0000 (00:50 +0100)]
Reserve necessary space for params in generics_of

3 years agoimpl Default for LangString, replacing all_false by default
Alexis Bourget [Sat, 19 Dec 2020 23:21:42 +0000 (00:21 +0100)]
impl Default for LangString, replacing all_false by default

3 years agodocs: Edit rustc_middle::ty::query::on_disk_cache
pierwill [Sat, 19 Dec 2020 22:25:24 +0000 (14:25 -0800)]
docs: Edit rustc_middle::ty::query::on_disk_cache

Expand abbreviations for "incremental compliation".

Also added the word "to" to the description of CacheEncoder.

3 years agoEdit rustc_middle::lint::LintSource docs
pierwill [Sat, 19 Dec 2020 22:08:41 +0000 (14:08 -0800)]
Edit rustc_middle::lint::LintSource docs

Edit punctuation in doc comment for rustc_middle::lint::LintSource::CommandLine.

3 years agoAuto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto
bors [Sat, 19 Dec 2020 22:01:45 +0000 (22:01 +0000)]
Auto merge of #6477 - xFrednet:0000-enable-search-with-dashes, r=ebroto

Adapted the website search for better matching

* This adds the ability to search for ids with dashes and spaces in the name.
    * Example: `missing-errors-doc` and `missing errors doc` are now valid aliases for lint names
* It also improves the fuzzy search in the description. This search will now match any lint that where all searched words are inside the description.
    * Example: `doc section` finds two lints in our selection

This was suggested/discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Enable.20lint.20search.20with.20dashes/near/220469464)

### Testing
These changes can be tested locally by:
1. Clone this branch
2. Download the current lint index from the [gh-pages branch](https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json)
3. Put it next to the `util/gh-pages/index.html` and open the html file. Make sure that it can load the lint data. (Browsers can be a bit iffy when opening a loacl html page and loading data)

### Note
I found that searching only a few characters (< 3) seams slow and deleting one even more as almost every lint description contains them. This also happens in our current [lint list](https://rust-lang.github.io/rust-clippy/master/index.html). We could change the search to only be triggered if the search field contains more than 3 letters to slightly improve performance.

---

changelog: Adapted the website search for better matching

3 years agoAuto merge of #79473 - m-ou-se:clamp-in-core, r=m-ou-se
bors [Sat, 19 Dec 2020 21:57:38 +0000 (21:57 +0000)]
Auto merge of #79473 - m-ou-se:clamp-in-core, r=m-ou-se

Move {f32,f64}::clamp to core.

`clamp` was recently stabilized (tracking issue: https://github.com/rust-lang/rust/issues/44095). But although `Ord::clamp` was added in `core` (because `Ord` is in `core`), the versions for the `f32` and `f64` primitives were added in `std` (together with `floor`, `sin`, etc.), not in `core` (together with `min`, `max`, `from_bits`, etc.).

This change moves them to `core`, such that `clamp` on floats is available in `no_std` programs as well.

3 years agoAuto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto
bors [Sat, 19 Dec 2020 21:39:19 +0000 (21:39 +0000)]
Auto merge of #6316 - ThibsG:WrongSelfConventionTraitDef, r=ebroto

Lint also in trait def for `wrong_self_convention`

Extends `wrong_self_convention` to lint also in trait definition.

By the way, I think the `wrong_pub_self_convention` [example](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/clippy_lints/src/methods/mod.rs#L197) is misleading.
On [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=32615ab3f6009e7e42cc3754be0ca17f), it fires `wrong_self_convention`, so the example (or the lint maybe?) needs to be reworked.
The difference with `wrong_self_convention` [example](https://github.com/rust-lang/rust-clippy/blob/dd826b4626c00da53f76f00f02f03556803e9cdb/clippy_lints/src/methods/mod.rs#L172) is mainly the `pub` keyword on the method `as_str`, but the lint doesn't use the function visibility as condition to choose which lint to fire (in fact it uses the visibility of the impl item).

fixes: #6307

changelog: Lint `wrong_self_convention` lint in trait def also

3 years agoalso const-check FakeRead
Ralf Jung [Sat, 19 Dec 2020 19:25:27 +0000 (20:25 +0100)]
also const-check FakeRead

3 years agoAuto merge of #80104 - Nadrieril:usefulness-merging, r=varkor
bors [Sat, 19 Dec 2020 19:14:04 +0000 (19:14 +0000)]
Auto merge of #80104 - Nadrieril:usefulness-merging, r=varkor

Improve and fix diagnostics of exhaustiveness checking

Primarily, this fixes https://github.com/rust-lang/rust/issues/56379. This also fixes incorrect interactions between or-patterns and slice patterns that I discovered while working on #56379. Those two examples show the incorrect diagnostics:

```rust
match &[][..] {
    [true] => {}
    [true // detected as unreachable but that's not true
        | false, ..] => {}
    _ => {}
}
match (true, None) {
    (true, Some(_)) => {}
    (false, Some(true)) => {}
    (true | false, None | Some(true // should be detected as unreachable
                               | false)) => {}
}
```

I did not measure any perf impact. However, I suspect that [`616ba9f`](https://github.com/rust-lang/rust/pull/80104/commits/616ba9f9f7f5845777a36e1a41a515e6c33a8776) should have a negative impact on large or-patterns. I'll see what the perf run says; I have optimization ideas up my sleeve if needed.

EDIT: I initially had a noticeable perf impact that I thought unavoidable. I then proceeded to avoid it x)

r? `@varkor`
`@rustbot` label +A-exhaustiveness-checking

3 years agoTweak diagnostics
Nadrieril [Sat, 19 Dec 2020 17:48:31 +0000 (17:48 +0000)]
Tweak diagnostics

3 years agoAdapted the website search for better matching
xFrednet [Sat, 19 Dec 2020 16:12:36 +0000 (16:12 +0000)]
Adapted the website search for better matching

* Formatting

3 years agoAuto merge of #80132 - matthewjasper:revert-eval-order, r=nikomatsakis
bors [Sat, 19 Dec 2020 16:20:22 +0000 (16:20 +0000)]
Auto merge of #80132 - matthewjasper:revert-eval-order, r=nikomatsakis

Revert change to trait evaluation order

This change breaks some code and doesn't appear to enable any new code.

closes #79902

r? `@nikomatsakis`

3 years agoAuto merge of #6473 - phansch:split-up-ui-test, r=flip1995
bors [Sat, 19 Dec 2020 13:58:22 +0000 (13:58 +0000)]
Auto merge of #6473 - phansch:split-up-ui-test, r=flip1995

UI Tests: Separate suspicious_else_formatting tests

Was briefly looking into https://github.com/rust-lang/rust-clippy/issues/3864 when I saw that the tests could benefit from being in their own file.

---
changelog: none

3 years agoAuto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk
bors [Sat, 19 Dec 2020 13:13:41 +0000 (13:13 +0000)]
Auto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk

Stabilize all stable methods of `Ipv4Addr`, `Ipv6Addr` and `IpAddr` as const

This PR stabilizes all currently stable methods of `Ipv4Addr`, `Ipv6Addr` and `IpAddr` as const.
Tracking issue: #76205

`Ipv4Addr` (`const_ipv4`):
 - `octets`
 - `is_loopback`
 - `is_private`
 - `is_link_local`
 - `is_multicast`
 - `is_broadcast`
 - `is_docmentation`
 - `to_ipv6_compatible`
 - `to_ipv6_mapped`

`Ipv6Addr` (`const_ipv6`):
 - `segments`
 - `is_unspecified`
 - `is_loopback`
 - `is_multicast`
 - `to_ipv4`

`IpAddr` (`const_ip`):
 - `is_unspecified`
 - `is_loopback`
 - `is_multicast`

## Motivation
The ip methods seem like prime candidates to be made const: their behavior is defined by an external spec, and based solely on the byte contents of an address. These methods have been made unstable const in the beginning of September, after the necessary const integer arithmetic was stabilized.

There is currently a PR open (#78802) to change the internal representation of `IpAddr{4,6}` from `libc` types to a byte array. This does not have any impact on the constness of the methods.

## Implementation
Most of the stabilizations are straightforward, with the exception of `Ipv6Addr::segments`, which uses the unstable feature `const_fn_transmute`. The code could be rewritten to equivalent stable code, but this leads to worse code generation (#75085).
This is why `segments` gets marked with `#[rustc_allow_const_fn_unstable(const_fn_transmute)]`, like the already const-stable `Ipv6Addr::new`, the justification being that a const-stable alternative implementation exists https://github.com/rust-lang/rust/pull/76206#issuecomment-685044184.

## Future posibilities
This PR const-stabilizes all currently stable ip methods, however there are also a number of unstable methods under the `ip` feature (#27709). These methods are already unstable const. There is a PR open (#76098) to stabilize those methods, which could include const-stabilization. However, stabilizing those methods as const is dependent on `Ipv4Addr::octets` and `Ipv6Addr::segments` (covered by this PR).

3 years agoimplement edition-specific :pat behavior for 2015/18
mark [Wed, 11 Nov 2020 00:00:53 +0000 (18:00 -0600)]
implement edition-specific :pat behavior for 2015/18

3 years agoUI Tests: Separate suspicious_else_formatting tests
Philipp Hansch [Sat, 19 Dec 2020 12:54:38 +0000 (13:54 +0100)]
UI Tests: Separate suspicious_else_formatting tests

3 years agoAuto merge of #6471 - phansch:fix-bless, r=flip1995
bors [Sat, 19 Dec 2020 12:28:00 +0000 (12:28 +0000)]
Auto merge of #6471 - phansch:fix-bless, r=flip1995

Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious there. The shell script did a `-s` test which
reads the file as well.

changelog: internal: Fix `cargo dev bless` when new reference files are added

3 years agoAuto merge of #80106 - jackh726:binder-refactor-part-2, r=lcnr
bors [Sat, 19 Dec 2020 10:13:52 +0000 (10:13 +0000)]
Auto merge of #80106 - jackh726:binder-refactor-part-2, r=lcnr

A lot of refactoring to remove more `Binder::bind`s

Split out from #76814

3 years agoMore rebinds
Jack Huey [Thu, 17 Dec 2020 03:36:14 +0000 (22:36 -0500)]
More rebinds

3 years agoMore rebinds
Jack Huey [Thu, 17 Dec 2020 03:36:14 +0000 (22:36 -0500)]
More rebinds

3 years agoFix blessing of new reference files
Philipp Hansch [Sat, 19 Dec 2020 07:25:42 +0000 (08:25 +0100)]
Fix blessing of new reference files

Adding of new reference files wasn't handled correctly. It was trying to
read a file that didn't exist yet.

Instead of unwrapping, we now treat a missing reference file as empty
(`Vec::new`). This makes the following conditional work. We then also
have to re-read the reference file after it was being copied. This
second read is technically the same as in the old shell script, but
wasn't really obvious. The shell script did a `-s` test which reads the
file.

3 years agoAuto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs,...
bors [Sat, 19 Dec 2020 07:35:04 +0000 (07:35 +0000)]
Auto merge of #6464 - ahouts:make-needless_update-ignore-non_exhaustive-structs, r=phansch

make needless_update ignore non_exhaustive structs

changelog: make `needless_update` lint ignore `non_exhaustive` structs

fixes #6323

3 years agoAuto merge of #80180 - JohnTitor:rollup-a31s996, r=JohnTitor
bors [Sat, 19 Dec 2020 07:23:41 +0000 (07:23 +0000)]
Auto merge of #80180 - JohnTitor:rollup-a31s996, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #78083 (Stabilize or_insert_with_key)
 - #79211 (Add the "async" and "promise" doc aliases to `core::future::Future`)
 - #79612 (Switch some links in compiler/ to intra-doc links)
 - #80068 (Add `&mut` as an alias for 'reference' primitive)
 - #80129 (docs: Edit rustc_ast::token::Token)
 - #80133 (Suppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere)
 - #80155 (Fix typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #80155 - matsujika:matsujika-patch-1, r=jonas-schievink
Yuki Okushi [Sat, 19 Dec 2020 06:16:10 +0000 (15:16 +0900)]
Rollup merge of #80155 - matsujika:matsujika-patch-1, r=jonas-schievink

Fix typo

3 years agoRollup merge of #80133 - Aaron1011:fix/const-mut-deref, r=estebank
Yuki Okushi [Sat, 19 Dec 2020 06:16:08 +0000 (15:16 +0900)]
Rollup merge of #80133 - Aaron1011:fix/const-mut-deref, r=estebank

Suppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere

Fixes #79971

3 years agoRollup merge of #80129 - pierwill:patch-6, r=estebank
Yuki Okushi [Sat, 19 Dec 2020 06:16:07 +0000 (15:16 +0900)]
Rollup merge of #80129 - pierwill:patch-6, r=estebank

docs: Edit rustc_ast::token::Token

Add missing punctuation.

3 years agoRollup merge of #80068 - jyn514:mut-reference, r=m-ou-se
Yuki Okushi [Sat, 19 Dec 2020 06:16:05 +0000 (15:16 +0900)]
Rollup merge of #80068 - jyn514:mut-reference, r=m-ou-se

Add `&mut` as an alias for 'reference' primitive

Closes https://github.com/rust-lang/rust/issues/46075.

3 years agoRollup merge of #79612 - jyn514:compiler-links, r=Aaron1011
Yuki Okushi [Sat, 19 Dec 2020 06:16:03 +0000 (15:16 +0900)]
Rollup merge of #79612 - jyn514:compiler-links, r=Aaron1011

Switch some links in compiler/ to intra-doc links

3 years agoRollup merge of #79211 - yoshuawuyts:future-doc-alias, r=Mark-Simulacrum
Yuki Okushi [Sat, 19 Dec 2020 06:16:01 +0000 (15:16 +0900)]
Rollup merge of #79211 - yoshuawuyts:future-doc-alias, r=Mark-Simulacrum

Add the "async" and "promise" doc aliases to `core::future::Future`

Adds the "async" and "promise" doc aliases to `core::future::Future`. This enables people who search for "async" or "promise" to find `Future`, which is Rust's core primitive for async programming. Thanks!

3 years agoRollup merge of #78083 - ChaiTRex:master, r=m-ou-se
Yuki Okushi [Sat, 19 Dec 2020 06:15:57 +0000 (15:15 +0900)]
Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se

Stabilize or_insert_with_key

Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/71024. This allows inserting key-derived values when a `HashMap`/`BTreeMap` entry is vacant.

The difference between this and  `.or_insert_with(|| ... )` is that this provides a reference to the key to the closure after it is moved with `.entry(key_being_moved)`, avoiding the need to copy or clone the key.

3 years agoAuto merge of #79073 - davidtwco:issue-78957-const-param-attrs, r=lcnr
bors [Sat, 19 Dec 2020 04:32:50 +0000 (04:32 +0000)]
Auto merge of #79073 - davidtwco:issue-78957-const-param-attrs, r=lcnr

passes: prohibit invalid attrs on generic params

Fixes #78957.

This PR modifies the `check_attr` pass so that attribute placement on generic parameters is checked for validity.

r? `@lcnr`

3 years agoOnDiskCache: avoid storing local def id hashes in foreign def id collection
Tyson Nottingham [Sat, 19 Dec 2020 02:40:16 +0000 (18:40 -0800)]
OnDiskCache: avoid storing local def id hashes in foreign def id collection

3 years agorustc_query_system: explicitly register reused dep nodes
Tyson Nottingham [Sat, 19 Dec 2020 00:00:52 +0000 (16:00 -0800)]
rustc_query_system: explicitly register reused dep nodes

Register nodes that we've reused from the previous session explicitly
with `OnDiskCache`. Previously, we relied on this happening as a side
effect of accessing the nodes in the `PreviousDepGraph`. For the sake of
performance and avoiding unintended side effects, register explictily.

3 years agoAuto merge of #77035 - mibac138:fn-fat-arrow-return, r=davidtwco
bors [Sat, 19 Dec 2020 01:47:05 +0000 (01:47 +0000)]
Auto merge of #77035 - mibac138:fn-fat-arrow-return, r=davidtwco

Gracefully handle mistyping -> as => in function return type

Fixes #77019

3 years agoremove example
Andrew Houts [Sat, 19 Dec 2020 01:15:05 +0000 (19:15 -0600)]
remove example

3 years agoAuto merge of #80154 - GuillaumeGomez:str-to-symbol, r=jyn514
bors [Fri, 18 Dec 2020 22:54:47 +0000 (22:54 +0000)]
Auto merge of #80154 - GuillaumeGomez:str-to-symbol, r=jyn514

Continue String to Symbol conversion in rustdoc (2)

Follow-up of #80119.

This is the last one (and I actually expected more conversions but seems like it was the last one remaining...).

r? `@jyn514`

3 years agoFix unused import error on wasm
DrMeepster [Fri, 18 Dec 2020 22:53:55 +0000 (14:53 -0800)]
Fix unused import error on wasm

3 years agoAuto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995
bors [Fri, 18 Dec 2020 22:40:08 +0000 (22:40 +0000)]
Auto merge of #6470 - xFrednet:0000-rename-good-first-issue-in-docs, r=flip1995

Renamed the good first issue label in CONTRIBUTING.md

Follow up from #6468

Grep found some more references to the old `good first issue`.

[CONTRIBUTING.md rendered](https://github.com/xFrednet/rust-clippy/blob/0000-rename-good-first-issue-in-docs/CONTRIBUTING.md)

<details>
<summary>grep output</summary>

```
$ grep -Ri "good first issue" rust-clippy/
rust-clippy/.git/COMMIT_EDITMSG:Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/HEAD:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000     commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2bb8a638a63edc1f3503c8771937aa19157 xFrednet <xFrednet@gmail.com> 1608326295 +0000  commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f28671ddb9ccf9b44131d522f4fdeab7097 xFrednet <xFrednet@gmail.com> 1608329602 +0000  commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/CONTRIBUTING.md:Some issues are easier than others. The [`good first issue`] label can be used to find the easy issues.
rust-clippy/CONTRIBUTING.md:[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
rust-clippy/CONTRIBUTING.md:[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
```
</details>

---

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label in CONTRIBUTING.md
xFrednet [Fri, 18 Dec 2020 22:13:22 +0000 (22:13 +0000)]
Renamed the good first issue label in CONTRIBUTING.md

3 years agoAuto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995
bors [Fri, 18 Dec 2020 21:25:39 +0000 (21:25 +0000)]
Auto merge of #6468 - xFrednet:0000-rename-good-first-issue-for-rustbot, r=flip1995

Renamed the good first issue label for rustbot

The `good first issue` label got renamed to `good-first-issue`. See [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428379) to enable the assignment with rustbot.

changelog: None

r? `@flip1995`

3 years agoRenamed the good first issue label for rustbot
xFrednet [Fri, 18 Dec 2020 21:18:15 +0000 (21:18 +0000)]
Renamed the good first issue label for rustbot

See https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Rename.20the.20.22good.20first.20issue.22.20label.20for.20bot.20usage/near/220428018

3 years agoChange potentially_qualified to be defined on Binder<PredicateAtom>
Jack Huey [Thu, 17 Dec 2020 02:13:29 +0000 (21:13 -0500)]
Change potentially_qualified to be defined on Binder<PredicateAtom>

3 years agoMake BoundRegion have a kind of BoungRegionKind
Jack Huey [Fri, 18 Dec 2020 18:24:55 +0000 (13:24 -0500)]
Make BoundRegion have a kind of BoungRegionKind

3 years agoSwitch compiler/ to intra-doc links
Joshua Nelson [Tue, 1 Dec 2020 22:41:09 +0000 (17:41 -0500)]
Switch compiler/ to intra-doc links

rustc_lint and rustc_lint_defs weren't switched because they're included
in the compiler book and so can't use intra-doc links.

3 years agoAuto merge of #80081 - ehuss:update-cargo, r=Mark-Simulacrum
bors [Fri, 18 Dec 2020 19:09:17 +0000 (19:09 +0000)]
Auto merge of #80081 - ehuss:update-cargo, r=Mark-Simulacrum

Update cargo

4 commits in d274fcf862b89264fa2c6b917b15230705257317..a3c2627fbc2f5391c65ba45ab53b81bf71fa323c
2020-12-07 23:08:44 +0000 to 2020-12-14 17:21:26 +0000
- Check if rerun-if-changed points to a directory. (rust-lang/cargo#8973)
- Implement external credential process. (RFC 2730) (rust-lang/cargo#8934)
- Revert recent build-std vendoring changes (rust-lang/cargo#8968)
- Fix the unit dependency graph with dev-dependency `links` (rust-lang/cargo#8969)

3 years agoAdd array search aliases
Joshua Nelson [Fri, 18 Dec 2020 16:36:10 +0000 (11:36 -0500)]
Add array search aliases

3 years agoUnify the two kinds of usefulness merging
Nadrieril [Thu, 17 Dec 2020 01:56:22 +0000 (01:56 +0000)]
Unify the two kinds of usefulness merging

This is elegant but a bit of a perf gamble. That said, or-patterns
rarely have many branches and it's easy to optimize or revert if we ever
need to. In the meantime simpler code is worth it.

3 years agoMerge unreachable subpatterns correctly
Nadrieril [Thu, 17 Dec 2020 01:25:53 +0000 (01:25 +0000)]
Merge unreachable subpatterns correctly

3 years agoKeep all witnesses of non-exhaustiveness
Nadrieril [Thu, 17 Dec 2020 01:18:01 +0000 (01:18 +0000)]
Keep all witnesses of non-exhaustiveness

3 years agoRewrite usefulness merging using `SpanSet`
Nadrieril [Thu, 17 Dec 2020 01:07:49 +0000 (01:07 +0000)]
Rewrite usefulness merging using `SpanSet`

`SpanSet` is heavily inspired from `DefIdForest`.

3 years agoLog the output of `is_useful` in the or-pattern case too
Nadrieril [Thu, 17 Dec 2020 00:47:31 +0000 (00:47 +0000)]
Log the output of `is_useful` in the or-pattern case too

3 years agoFactor out or-pattern usefulness merging
Nadrieril [Wed, 16 Dec 2020 06:24:31 +0000 (06:24 +0000)]
Factor out or-pattern usefulness merging

3 years agoAdd tests
Nadrieril [Thu, 17 Dec 2020 00:42:49 +0000 (00:42 +0000)]
Add tests

3 years agoAuto merge of #80156 - RalfJung:rollup-m3poz8z, r=RalfJung
bors [Fri, 18 Dec 2020 16:17:23 +0000 (16:17 +0000)]
Auto merge of #80156 - RalfJung:rollup-m3poz8z, r=RalfJung

Rollup of 6 pull requests

Successful merges:

 - #80121 (Change the message for `if_let_guard` feature gate)
 - #80130 (docs: Edit rustc_span::symbol::Symbol method)
 - #80135 (Don't allow `const` to begin a nonterminal)
 - #80145 (Fix typo in rustc_typeck docs)
 - #80146 (Edit formatting in Rust Prelude docs)
 - #80147 (Add missing punctuation to std::alloc docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoUpdate cargo
Eric Huss [Wed, 16 Dec 2020 17:03:33 +0000 (09:03 -0800)]
Update cargo

3 years agoAdd the "promise" aliases to the `async` lang feature
Yoshua Wuyts [Thu, 19 Nov 2020 20:22:32 +0000 (21:22 +0100)]
Add the "promise" aliases to the `async` lang feature

3 years agoRollup merge of #80147 - pierwill:patch-9, r=lcnr
Ralf Jung [Fri, 18 Dec 2020 15:22:14 +0000 (16:22 +0100)]
Rollup merge of #80147 - pierwill:patch-9, r=lcnr

Add missing punctuation to std::alloc docs

Add a period to first line of module docs to match other modules in std.

3 years agoRollup merge of #80146 - pierwill:pierwill-prelude-mod-docs, r=lcnr
Ralf Jung [Fri, 18 Dec 2020 15:22:13 +0000 (16:22 +0100)]
Rollup merge of #80146 - pierwill:pierwill-prelude-mod-docs, r=lcnr

Edit formatting in Rust Prelude docs

Use consistent punctuation and capitalization in the list of things re-exported in the prelude.

Also adds a (possibly missing) word.

3 years agoRollup merge of #80145 - pierwill:patch-8, r=lcnr
Ralf Jung [Fri, 18 Dec 2020 15:22:11 +0000 (16:22 +0100)]
Rollup merge of #80145 - pierwill:patch-8, r=lcnr

Fix typo in rustc_typeck docs

3 years agoRollup merge of #80135 - camelid:const-macro-nt, r=petrochenkov
Ralf Jung [Fri, 18 Dec 2020 15:22:09 +0000 (16:22 +0100)]
Rollup merge of #80135 - camelid:const-macro-nt, r=petrochenkov

Don't allow `const` to begin a nonterminal

Fixes #79908.

Thanks to Vadim Petrochenkov who [told me what the fix was][z]!

[z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422

r? ``@petrochenkov``

3 years agoRollup merge of #80130 - pierwill:patch-7, r=oli-obk
Ralf Jung [Fri, 18 Dec 2020 15:22:07 +0000 (16:22 +0100)]
Rollup merge of #80130 - pierwill:patch-7, r=oli-obk

docs: Edit rustc_span::symbol::Symbol method

Edit wording of the doc comment for [rustc_span::symbol::Symbol::can_be_raw](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/symbol/struct.Symbol.html#method.can_be_raw) to match related methods.

3 years agoRollup merge of #80121 - LeSeulArtichaut:if-let-experimental, r=davidtwco
Ralf Jung [Fri, 18 Dec 2020 15:22:06 +0000 (16:22 +0100)]
Rollup merge of #80121 - LeSeulArtichaut:if-let-experimental, r=davidtwco

Change the message for `if_let_guard` feature gate

`if-let` guards are now implemented by #79051 🎉
Thanks ``@camelid`` for pointing this out 🙂

3 years agoCalculate stability, const_stability, and deprecation on-demand
Joshua Nelson [Wed, 16 Dec 2020 20:54:05 +0000 (15:54 -0500)]
Calculate stability, const_stability, and deprecation on-demand

Previously, they would always be calculated ahead of time, which bloated
the size of `clean::Item`.

3 years agoFix typo
Hirochika Matsumoto [Fri, 18 Dec 2020 13:13:25 +0000 (22:13 +0900)]
Fix typo

3 years agoAuto merge of #79485 - EllenNyan:stabilize_unsafe_cell_get_mut, r=m-ou-se
bors [Fri, 18 Dec 2020 11:39:26 +0000 (11:39 +0000)]
Auto merge of #79485 - EllenNyan:stabilize_unsafe_cell_get_mut, r=m-ou-se

Stabilize `unsafe_cell_get_mut`

Tracking issue: #76943

r? `@m-ou-se`

3 years agoContinue String to Symbol conversion in rustdoc
Guillaume Gomez [Fri, 18 Dec 2020 11:05:51 +0000 (12:05 +0100)]
Continue String to Symbol conversion in rustdoc

3 years agoAuto merge of #6465 - Suyash458:master, r=flip1995
bors [Fri, 18 Dec 2020 09:36:05 +0000 (09:36 +0000)]
Auto merge of #6465 - Suyash458:master, r=flip1995

add more lints to msrv docs

Fixes #6097

changelog: None

3 years agoAuto merge of #80090 - jyn514:tcx-in-render, r=GuillaumeGomez
bors [Fri, 18 Dec 2020 08:44:50 +0000 (08:44 +0000)]
Auto merge of #80090 - jyn514:tcx-in-render, r=GuillaumeGomez

Pass a `TyCtxt` through to `FormatRender`

This is the next step after https://github.com/rust-lang/rust/pull/79957 for https://github.com/rust-lang/rust/issues/76382. Eventually I plan to use this to remove `stability`, `const_stability`, and `deprecation` from `Item`, but that needs more extensive changes (in particular, https://github.com/rust-lang/rust/pull/75355 or something like it).

This has no actual changes to behavior, it's just moving types around.

ccc https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284

3 years agoAuto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth
bors [Fri, 18 Dec 2020 06:57:21 +0000 (06:57 +0000)]
Auto merge of #6458 - ebroto:6022_parse_doctest, r=Manishearth

needless_doctest_main: handle correctly parse errors

Before this change, finding an error when parsing a doctest would make Clippy exit without emitting an error. Now we properly catch a fatal error and ignore it.

Also, if a doctest specifies an edition in the info line, it will be used when parsing it.

changelog: needless_doctest_main: handle correctly parse errors

Fixes #6022

3 years agoAuto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514
bors [Fri, 18 Dec 2020 05:55:24 +0000 (05:55 +0000)]
Auto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514

Continue String to Symbol conversion in rustdoc

Follow-up of https://github.com/rust-lang/rust/pull/80091.

This PR is already big enough so I'll stop here before the next one.

r? `@jyn514`

3 years agoAdd missing punctuation to std::alloc docs
pierwill [Fri, 18 Dec 2020 05:49:32 +0000 (21:49 -0800)]
Add missing punctuation to std::alloc docs

Add a period to first line of module docs to match other modules in std.

3 years agoadd more lints to msrv docs
Suyash458 [Fri, 18 Dec 2020 05:25:09 +0000 (10:55 +0530)]
add more lints to msrv docs

3 years agoEdit formatting in Rust Prelude docs
pierwill [Fri, 18 Dec 2020 05:17:43 +0000 (21:17 -0800)]
Edit formatting in Rust Prelude docs

Use consistent punctuation and capitalization in the list
of things re-exported in the prelude.

Also adds a (possibly missing) word.

3 years agoFix typo in rustc_typeck docs
pierwill [Fri, 18 Dec 2020 04:47:05 +0000 (20:47 -0800)]
Fix typo in rustc_typeck docs

3 years agomake needless_update ignore non_exhaustive structs
Andrew Houts [Fri, 18 Dec 2020 03:09:55 +0000 (21:09 -0600)]
make needless_update ignore non_exhaustive structs

3 years agoAuto merge of #80036 - sivadeilra:syms_no_macro, r=petrochenkov
bors [Fri, 18 Dec 2020 03:01:14 +0000 (03:01 +0000)]
Auto merge of #80036 - sivadeilra:syms_no_macro, r=petrochenkov

Stop using intermediate macros in definition of symbols

Currently, the rustc_macros::symbols macro generates two
`macro_rules!` macros as its output. These two macros are
used in rustc_span/src/symbol.rs.

This means that each Symbol that we define is represented
in the AST of rustc_symbols twice: once in the definition
of the `define_symbols!` macro (similarly for the
`keywords! macro), and once in the rustc_span::symbols
definition.

That would be OK if there were only a handful of symbols,
but currently we define over 1100 symbols. The definition
of the `define_symbols!` macro contains the expanded definition
of each symbol, so that's a lot of AST storage wasted on a
macro that is used exactly once.

This commit removes the `define_symbols` macro, and simply
allows the proc macro to directly generate the
`rustc_symbols::symbol::sym` module.

The benefit is mainly in reducing memory wasted during
compilation of rustc itself. It should also reduce memory used
by Rust Analyzer.

This commit also reduces the size of the AST for symbol
definitions, by moving two `#[allow(...)]` attributes from
the symbol constants to the `sym` module. This eliminates 2200+
attribute nodes.

This commit also eliminates the need for the `digits_array`
constant. There's no need to store an array of Symbol values
for digits. We can simply define a constant of the base value,
and add to that base value.

I left the `sym::integer` function in rustc_span/src/symbol.rs
instead of moving it into rustc_macros/src/symbols.rs for two
reasons. First, because it's human-written code; it doesn't need
to be generated by the proc-macro. Second, because I didn't want
the `#[allow(...)]` attributes that I moved to the `sym` module
scope to apply to this function. The `sym` module re-exports the
`integer` function from its parent module.

3 years agoAuto merge of #80138 - Dylan-DPC:rollup-qamsfyh, r=Dylan-DPC
bors [Fri, 18 Dec 2020 00:08:30 +0000 (00:08 +0000)]
Auto merge of #80138 - Dylan-DPC:rollup-qamsfyh, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #78164 (Prefer regions with an `external_name` in `approx_universal_upper_bound`)
 - #80003 (Fix overflow when converting ZST Vec to VecDeque)
 - #80023 (Enhance error message when misspelled label to value in break expression)
 - #80046 (Add more documentation to `Diagnostic` and `DiagnosticBuilder`)
 - #80109 (Remove redundant and unreliable coverage test results)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #80109 - richkadel:llvm-coverage-counters-2.3.0, r=tmandry
Dylan DPC [Thu, 17 Dec 2020 23:30:21 +0000 (00:30 +0100)]
Rollup merge of #80109 - richkadel:llvm-coverage-counters-2.3.0, r=tmandry

Remove redundant and unreliable coverage test results

The `coverage-reports` tests still generate counters and JSON reports
for inspection, but these files are no longer used in Makefile diffs, to
reduce complexity and confusion from unreliable or unexpected test
results, especially when maintaining them (i.e., generating `--bless`ed
results).

The associated `expected_` files for counters and JSON reports have been
removed, leaving only the files actually used for testing: the `llvm-cov
show` reports.

r? `@tmandry`

Tyler - as we discussed offline...

FYI: `@wesleywiser` `@Swatinem`

Arpad, depending on the timing of this PR, it may not affect you, but I'm removing some of the files that produce slightly different results on Windows as they really aren't necessary to validate coverage results.

3 years agoRollup merge of #80046 - camelid:diag-docs, r=lcnr
Dylan DPC [Thu, 17 Dec 2020 23:30:20 +0000 (00:30 +0100)]
Rollup merge of #80046 - camelid:diag-docs, r=lcnr

Add more documentation to `Diagnostic` and `DiagnosticBuilder`

cc `@estebank`

3 years agoRollup merge of #80023 - sasurau4:feature/enhance-error-message-when-wrongly-written...
Dylan DPC [Thu, 17 Dec 2020 23:30:18 +0000 (00:30 +0100)]
Rollup merge of #80023 - sasurau4:feature/enhance-error-message-when-wrongly-written-broken-label, r=lcnr

Enhance error message when misspelled label to value in break expression

Fix #79424

3 years agoRollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnay
Dylan DPC [Thu, 17 Dec 2020 23:30:11 +0000 (00:30 +0100)]
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnay

Fix overflow when converting ZST Vec to VecDeque

```rust
let v = vec![(); 100];
let queue = VecDeque::from(v);
println!("{:?}", queue);
```
This code will currently panic with a capacity overflow.
This PR resolves this issue and makes the code run fine.

Resolves #78532

3 years agoRollup merge of #78164 - Aaron1011:fix/async-region-name, r=tmandry
Dylan DPC [Thu, 17 Dec 2020 23:30:09 +0000 (00:30 +0100)]
Rollup merge of #78164 - Aaron1011:fix/async-region-name, r=tmandry

Prefer regions with an `external_name` in `approx_universal_upper_bound`

Fixes #75785

When displaying a MIR borrowcheck error, we may need to find an upper
bound for a region, which gives us a region to point to in the error
message. However, a region might outlive multiple distinct universal
regions, in which case the only upper bound is 'static

To try to display a meaningful error message, we compute an
'approximate' upper bound by picking one of the universal regions.
Currently, we pick the region with the lowest index - however, this
caused us to produce a suboptimal error message in issue #75785

This PR `approx_universal_upper_bound` to prefer regions with an
`external_name`. This causes us to prefer regions from function
arguments/upvars, which seems to lead to a nicer error message in some
cases.

3 years agoStop using intermediate macros in definition of symbols
Arlie Davis [Mon, 14 Dec 2020 19:34:55 +0000 (11:34 -0800)]
Stop using intermediate macros in definition of symbols

Currently, the rustc_macros::symbols macro generates two
`macro_rules!` macros as its output. These two macros are
used in rustc_span/src/symbol.rs.

This means that each Symbol that we define is represented
in the AST of rustc_symbols twice: once in the definition
of the `define_symbols!` macro (similarly for the
`keywords! macro), and once in the rustc_span::symbols
definition.

That would be OK if there were only a handful of symbols,
but currently we define over 1100 symbols. The definition
of the `define_symbols!` macro contains the expanded definition
of each symbol, so that's a lot of AST storage wasted on a
macro that is used exactly once.

This commit removes the `define_symbols` macro, and simply
allows the proc macro to directly generate the
`rustc_symbols::symbol::sym` module.

The benefit is mainly in reducing memory wasted during
compilation of rustc itself. It should also reduce memory used
by Rust Analyzer.

This commit also reduces the size of the AST for symbol
definitions, by moving two `#[allow(...)]` attributes from
the symbol constants to the `sym` module. This eliminates 2200+
attribute nodes.

This commit also eliminates the need for the `digits_array`
constant. There's no need to store an array of Symbol values
for digits. We can simply define a constant of the base value,
and add to that base value.

3 years agoAdd test for issue #74824
Nixon Enraght-Moony [Thu, 17 Dec 2020 22:06:00 +0000 (22:06 +0000)]
Add test for issue #74824

3 years agoDon't allow `const` to begin a nonterminal
Camelid [Thu, 17 Dec 2020 21:51:20 +0000 (13:51 -0800)]
Don't allow `const` to begin a nonterminal

Thanks to Vadim Petrochenkov who [told me what the fix was][z]!

[z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422

3 years agoAuto merge of #80122 - davidtwco:revert-76030, r=oli-obk
bors [Thu, 17 Dec 2020 21:13:51 +0000 (21:13 +0000)]
Auto merge of #80122 - davidtwco:revert-76030, r=oli-obk

Revert "cg_llvm: `fewer_names` in `uncached_llvm_type`"

Fixes #76213 and fixes #79564.

This PR temporarily reverts commit fa01ce802f1b403a2140fd945b43af86ec3998a1 from #76030 to until the root issue can be resolved. Requested [in t-compiler meeting](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.20meeting.5D.202020-12-17.20.2354818/near/220261541).

*Note*: I was seeing some failing debuginfo-gdb tests locally but I wasn't sure if they were spurious.

3 years agoSuppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere
Aaron Hill [Thu, 17 Dec 2020 20:25:55 +0000 (15:25 -0500)]
Suppress `CONST_ITEM_MUTATION` lint if a dereference occurs anywhere

Fixes #79971

3 years agoRevert change to evaluation order
Matthew Jasper [Thu, 17 Dec 2020 20:16:10 +0000 (20:16 +0000)]
Revert change to evaluation order

This change breaks some code and doesn't appear to enable any new code.

3 years agodocs: Edit rustc_span::symbol::Symbol method
pierwill [Thu, 17 Dec 2020 20:02:34 +0000 (12:02 -0800)]
docs: Edit rustc_span::symbol::Symbol method

Edit wording of the doc comment for rustc_span::symbol::Symbol::can_be_raw
to match related methods.

3 years agodocs: Edit rustc_ast::token::Token
pierwill [Thu, 17 Dec 2020 19:55:49 +0000 (11:55 -0800)]
docs: Edit rustc_ast::token::Token

Add missing punctuation.

3 years agoPrefer regions with an `external_name` in `approx_universal_upper_bound`
Aaron Hill [Tue, 20 Oct 2020 20:31:54 +0000 (16:31 -0400)]
Prefer regions with an `external_name` in `approx_universal_upper_bound`

Fixes #75785

When displaying a MIR borrowcheck error, we may need to find an upper
bound for a region, which gives us a region to point to in the error
message. However, a region might outlive multiple distinct universal
regions, in which case the only upper bound is 'static

To try to display a meaningful error message, we compute an
'approximate' upper bound by picking one of the universal regions.
Currently, we pick the region with the lowest index - however, this
caused us to produce a suboptimal error message in issue #75785

This PR `approx_universal_upper_bound` to prefer regions with an
`external_name`. This causes us to prefer regions from function
arguments/upvars, which seems to lead to a nicer error message in some
cases.

3 years agoAuto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
bors [Thu, 17 Dec 2020 18:21:20 +0000 (18:21 +0000)]
Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`

3 years agoAuto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis
bors [Thu, 17 Dec 2020 18:21:20 +0000 (18:21 +0000)]
Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakis

Move binder for dyn to each list item

This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`.

This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.`

r? `@nikomatsakis`

3 years agoContinue String to Symbol conversion in rustdoc
Guillaume Gomez [Thu, 17 Dec 2020 13:02:09 +0000 (14:02 +0100)]
Continue String to Symbol conversion in rustdoc

3 years agofix memory leak in test
DrMeepster [Thu, 17 Dec 2020 17:18:06 +0000 (09:18 -0800)]
fix memory leak in test