]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #81717 - Aaron1011:fix/closure-diag, r=estebank
bors [Wed, 3 Feb 2021 20:53:08 +0000 (20:53 +0000)]
Auto merge of #81717 - Aaron1011:fix/closure-diag, r=estebank

Fix panic when emitting diagnostic for closure mutable binding error

Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.

3 years agoAuto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-se
bors [Wed, 3 Feb 2021 18:01:37 +0000 (18:01 +0000)]
Auto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-se

Rollup of 5 pull requests

Successful merges:

 - #80394 (make const_err a future incompat lint)
 - #81532 (Remove incorrect `delay_span_bug`)
 - #81692 (Update clippy)
 - #81715 (Reduce tab formatting assertions to debug only)
 - #81716 (Fix non-existent-field ICE for generic fields.)

Failed merges:

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

3 years agoRollup merge of #81716 - m-ou-se:fix-ice, r=eddyb
Mara Bos [Wed, 3 Feb 2021 17:51:18 +0000 (18:51 +0100)]
Rollup merge of #81716 - m-ou-se:fix-ice, r=eddyb

Fix non-existent-field ICE for generic fields.

I mentioned this ICE in a chat and it took about 3 milliseconds before `@eddyb` found the problem and said this change would fix it. :)

This also changes one the field types in the related test to one that triggered the ICE.

Fixes #81627.
Fixes #81672.
Fixes #81709.

Cc https://github.com/rust-lang/rust/pull/81480 `@b-naber` `@estebank.`

3 years agoRollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Mara Bos [Wed, 3 Feb 2021 17:51:17 +0000 (18:51 +0100)]
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank

Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky.

Minimizes the impact of #81614

3 years agoRollup merge of #81692 - Manishearth:clippyup, r=tmandry
Mara Bos [Wed, 3 Feb 2021 17:51:15 +0000 (18:51 +0100)]
Rollup merge of #81692 - Manishearth:clippyup, r=tmandry

Update clippy

r? `@flip1995`

3 years agoRollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix
Mara Bos [Wed, 3 Feb 2021 17:51:14 +0000 (18:51 +0100)]
Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix

Remove incorrect `delay_span_bug`

The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix (but not close) #80207.

3 years agoRollup merge of #80394 - RalfJung:const-err-future, r=oli-obk
Mara Bos [Wed, 3 Feb 2021 17:51:12 +0000 (18:51 +0100)]
Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk

make const_err a future incompat lint

This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.

This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).

~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~

Cc `@rust-lang/wg-const-eval`

3 years agoFix non-existent-field ICE for generic fields.
Mara Bos [Wed, 3 Feb 2021 17:36:48 +0000 (18:36 +0100)]
Fix non-existent-field ICE for generic fields.

Co-authored-by: eddyb <eddyb@lyken.rs>
3 years agoFix panic when emitting diagnostic for closure mutable binding error
Aaron Hill [Wed, 3 Feb 2021 17:33:27 +0000 (12:33 -0500)]
Fix panic when emitting diagnostic for closure mutable binding error

Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.

3 years agoReduce tab formatting assertions to debug only
J. Ryan Stinnett [Wed, 3 Feb 2021 17:17:15 +0000 (17:17 +0000)]
Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to
ensure all tab characters are handled appropriately. We've started getting
reports of these assertions firing (#81614). Since it's only a cosmetic issue,
this downgrades the assertions to debug only, so we at least continue compiling
even if the diagnostics might be a tad wonky.

Fixes #81614

3 years agoRemove incorrect `delay_span_bug`
Esteban Küber [Fri, 29 Jan 2021 19:47:47 +0000 (11:47 -0800)]
Remove incorrect `delay_span_bug`

The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix #80207.

3 years agoAuto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obk
bors [Wed, 3 Feb 2021 15:12:19 +0000 (15:12 +0000)]
Auto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obk

Use ufcs in derive(Debug)

Cc #81211.

(Arguably this *is* the fix for it.)

3 years agomake const_err a future incompat lint
Ralf Jung [Sat, 30 Jan 2021 13:49:22 +0000 (14:49 +0100)]
make const_err a future incompat lint

3 years agoAuto merge of #81699 - jethrogb:fix-81531, r=petrochenkov
bors [Wed, 3 Feb 2021 11:42:09 +0000 (11:42 +0000)]
Auto merge of #81699 - jethrogb:fix-81531, r=petrochenkov

Really fix early lints inside an async desugaring

Fixes #81531

cc `@Aaron1011`

r? `@petrochenkov`

3 years agoReally fix early lints inside an async desugaring
Jethro Beekman [Wed, 3 Feb 2021 08:40:59 +0000 (09:40 +0100)]
Really fix early lints inside an async desugaring

3 years agoAuto merge of #81694 - GuillaumeGomez:rollup-odg6xqi, r=GuillaumeGomez
bors [Wed, 3 Feb 2021 08:59:27 +0000 (08:59 +0000)]
Auto merge of #81694 - GuillaumeGomez:rollup-odg6xqi, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #81144 (Fixed formatting typo in map_while docs)
 - #81573 (Add some links to the cell docs.)
 - #81679 (Bind all clean::Type variants and remove FIXME)
 - #81681 (Better styling of "Switch result tab" shortcut)

Failed merges:

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

3 years agoRollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomez
Guillaume Gomez [Wed, 3 Feb 2021 07:41:28 +0000 (08:41 +0100)]
Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomez

Better styling of "Switch result tab" shortcut

Before:
![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png)
![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png)

After:
![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png)
![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)

3 years agoRollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, r=poliorcetics,CraftS...
Guillaume Gomez [Wed, 3 Feb 2021 07:41:26 +0000 (08:41 +0100)]
Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, r=poliorcetics,CraftSpider

Bind all clean::Type variants and remove FIXME

This is simply a little cleanup.

cc `@CraftSpider`
r? `@poliorcetics`

3 years agoRollup merge of #81573 - ehuss:cell-links, r=jackh726
Guillaume Gomez [Wed, 3 Feb 2021 07:41:24 +0000 (08:41 +0100)]
Rollup merge of #81573 - ehuss:cell-links, r=jackh726

Add some links to the cell docs.

This adds a few links to the cell module docs to make it a little easier to navigate to the types and functions it references.

3 years agoRollup merge of #81144 - nhwn:typo-map-while, r=jackh726
Guillaume Gomez [Wed, 3 Feb 2021 07:41:22 +0000 (08:41 +0100)]
Rollup merge of #81144 - nhwn:typo-map-while, r=jackh726

Fixed formatting typo in map_while docs

changes `` ` None` `` to ``[`None`]`` for consistency

3 years agoAuto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink
bors [Wed, 3 Feb 2021 06:00:43 +0000 (06:00 +0000)]
Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink

Add a new ABI to support cmse_nonsecure_call

This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call.

See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928).

This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃
I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now).

On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯

3 years agoMerge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy
Manish Goregaokar [Wed, 3 Feb 2021 04:43:30 +0000 (20:43 -0800)]
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy

3 years agoAuto merge of #6667 - Manishearth:rustup, r=Manishearth
bors [Wed, 3 Feb 2021 04:09:03 +0000 (04:09 +0000)]
Auto merge of #6667 - Manishearth:rustup, r=Manishearth

Rustup

Pulling in AST changes

changelog: none

3 years agoMerge branch 'sync-from-rust3' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 03:57:31 +0000 (19:57 -0800)]
Merge branch 'sync-from-rust3' into rustup

3 years agoRun rustfmt
Manish Goregaokar [Wed, 3 Feb 2021 03:57:08 +0000 (19:57 -0800)]
Run rustfmt

3 years agoRustup
Manish Goregaokar [Wed, 3 Feb 2021 01:35:39 +0000 (17:35 -0800)]
Rustup

3 years agobless the coverage-spanview output. Cc #81688.
Felix S. Klock II [Wed, 3 Feb 2021 03:22:35 +0000 (22:22 -0500)]
bless the coverage-spanview output. Cc #81688.

3 years agoAuto merge of #81535 - nikic:update-test-various, r=sanxiyn
bors [Wed, 3 Feb 2021 03:03:08 +0000 (03:03 +0000)]
Auto merge of #81535 - nikic:update-test-various, r=sanxiyn

Update test-various to Ubuntu 20.04

The test command-setgroups.rs is adjusted to skip on musl, where `sysconf(_SC_NGROUPS_MAX)` always returns a dummy value of 32, even though the actual value is 65536. I'm not sure why this only became a problem now, as the information I found indicates that this value changed in kernel version 2.6.4, which is ages ago.

I'm a bit unsure whether this one will go through, because I locally also saw a failure in std-backtrace.rs which went away on subsequent runs, and also had port assignment failures, but I think those might be on my side. I'm kind of curious how the code in https://github.com/rust-lang/rust/blob/b122908617436af187252572ed5db96850551380/library/std/src/net/test.rs#L43-L56 is supposed to work, as the directory names it checks don't seem to appear anywhere else.

r? `@Mark-Simulacrum`

3 years agoMerge remote-tracking branch 'origin/master' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 00:46:12 +0000 (16:46 -0800)]
Merge remote-tracking branch 'origin/master' into rustup

3 years agoAuto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726
bors [Tue, 2 Feb 2021 23:15:22 +0000 (23:15 +0000)]
Auto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726

Rollup of 14 pull requests

Successful merges:

 - #80593 (Upgrade Chalk)
 - #81260 (Add .editorconfig)
 - #81455 (Add AArch64 big-endian and ILP32 targets)
 - #81517 (Remove remnants of the santizer runtime crates from bootstrap)
 - #81530 (sys: use `process::abort()` instead of `arch::wasm32::unreachable()`)
 - #81544 (Add better diagnostic for unbounded Abst. Const)
 - #81588 (Add doc aliases for "delete")
 - #81603 (rustbuild: Don't build compiler twice for error-index-generator.)
 - #81634 (Add long explanation e0521)
 - #81636 (Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on)
 - #81647 (Fix bug with assert!() calling the wrong edition of panic!().)
 - #81655 (Improve wording of suggestion about accessing field)
 - #81665 (Fix out of date `Scalar` documentation)
 - #81671 (Add more associated type tests)

Failed merges:

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

3 years agoBetter styling of "Switch result tab" shortcut
Smitty [Tue, 2 Feb 2021 21:15:57 +0000 (16:15 -0500)]
Better styling of "Switch result tab" shortcut

3 years agoBind all clean::Type variants and remove FIXME
Guillaume Gomez [Tue, 2 Feb 2021 21:07:23 +0000 (22:07 +0100)]
Bind all clean::Type variants and remove FIXME

3 years agoRollup merge of #81671 - jackh726:atb-tests, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:50 +0000 (16:01 -0500)]
Rollup merge of #81671 - jackh726:atb-tests, r=estebank

Add more associated type tests

Closes #24159
Closes #37808
Closes #39532
Closes #37883

r? ``@estebank``

3 years agoRollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:49 +0000 (16:01 -0500)]
Rollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank

Fix out of date `Scalar` documentation

Scalars can represent integers up to `u128`, but the docs state otherwise.

3 years agoRollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:48 +0000 (16:01 -0500)]
Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebank

Improve wording of suggestion about accessing field

Follow-up to #81504

The compiler at this moment suggests "you might have meant to use field `b` of type `B`", sounding like it's type `B` which has the field `b`.
r? ```@estebank```

3 years agoRollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov
Jack Huey [Tue, 2 Feb 2021 21:01:46 +0000 (16:01 -0500)]
Rollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov

Fix bug with assert!() calling the wrong edition of panic!().

The span of `panic!` produced by the `assert` macro did not carry the right edition. This changes `assert` to call the right version.

Also adds tests for the 2021 edition of panic and assert, that would've caught this.

3 years agoRollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov
Jack Huey [Tue, 2 Feb 2021 21:01:45 +0000 (16:01 -0500)]
Rollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov

Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on

```@rustbot``` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, r=Guilla...
Jack Huey [Tue, 2 Feb 2021 21:01:44 +0000 (16:01 -0500)]
Rollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, r=GuillaumeGomez

Add long explanation e0521

Helps with #61137

3 years agoRollup merge of #81603 - ehuss:error-index-build, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:42 +0000 (16:01 -0500)]
Rollup merge of #81603 - ehuss:error-index-build, r=Mark-Simulacrum

rustbuild: Don't build compiler twice for error-index-generator.

When using `--stage=1`, the error-index-generator was forcing the compiler to be built twice.  This isn't necessary; the error-index-generator just needs the same unusual logic that rustdoc uses to build with stage minus one.

`--stage=0` and `--stage=2` should be unaffected by this change.

cc #76371

3 years agoRollup merge of #81588 - xfix:delete-doc-alias, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:41 +0000 (16:01 -0500)]
Rollup merge of #81588 - xfix:delete-doc-alias, r=Mark-Simulacrum

Add doc aliases for "delete"

This patch adds doc aliases for "delete". The added aliases are supposed to reference usages `delete` in other programming languages.

- `HashMap::remove`, `BTreeMap::remove` -> `Map#delete` and `delete` keyword in JavaScript.

- `HashSet::remove`, `BTreeSet::remove` -> `Set#delete` in JavaScript.

- `mem::drop` -> `delete` keyword in C++.

- `fs::remove_file`, `fs::remove_dir`, `fs::remove_dir_all`-> `File#delete` in Java, `File#delete` and `Dir#delete` in Ruby.

Before this change, searching for "delete" in documentation returned no results.

3 years agoRollup merge of #81544 - JulianKnodt:sat_where, r=lcnr
Jack Huey [Tue, 2 Feb 2021 21:01:39 +0000 (16:01 -0500)]
Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnr

Add better diagnostic for unbounded Abst. Const

~~In the case where a generic abst. const requires a trivial where bound: `where TypeWithConst<const_fn(N)>: ,`,
instead of requiring a where bound, just check that only consts are being substituted in to skip over where check.~~

~~This is pretty sketchy, but I think it works. Presumably, if there is checking for type bounds added later, it can first check nested requirements, and see if they're satisfied by the current `ParamEnv`.~~

Changed the diagnostic to add a better example, which is more practical than what was previously proposed.

r? ```@lcnr```

3 years agoRollup merge of #81530 - ojeda:sys-use-abort-instead-of-wasm32-unreachable, r=Mark...
Jack Huey [Tue, 2 Feb 2021 21:01:38 +0000 (16:01 -0500)]
Rollup merge of #81530 - ojeda:sys-use-abort-instead-of-wasm32-unreachable, r=Mark-Simulacrum

sys: use `process::abort()` instead of `arch::wasm32::unreachable()`

Rationale:

  - `abort()` lowers to `wasm32::unreachable()` anyway.
  - `abort()` isn't `unsafe`.
  - `abort()` matches the comment better.
  - `abort()` avoids confusion by future readers (e.g. https://github.com/rust-lang/rust/pull/81527): the naming of wasm's `unreachable` instruction is a bit unfortunate because it is not related to the `unreachable()` intrinsic (intended to trigger UB).

Codegen is likely to be different since `unreachable()` is `inline` while `abort()` is `cold`. Since it doesn't look like we are expecting here to trigger this case, the latter seems better anyway.

3 years agoRollup merge of #81517 - tmiasko:san-crates, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:36 +0000 (16:01 -0500)]
Rollup merge of #81517 - tmiasko:san-crates, r=Mark-Simulacrum

Remove remnants of the santizer runtime crates from bootstrap

3 years agoRollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiyn
Jack Huey [Tue, 2 Feb 2021 21:01:35 +0000 (16:01 -0500)]
Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiyn

Add AArch64 big-endian and ILP32 targets

This PR adds 3 new AArch64 targets:
- `aarch64_be-unknown-linux-gnu`
- `aarch64-unknown-linux-gnu_ilp32`
- `aarch64_be-unknown-linux-gnu_ilp32`

It also fixes some ABI issues on big-endian ARM and AArch64.

3 years agoRollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:33 +0000 (16:01 -0500)]
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum

Add .editorconfig

This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.

3 years agoRollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:33 +0000 (16:01 -0500)]
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum

Add .editorconfig

This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.

3 years agoRollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakis
Jack Huey [Tue, 2 Feb 2021 21:01:32 +0000 (16:01 -0500)]
Rollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakis

Upgrade Chalk

~~Blocked on rust-lang/chalk#670~~
~~Now blocked on rust-lang/chalk#680 and release~~

In addition to the straight upgrade, I also tried to fix some tests by properly returning variables and max universes in the solution. Unfortunately, this actually triggers the same perf problem that rustc traits code runs into in `canonicalizer`. Not sure what the root cause of this problem is, or why it's supposed to be solved in chalk.

r? ```@nikomatsakis```

3 years agoAuto merge of #81541 - Aaron1011:early-lint-async-fn, r=petrochenkov
bors [Tue, 2 Feb 2021 20:27:09 +0000 (20:27 +0000)]
Auto merge of #81541 - Aaron1011:early-lint-async-fn, r=petrochenkov

Fix early lints inside an async desugaring

Fixes #81531

When we buffer an early lint for a macro invocation,
we need to determine which NodeId to take the lint level from.
Currently, we use the NodeId of the closest def parent. However, if
the macro invocation is inside the desugared closure from an `async fn`
or async closure, that NodeId does not actually exist in the AST.

This commit uses the parent of a desugared closure when computing
`lint_node_id`, which is something that actually exists in the AST (an
`async fn` or async closure).

3 years agoFix early lints inside an async desugaring
Aaron Hill [Sat, 30 Jan 2021 00:03:20 +0000 (19:03 -0500)]
Fix early lints inside an async desugaring

Fixes #81531

When we buffer an early lint for a macro invocation,
we need to determine which NodeId to take the lint level from.
Currently, we use the `NodeId` of the closest def parent. However, if
the macro invocation is inside the desugared closure from an `async fn`
or async closure, that `NodeId` does not actually exist in the AST.

This commit explicitly calls `check_lint` for the `NodeId`s of closures
desugared from async expressions, ensuring that we do not miss any
buffered lints.

3 years agoMore associated type tests
Jack Huey [Tue, 2 Feb 2021 17:54:32 +0000 (12:54 -0500)]
More associated type tests

3 years agoAuto merge of #6639 - xFrednet:0000-configuration-documentation-some-nits, r=flip1995
bors [Tue, 2 Feb 2021 18:05:35 +0000 (18:05 +0000)]
Auto merge of #6639 - xFrednet:0000-configuration-documentation-some-nits, r=flip1995

Updated some NITs in the documentation from #6630

I've implemented the two suggestions from #6630 that were added after the merge. This PR also changes the example code to use `register_*_pass` instead of `register_late_pass`. I'm not sure if this is better or worse, but it makes it clearer in my opinion. Let me know if I should change it back.

---

changelog: none

r? `@flip1995`

3 years agoUpdate ui tests (nll)
Jesus Rubio [Tue, 2 Feb 2021 17:57:34 +0000 (18:57 +0100)]
Update ui tests (nll)

3 years agoUpdated the list of active mentors
xFrednet [Tue, 2 Feb 2021 17:53:15 +0000 (18:53 +0100)]
Updated the list of active mentors

3 years agoUpdate Chalk
Jack Huey [Sun, 31 Jan 2021 06:05:25 +0000 (01:05 -0500)]
Update Chalk

3 years agoAuto merge of #81405 - bugadani:ast, r=cjgillot
bors [Tue, 2 Feb 2021 17:34:08 +0000 (17:34 +0000)]
Auto merge of #81405 - bugadani:ast, r=cjgillot

Box the biggest ast::ItemKind variants

This PR is a different approach on https://github.com/rust-lang/rust/pull/81400, aiming to save memory in humongous ASTs.

The three affected item kind enums are:
 - `ast::ItemKind` (208 -> 112 bytes)
 - `ast::AssocItemKind` (176 -> 72 bytes)
 - `ast::ForeignItemKind` (176 -> 72 bytes)

3 years agoAuto merge of #81405 - bugadani:ast, r=cjgillot
bors [Tue, 2 Feb 2021 17:34:08 +0000 (17:34 +0000)]
Auto merge of #81405 - bugadani:ast, r=cjgillot

Box the biggest ast::ItemKind variants

This PR is a different approach on https://github.com/rust-lang/rust/pull/81400, aiming to save memory in humongous ASTs.

The three affected item kind enums are:
 - `ast::ItemKind` (208 -> 112 bytes)
 - `ast::AssocItemKind` (176 -> 72 bytes)
 - `ast::ForeignItemKind` (176 -> 72 bytes)

3 years agoAdd .editorconfig
Vasili Novikov [Fri, 22 Jan 2021 08:51:23 +0000 (09:51 +0100)]
Add .editorconfig

Editorconfig is a lightweight specification that
helps maintaining consistent coding/formatting style
accross editors, especially those editors
that are not explicitly aware of Rust and rustfmt.

https://editorconfig.org/

3 years agoAdd .editorconfig
Vasili Novikov [Fri, 22 Jan 2021 08:51:23 +0000 (09:51 +0100)]
Add .editorconfig

Editorconfig is a lightweight specification that
helps maintaining consistent coding/formatting style
accross editors, especially those editors
that are not explicitly aware of Rust and rustfmt.

https://editorconfig.org/

3 years agoAdd better diagnostic for missing where clause
kadmin [Sat, 30 Jan 2021 03:45:18 +0000 (03:45 +0000)]
Add better diagnostic for missing where clause

Previously, it's not clear what exactly should be added in the suggested where clause,
so this adds an example to demonstrate.

3 years agoAuto merge of #6664 - camsteffen:path-to-res, r=Manishearth
bors [Tue, 2 Feb 2021 16:56:39 +0000 (16:56 +0000)]
Auto merge of #6664 - camsteffen:path-to-res, r=Manishearth

Remove Option from `path_to_res` return type

changelog: none

Tiny cleanup for `path_to_res` to return `Res` instead of `Option<Res>`.

3 years agoFix out of date `Scalar` documentation
Jake Hughes [Tue, 2 Feb 2021 16:15:32 +0000 (16:15 +0000)]
Fix out of date `Scalar` documentation

Scalars can represent integers up to u128, but the docs state otherwise.

3 years agoAuto merge of #6523 - brightly-salty:missing-panic-doc, r=flip1995
bors [Tue, 2 Feb 2021 15:37:24 +0000 (15:37 +0000)]
Auto merge of #6523 - brightly-salty:missing-panic-doc, r=flip1995

Add new lint "missing_panics_doc"

fixes #1974
changelog: Added the "missing_panics_doc" lint which lints when public functions that may panic are missing "# Panics" in their doc comment

3 years agoAdd missing_panics_doc lint
Caden Haustein [Wed, 30 Dec 2020 22:37:59 +0000 (16:37 -0600)]
Add missing_panics_doc lint

3 years agoAuto merge of #6659 - phlip9:let_and_return_fix, r=phansch
bors [Tue, 2 Feb 2021 15:04:35 +0000 (15:04 +0000)]
Auto merge of #6659 - phlip9:let_and_return_fix, r=phansch

Fix let_and_return false positive

The issue:

link: https://play.rust-lang.org/?edition=2018&gist=12cb5d1e7527f8c37743b87fc4a53748
Run the above with clippy to see the following warning:

```
warning: returning the result of a `let` binding from a block
  --> src/main.rs:24:5
   |
23 |     let value = Foo::new(&x).value();
   |     --------------------------------- unnecessary `let` binding
24 |     value
   |     ^^^^^
   |
   = note: `#[warn(clippy::let_and_return)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
help: return the expression directly
   |
23 |
24 |     Foo::new(&x).value()
   |
```

Implementing the suggested fix, removing the temporary let binding,
yields a compiler error:

```
error[E0597]: `x` does not live long enough
  --> src/main.rs:23:14
   |
23 |     Foo::new(&x).value()
   |     ---------^^-
   |     |        |
   |     |        borrowed value does not live long enough
   |     a temporary with access to the borrow is created here ...
24 | }
   | -
   | |
   | `x` dropped here while still borrowed
   | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `Foo`
   |
   = note: the temporary is part of an expression at the end of a block;
           consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
   |
23 |     let x = Foo::new(&x).value(); x
   |     ^^^^^^^                     ^^^
```

The fix:

Of course, clippy looks like it should already handle this edge case;
however, it appears `utils::fn_def_id` is not returning a `DefId` for
`Foo::new`. Changing the `qpath_res` lookup to use the child Path
`hir_id` instead of the parent Call `hir_id` fixes the issue.

changelog: none

3 years agoAuto merge of #80843 - Mark-Simulacrum:fmt-bump, r=petrochenkov
bors [Tue, 2 Feb 2021 14:52:53 +0000 (14:52 +0000)]
Auto merge of #80843 - Mark-Simulacrum:fmt-bump, r=petrochenkov

Bump rustfmt version

3 years agoBump rustfmt version
Mark Rousskov [Sat, 9 Jan 2021 17:00:45 +0000 (12:00 -0500)]
Bump rustfmt version

Also switches on formatting of the mir build module

3 years agoAdd a new ABI to support cmse_nonsecure_call
Hugues de Valon [Sun, 24 Jan 2021 17:15:05 +0000 (17:15 +0000)]
Add a new ABI to support cmse_nonsecure_call

This commit adds a new ABI to be selected via `extern
"C-cmse-nonsecure-call"` on function pointers in order for the compiler to
apply the corresponding cmse_nonsecure_call callsite attribute.
For Armv8-M targets supporting TrustZone-M, this will perform a
non-secure function call by saving, clearing and calling a non-secure
function pointer using the BLXNS instruction.

See the page on the unstable book for details.

Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
3 years agoAuto merge of #81660 - jonas-schievink:rollup-fz2lh78, r=jonas-schievink
bors [Tue, 2 Feb 2021 12:02:36 +0000 (12:02 +0000)]
Auto merge of #81660 - jonas-schievink:rollup-fz2lh78, r=jonas-schievink

Rollup of 11 pull requests

Successful merges:

 - #80629 (Add lint for 2229 migrations)
 - #81022 (Add Frames Iterator for Backtrace)
 - #81481 (move some tests)
 - #81485 (Add some tests for associated-type-bounds issues)
 - #81492 (rustdoc: Note why `rustdoc::html::markdown` is public)
 - #81577 (const_evaluatable: consider sub-expressions to be evaluatable)
 - #81599 (Implement `TrustedLen` for `Fuse<I: TrustedLen>`)
 - #81608 (Improve handling of spans around macro result parse errors)
 - #81609 (Remove the remains of query categories)
 - #81630 (Fix overflowing text on mobile when sidebar is displayed)
 - #81631 (Remove unneeded `mut` variable)

Failed merges:

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

3 years agoRollup merge of #81631 - LingMan:rem_var, r=davidtwco
Jonas Schievink [Tue, 2 Feb 2021 11:15:08 +0000 (12:15 +0100)]
Rollup merge of #81631 - LingMan:rem_var, r=davidtwco

Remove unneeded `mut` variable

`arg_elide` gets initialized, immediately cloned, and only written to after that.
The last reading access was removed back in
https://github.com/rust-lang/rust/commit/7704762604a8bf4504a06e8c9713bc7c158d362a

3 years agoRollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfire
Jonas Schievink [Tue, 2 Feb 2021 11:15:06 +0000 (12:15 +0100)]
Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfire

Fix overflowing text on mobile when sidebar is displayed

Fixes #81597.

Before:

![Screenshot from 2021-02-01 17-21-15](https://user-images.githubusercontent.com/3050060/106486857-610b0300-64b2-11eb-96d3-12b939f5b661.png)

After:

![Screenshot from 2021-02-01 17-20-59](https://user-images.githubusercontent.com/3050060/106486840-5cdee580-64b2-11eb-9492-4df27bb39e59.png)

cc `@pickfire`
r? `@Nemo157`

3 years agoRollup merge of #81609 - Julian-Wollersberger:no-query-categories, r=davidtwco
Jonas Schievink [Tue, 2 Feb 2021 11:15:04 +0000 (12:15 +0100)]
Rollup merge of #81609 - Julian-Wollersberger:no-query-categories, r=davidtwco

Remove the remains of query categories

Back in October 2020 in #77830 ``@cjgillot`` removed the query categories information from the profiler, but the actual definitions which query was in which category remained, although unused.
Here I clean that up, to simplify the query definitions even further.

It's unfortunate that this loses all the context for `git blame`, ~~but I'm working on moving those query definitions into `rustc_query_system`, which will lose that context anyway.~~ EDIT: Might not work out.

The functional changes are in the first commit. The second one only changes the indentation.

3 years agoRollup merge of #81608 - Aaron1011:macro-res-parse-err, r=davidtwco
Jonas Schievink [Tue, 2 Feb 2021 11:15:02 +0000 (12:15 +0100)]
Rollup merge of #81608 - Aaron1011:macro-res-parse-err, r=davidtwco

Improve handling of spans around macro result parse errors

Fixes #81543

After we expand a macro, we try to parse the resulting tokens as a AST
node. This commit makes several improvements to how we handle spans when
an error occurs:

* Only ovewrite the original `Span` if it's a dummy span. This preserves
  a more-specific span if one is available.
* Use `self.prev_token` instead of `self.token` when emitting an error
  message after encountering EOF, since an EOF token always has a dummy
  span
* Make `SourceMap::next_point` leave dummy spans unused. A dummy span
  does not have a logical 'next point', since it's a zero-length span.
  Re-using the span span preserves its 'dummy-ness' for other checks

3 years agoRollup merge of #81599 - sdroege:fuse-trusted-len, r=m-ou-se
Jonas Schievink [Tue, 2 Feb 2021 11:15:01 +0000 (12:15 +0100)]
Rollup merge of #81599 - sdroege:fuse-trusted-len, r=m-ou-se

Implement `TrustedLen` for `Fuse<I: TrustedLen>`

This looks like it was simply forgotten.

3 years agoRollup merge of #81577 - BoxyUwU:subexpr_const_evaluatable, r=oli-obk
Jonas Schievink [Tue, 2 Feb 2021 11:14:59 +0000 (12:14 +0100)]
Rollup merge of #81577 - BoxyUwU:subexpr_const_evaluatable, r=oli-obk

const_evaluatable: consider sub-expressions to be evaluatable

see [zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/const_evaluatable.3A.20subexpressions) for more info

cc `@lcnr`
r? `@oli-obk`

3 years agoRollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=GuillaumeGomez
Jonas Schievink [Tue, 2 Feb 2021 11:14:57 +0000 (12:14 +0100)]
Rollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=GuillaumeGomez

rustdoc: Note why `rustdoc::html::markdown` is public

Almost all of the modules are crate-private, except for
`rustdoc::json::types`, which I believe is intended to be for public
use; and `rustdoc::html::markdown`, which is used externally by the
error-index generator and so has to be public.

r? ``@GuillaumeGomez``

3 years agoRollup merge of #81485 - jackh726:atb-issues, r=Mark-Simulacrum
Jonas Schievink [Tue, 2 Feb 2021 11:14:56 +0000 (12:14 +0100)]
Rollup merge of #81485 - jackh726:atb-issues, r=Mark-Simulacrum

Add some tests for associated-type-bounds issues

Closes #38917
Closes #40093
Closes #43475
Closes #63591

#47897 is likely closable too, but it needs an MCVE
~~#38917, #40093, #43475, #47897 all are mislabeled and shouldn't have the `F-associated-type-bounds` label~~

~~#71685 is also mislabeled as commented on in that thread~~

3 years agoRollup merge of #81481 - lcnr:cast-tests, r=jackh726
Jonas Schievink [Tue, 2 Feb 2021 11:14:54 +0000 (12:14 +0100)]
Rollup merge of #81481 - lcnr:cast-tests, r=jackh726

move some tests

3 years agoRollup merge of #81022 - seanchen1991:feat/frames-iter, r=KodrAus
Jonas Schievink [Tue, 2 Feb 2021 11:14:49 +0000 (12:14 +0100)]
Rollup merge of #81022 - seanchen1991:feat/frames-iter, r=KodrAus

Add Frames Iterator for Backtrace

Second attempt at adding the ability to iterate over the frames of a Backtrace by exposing the frames method.

3 years agoRollup merge of #80629 - sexxi-goose:migrations_1, r=nikomatsakis
Jonas Schievink [Tue, 2 Feb 2021 11:14:44 +0000 (12:14 +0100)]
Rollup merge of #80629 - sexxi-goose:migrations_1, r=nikomatsakis

Add lint for 2229 migrations

Implements the first for RFC 2229 where we make the decision to migrate a root variable based on if the type of the variable needs Drop and if the root variable would be moved into the closure when the feature isn't enabled.

r? `@nikomatsakis`

3 years agoAuto merge of #79015 - WaffleLapkin:vec_append_from_within, r=KodrAus
bors [Tue, 2 Feb 2021 09:12:53 +0000 (09:12 +0000)]
Auto merge of #79015 - WaffleLapkin:vec_append_from_within, r=KodrAus

add `Vec::extend_from_within` method under `vec_extend_from_within` feature gate

Implement <https://github.com/rust-lang/rfcs/pull/2714>

### tl;dr

This PR adds a `extend_from_within` method to `Vec` which allows copying elements from a range to the end:

```rust
#![feature(vec_extend_from_within)]

let mut vec = vec![0, 1, 2, 3, 4];

vec.extend_from_within(2..);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);

vec.extend_from_within(..2);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);

vec.extend_from_within(4..8);
assert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);
```

### Implementation notes

Originally I've copied `@Shnatsel's` [implementation](https://github.com/WanzenBug/rle-decode-helper/blob/690742a0de158d391b7bde1a0c71cccfdad33ab3/src/lib.rs#L74) with some minor changes to support other ranges:
```rust
pub fn append_from_within<R>(&mut self, src: R)
where
    T: Copy,
    R: RangeBounds<usize>,
{
    let len = self.len();
    let Range { start, end } = src.assert_len(len);;

    let count = end - start;
    self.reserve(count);
    unsafe {
        // This is safe because `reserve()` above succeeded,
        // so `self.len() + count` did not overflow usize
        ptr::copy_nonoverlapping(
            self.get_unchecked(src.start),
            self.as_mut_ptr().add(len),
            count,
        );
        self.set_len(len + count);
    }
}
```

But then I've realized that this duplicates most of the code from (private) `Vec::append_elements`, so I've used it instead.

Then I've applied `@KodrAus` suggestions from https://github.com/rust-lang/rust/pull/79015#issuecomment-727200852.

3 years agoAuto merge of #6661 - Manishearth:exhaustive-fix, r=flip1995
bors [Tue, 2 Feb 2021 07:59:39 +0000 (07:59 +0000)]
Auto merge of #6661 - Manishearth:exhaustive-fix, r=flip1995

exhaustive_structs: don't trigger for structs with private fields

changelog: Restrict `exhaustive_structs` to structs with all-public
fields

3 years agoFix test formatting
Philipp Krones [Tue, 2 Feb 2021 07:59:23 +0000 (08:59 +0100)]
Fix test formatting

3 years agoupdate tracking issue for vec_extend_from_within
Ashley Mannix [Tue, 2 Feb 2021 07:47:55 +0000 (17:47 +1000)]
update tracking issue for vec_extend_from_within

3 years agoAuto merge of #81539 - nikic:update-armhf-gnu, r=sanxiyn
bors [Tue, 2 Feb 2021 06:23:10 +0000 (06:23 +0000)]
Auto merge of #81539 - nikic:update-armhf-gnu, r=sanxiyn

Update armhf-gnu to Ubuntu 20.04

This requires updating the used Linux kernel to avoid an assembler
error, the used busybox version to avoid a linker error, the used
rootfs to match the host version and the qemu flags to work with
the newer version.

r? `@Mark-Simulacrum`

3 years agoImprove wording of suggestion about accessing field
Hirochika Matsumoto [Tue, 2 Feb 2021 06:14:24 +0000 (15:14 +0900)]
Improve wording of suggestion about accessing field

3 years agoFix AArch64 types in std::os::raw
Amanieu d'Antras [Mon, 1 Feb 2021 22:29:04 +0000 (22:29 +0000)]
Fix AArch64 types in std::os::raw

3 years agoUpgrade libc to 0.2.85
Amanieu d'Antras [Thu, 21 Jan 2021 00:12:40 +0000 (00:12 +0000)]
Upgrade libc to 0.2.85

3 years agoNew migration
Aman Arora [Tue, 26 Jan 2021 09:08:23 +0000 (04:08 -0500)]
New migration

3 years agoAuto merge of #81651 - ehuss:update-cargo, r=ehuss
bors [Tue, 2 Feb 2021 03:33:07 +0000 (03:33 +0000)]
Auto merge of #81651 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in c3abcfe8a75901c7c701557a728941e8fb19399e..e099df243bb2495b9b197f79c19f124032b1e778
2021-01-25 16:16:43 +0000 to 2021-02-01 16:24:34 +0000
- Impl warn for locked install without Cargo.lock (rust-lang/cargo#9108)
- Document -Z extra-link-arg. (rust-lang/cargo#9121)
- Flip 'foo' and 'bar' to be consistent (rust-lang/cargo#9120)
- Don't try to parse MSRV if feature is not enabled (rust-lang/cargo#9115)
- simplify char range check (rust-lang/cargo#9110)

3 years agoPR fixup
Aman Arora [Tue, 19 Jan 2021 08:15:36 +0000 (03:15 -0500)]
PR fixup

3 years agoMark the lint doc as compile_fail
Aman Arora [Sun, 3 Jan 2021 02:28:28 +0000 (21:28 -0500)]
Mark the lint doc as compile_fail

3 years agoTests for 2229 lint
Aman Arora [Wed, 30 Dec 2020 04:43:44 +0000 (23:43 -0500)]
Tests for 2229 lint

3 years agoexhaustive_structs: don't trigger for structs with private fields
Manish Goregaokar [Tue, 2 Feb 2021 02:38:43 +0000 (18:38 -0800)]
exhaustive_structs: don't trigger for structs with private fields

3 years agoUpdate cargo
Eric Huss [Tue, 2 Feb 2021 01:51:31 +0000 (17:51 -0800)]
Update cargo

3 years agoAuto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27
bors [Tue, 2 Feb 2021 00:15:06 +0000 (00:15 +0000)]
Auto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27

Fix primitive search in parameters and returned values

Part of #60485.
Fixes #74780.

Replacing #74879.

cc `@camelid` `@jyn514` `@CraftSpider`
r? `@ollie27`

3 years agoMigrations first pass
Aman Arora [Tue, 15 Dec 2020 08:38:15 +0000 (03:38 -0500)]
Migrations first pass

3 years agoProcess mentioned upvars for analysis first pass after ExprUseVisitor
Aman Arora [Sat, 21 Nov 2020 09:23:42 +0000 (04:23 -0500)]
Process mentioned upvars for analysis first pass after ExprUseVisitor

- This allows us add fake information after handling migrations if
  needed.
- Capture analysis also priortizes what we see earlier, which means
  fake information should go in last.

3 years agoFix bug with assert!() calling the wrong edition of panic!().
Mara Bos [Mon, 1 Feb 2021 22:08:22 +0000 (23:08 +0100)]
Fix bug with assert!() calling the wrong edition of panic!().

The span of `panic!` produced by the `assert` macro did not carry the
right edition. This changes `assert` to call the right version.

3 years agoAdd UI test for panic/assert in Rust 2021.
Mara Bos [Mon, 1 Feb 2021 22:07:49 +0000 (23:07 +0100)]
Add UI test for panic/assert in Rust 2021.

3 years agoplacate tidy.
Felix S. Klock II [Sat, 23 Jan 2021 05:59:32 +0000 (00:59 -0500)]
placate tidy.