]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUpdate tests on aarch64
Oli Scherer [Fri, 27 May 2022 09:18:11 +0000 (09:18 +0000)]
Update tests on aarch64

2 years agoFall through to check other arguments instead of bailing out on the first error
Oli Scherer [Wed, 25 May 2022 14:01:06 +0000 (14:01 +0000)]
Fall through to check other arguments instead of bailing out on the first error

2 years agoUpdate messages
Oli Scherer [Tue, 24 May 2022 16:33:06 +0000 (16:33 +0000)]
Update messages

2 years agoMake a test independent of 64/32 bit
Oli Scherer [Thu, 14 Apr 2022 13:29:42 +0000 (13:29 +0000)]
Make a test independent of 64/32 bit

2 years agoRemove outdated comment
Oli Scherer [Thu, 14 Apr 2022 13:23:45 +0000 (13:23 +0000)]
Remove outdated comment

2 years agoAdd the transmute and asm checks to typeck as deferred checks
Oli Scherer [Thu, 14 Apr 2022 12:07:36 +0000 (12:07 +0000)]
Add the transmute and asm checks to typeck as deferred checks

2 years agoRemove the check_mod_intrinsics query
Oli Scherer [Wed, 13 Apr 2022 14:49:03 +0000 (14:49 +0000)]
Remove the check_mod_intrinsics query

2 years agomove intrinsicck to typeck
Oli Scherer [Wed, 4 May 2022 07:56:57 +0000 (07:56 +0000)]
move intrinsicck to typeck

2 years agotrait selection errors should poison the typeck results, too, so that const eval...
Oli Scherer [Wed, 13 Apr 2022 14:37:36 +0000 (14:37 +0000)]
trait selection errors should poison the typeck results, too, so that const eval can avoid running at all

2 years agoAuto merge of #97121 - pvdrz:do-subdiagnostics-later, r=davidtwco
bors [Tue, 24 May 2022 10:25:13 +0000 (10:25 +0000)]
Auto merge of #97121 - pvdrz:do-subdiagnostics-later, r=davidtwco

Avoid double binding of subdiagnostics inside `#[derive(SessionDiagnostic)]`

r? `@davidtwco`

2 years agoAuto merge of #96098 - JakobDegen:always-return-place, r=oli-obk
bors [Tue, 24 May 2022 07:13:26 +0000 (07:13 +0000)]
Auto merge of #96098 - JakobDegen:always-return-place, r=oli-obk

Refactor call terminator to always include destination place

In #71117 people seemed to agree that call terminators should always have a destination place, even if the call was guaranteed to diverge. This implements that. Unsurprisingly, the diff touches a lot of code, but thankfully I had to do almost nothing interesting. The only interesting thing came up in const prop, where the stack frame having no return place was also used to indicate that the layout could not be computed (or similar). I replaced this with a ZST allocation, which should continue to do the right things.

cc `@RalfJung` `@eddyb` who were involved in the original conversation

r? rust-lang/mir-opt

2 years agoAuto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitor
bors [Tue, 24 May 2022 04:32:42 +0000 (04:32 +0000)]
Auto merge of #97342 - JohnTitor:rollup-zqxctaw, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #97240 (Typo suggestion for a variable with a name similar to struct fields)
 - #97289 (Lifetime variance fixes for clippy)
 - #97290 (Turn on `fast_submodules` unconditionally)
 - #97336 (typo)
 - #97337 (Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`)

Failed merges:

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

2 years agoRollup merge of #97337 - tbu-:pr_fix_stabilization_ipv4_mapped, r=Mark-Simulacrum
Yuki Okushi [Tue, 24 May 2022 03:18:34 +0000 (12:18 +0900)]
Rollup merge of #97337 - tbu-:pr_fix_stabilization_ipv4_mapped, r=Mark-Simulacrum

Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`

2 years agoRollup merge of #97336 - tshepang:typo, r=cjgillot
Yuki Okushi [Tue, 24 May 2022 03:18:33 +0000 (12:18 +0900)]
Rollup merge of #97336 - tshepang:typo, r=cjgillot

typo

2 years agoRollup merge of #97290 - jyn514:fast-submodules, r=Mark-Simulacrum
Yuki Okushi [Tue, 24 May 2022 03:18:32 +0000 (12:18 +0900)]
Rollup merge of #97290 - jyn514:fast-submodules, r=Mark-Simulacrum

Turn on `fast_submodules` unconditionally

I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.

2 years agoRollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum
Yuki Okushi [Tue, 24 May 2022 03:18:31 +0000 (12:18 +0900)]
Rollup merge of #97289 - compiler-errors:tcxify-clippy, r=Mark-Simulacrum

Lifetime variance fixes for clippy

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the clippy team can review independently.

2 years agoRollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, r=compiler...
Yuki Okushi [Tue, 24 May 2022 03:18:30 +0000 (12:18 +0900)]
Rollup merge of #97240 - TaKO8Ki:improve-errors-about-typos-on-variables, r=compiler-errors

Typo suggestion for a variable with a name similar to struct fields

closes #97133

2 years agoTurn on `fast_submodules` unconditionally
Joshua Nelson [Sun, 22 May 2022 20:51:15 +0000 (15:51 -0500)]
Turn on `fast_submodules` unconditionally

I don't know why anyone would turn this off; doing so makes builds much slower (nearly a 60x slowdown according to #49057).
Remove the option to do so, which makes bootstrap a little easier to maintain.

Bootstrap continues to allow you to manage submodules manually by setting `submodules = false`.

2 years agoAuto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrum
bors [Tue, 24 May 2022 01:52:00 +0000 (01:52 +0000)]
Auto merge of #97272 - jackh726:ban-compare-mode-nll, r=Mark-Simulacrum

Disallow compare-mode=nll test differences

This ensures that new tests don't get added not as revisions if they have nll output. This will make stabilization PR easier.

r? `@Mark-Simulacrum`

2 years agoFix stabilization version of `Ipv6Addr::to_ipv4_mapped`
Tobias Bucher [Mon, 23 May 2022 23:05:06 +0000 (01:05 +0200)]
Fix stabilization version of `Ipv6Addr::to_ipv4_mapped`

2 years agoRefactor call terminator to always hold a destination place
Jakob Degen [Sat, 16 Apr 2022 13:27:54 +0000 (09:27 -0400)]
Refactor call terminator to always hold a destination place

2 years agotypo
Tshepang Lekhonkhobe [Mon, 23 May 2022 20:51:34 +0000 (22:51 +0200)]
typo

2 years agoAuto merge of #97120 - Kobzol:rustc-pgo-expansion, r=Mark-Simulacrum
bors [Mon, 23 May 2022 20:50:23 +0000 (20:50 +0000)]
Auto merge of #97120 - Kobzol:rustc-pgo-expansion, r=Mark-Simulacrum

Update `rustc` PGO benchmark list

I noticed that the `rustc` PGO crates do not contain any crate that would stress the trait system. I tried adding and removing various crates to the PGO benchmark list here. Here's what I found:

- Removing [`externs` and `match-stress`](https://perf.rust-lang.org/compare.html?start=c0672870491e84362f76ddecd50fa229f9b06dff&end=b056963e0324fa76c721d79f12658a64cfa4cb5e&stat=instructions:u) regresses these two benchmarks by up to 15 % and removing them doesn't improve anything else, so we should keep them.
- Adding [`keccak`](https://perf.rust-lang.org/compare.html?start=52cc7795245347500ddf6dc959cf58a7abe2d935&end=6fd27b23fd7860c79752479173b4a1b877cba490) regresses `diesel`, otherwise it doesn't do much.
- Adding [`tt-muncher`](https://perf.rust-lang.org/compare.html?start=c0672870491e84362f76ddecd50fa229f9b06dff&end=2ab5994d9cdfb098344895f7d8d5aee3cf3d6eff&stat=instructions:u) improves it very slightly, not worth it to include it IMO.
- Adding just [`diesel`](https://perf.rust-lang.org/compare.html?start=00755e4ca68f12ed200e921276788ab19975e85f&end=cd37706ad459ee8ddfda4631be71120cb7eda19d) improves it by up to 1.5 % and others crate slightly, but regresses `bitmaps`.
- Adding [`bitmaps`](https://perf.rust-lang.org/compare.html?start=67a9bcb31b85e87cc8bb327022632e48a0ca64a8&end=0cd80ba74425e6614cd52c4ea2bf6b0191c6dbc4&stat=instructions:u) improves both it and diesel, no other regressions.
- Adding [both](https://perf.rust-lang.org/compare.html?start=77972d2d0134fb597249b3b64dcf9510a790c34e&end=f968d7af511d750db96cfdc04f844fb017c079ce) `bitmaps` and `diesel` produces quite nice improvements and almost no regressions.
- Adding [ucd](https://perf.rust-lang.org/compare.html?start=b5caa5a8421f84cb7664f999b7635801bcf3f96a&end=327cc09917311f65cf427e6c0bf5f7424af9fd05&stat=instructions:u) did not have a large effect on primary benchmarks.

r? `@lqd`

2 years agoAuto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddle
bors [Mon, 23 May 2022 18:26:42 +0000 (18:26 +0000)]
Auto merge of #94053 - GuillaumeGomez:fields-stripped, r=notriddle

rustdoc: Remove fields_stripped fields (and equivalents)

Fixes #90588.

r? `@camelid`

2 years agoLifetime variance fixes for clippy
Michael Goulet [Mon, 23 May 2022 15:48:17 +0000 (08:48 -0700)]
Lifetime variance fixes for clippy

2 years agoAdd bitmaps and diesel to `rustc` PGO benchmarks
Jakub Beránek [Mon, 23 May 2022 15:55:50 +0000 (17:55 +0200)]
Add bitmaps and diesel to `rustc` PGO benchmarks

2 years agoAuto merge of #97315 - Dylan-DPC:rollup-2wee2oz, r=Dylan-DPC
bors [Mon, 23 May 2022 15:45:44 +0000 (15:45 +0000)]
Auto merge of #97315 - Dylan-DPC:rollup-2wee2oz, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #96129 (Document rounding for floating-point primitive operations and string parsing)
 - #97286 (Add new eslint rule to prevent whitespace before function call paren)
 - #97292 (Lifetime variance fixes for rustc)
 - #97309 (Add some regression tests for #90400)

Failed merges:

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

2 years agoRollup merge of #97309 - JohnTitor:issue-90400, r=compiler-errors
Dylan DPC [Mon, 23 May 2022 13:11:05 +0000 (15:11 +0200)]
Rollup merge of #97309 - JohnTitor:issue-90400, r=compiler-errors

Add some regression tests for #90400

This adds two regression tests taken from https://github.com/rust-lang/rust/issues/90400#issuecomment-954927836.
Note that we cannot close the issue right now as the [original code](https://github.com/rust-lang/rust/issues/90400#issue-1039577786) still triggers an ICE.

r? `@compiler-errors`

2 years agoRollup merge of #97292 - compiler-errors:tcxify-rustc, r=davidtwco
Dylan DPC [Mon, 23 May 2022 13:11:04 +0000 (15:11 +0200)]
Rollup merge of #97292 - compiler-errors:tcxify-rustc, r=davidtwco

Lifetime variance fixes for rustc

#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since many lifetimes are already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from #97287 so the compiler team can review independently.

2 years agoRollup merge of #97286 - GuillaumeGomez:eslint-check-fn, r=notriddle
Dylan DPC [Mon, 23 May 2022 13:11:03 +0000 (15:11 +0200)]
Rollup merge of #97286 - GuillaumeGomez:eslint-check-fn, r=notriddle

Add new eslint rule to prevent whitespace before function call paren

It prevents `foo ()` basically. :)

r? `@notriddle`

2 years agoRollup merge of #96129 - mattheww:2022-04_float_rounding, r=Dylan-DPC
Dylan DPC [Mon, 23 May 2022 13:11:02 +0000 (15:11 +0200)]
Rollup merge of #96129 - mattheww:2022-04_float_rounding, r=Dylan-DPC

Document rounding for floating-point primitive operations and string parsing

The docs for floating point don't have much to say at present about either the precision of their results or rounding behaviour.

As I understand it[^1][^2], Rust doesn't support operating with non-default rounding directions, so we need only describe roundTiesToEven.

[^1]: https://github.com/rust-lang/rust/issues/41753#issuecomment-299322887
[^2]: https://github.com/llvm/llvm-project/issues/8472#issuecomment-980888781

This PR makes a start by documenting that for primitive operations and `from_str()`.

2 years agoAuto merge of #92461 - rust-lang:const_tls_local_panic_count, r=Mark-Simulacrum
bors [Mon, 23 May 2022 13:04:59 +0000 (13:04 +0000)]
Auto merge of #92461 - rust-lang:const_tls_local_panic_count, r=Mark-Simulacrum

Use const initializer for LOCAL_PANIC_COUNT

This reduces the size of the __getit function for LOCAL_PANIC_COUNT and should speed up accesses of LOCAL_PANIC_COUNT a bit.

2 years agoGreatly extend explanations on strip_hidden items
Guillaume Gomez [Mon, 23 May 2022 12:02:10 +0000 (14:02 +0200)]
Greatly extend explanations on strip_hidden items

Co-authored-by: Michael Howell <michael@notriddle.com>
2 years agoadd typo suggestions for all `AssocSuggestion` variants
Takayuki Maeda [Mon, 23 May 2022 10:58:20 +0000 (19:58 +0900)]
add typo suggestions for all `AssocSuggestion` variants

2 years agoAuto merge of #97195 - notriddle:notriddle/cleanup, r=GuillaumeGomez
bors [Mon, 23 May 2022 10:46:50 +0000 (10:46 +0000)]
Auto merge of #97195 - notriddle:notriddle/cleanup, r=GuillaumeGomez

rustdoc: shrink GenericArgs/PathSegment with boxed slices

This PR also contains a few cleanup bits and pieces, but one of them is a broken intra-doc link, and the other is removing an unused Hash impl. The last commit is the one that matters.

2 years agoAdd some regression tests for #90400
Yuki Okushi [Mon, 23 May 2022 09:23:38 +0000 (18:23 +0900)]
Add some regression tests for #90400

2 years agoAuto merge of #97304 - Dylan-DPC:rollup-qxrfddc, r=Dylan-DPC
bors [Mon, 23 May 2022 07:57:15 +0000 (07:57 +0000)]
Auto merge of #97304 - Dylan-DPC:rollup-qxrfddc, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97087 (Clarify slice and Vec iteration order)
 - #97254 (Remove feature: `crate` visibility modifier)
 - #97271 (Add regression test for #91949)
 - #97294 (std::time : fix variable name in the doc)
 - #97303 (Fix some typos in arg checking algorithm)

Failed merges:

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

2 years agoRollup merge of #97303 - compiler-errors:arg-typos, r=jackh726
Dylan DPC [Mon, 23 May 2022 05:43:52 +0000 (07:43 +0200)]
Rollup merge of #97303 - compiler-errors:arg-typos, r=jackh726

Fix some typos in arg checking algorithm

Fixes #97197

Also fixes a typo where if we're missing args A, B, C, we actually say A, B, B

2 years agoRollup merge of #97294 - jersou:patch-1, r=Dylan-DPC
Dylan DPC [Mon, 23 May 2022 05:43:51 +0000 (07:43 +0200)]
Rollup merge of #97294 - jersou:patch-1, r=Dylan-DPC

std::time : fix variable name in the doc

2 years agoRollup merge of #97271 - JohnTitor:issue-91949, r=compiler-errors
Dylan DPC [Mon, 23 May 2022 05:43:50 +0000 (07:43 +0200)]
Rollup merge of #97271 - JohnTitor:issue-91949, r=compiler-errors

Add regression test for #91949

Closes #91949
This needs `build-fail` because the original bug only appeared with `cargo build`.
r? `@compiler-errors`

2 years agoRollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot
Dylan DPC [Mon, 23 May 2022 05:43:50 +0000 (07:43 +0200)]
Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot

Remove feature: `crate` visibility modifier

FCP completed in #53120.

2 years agoRollup merge of #97087 - Nilstrieb:clarify-slice-iteration-order, r=dtolnay
Dylan DPC [Mon, 23 May 2022 05:43:49 +0000 (07:43 +0200)]
Rollup merge of #97087 - Nilstrieb:clarify-slice-iteration-order, r=dtolnay

Clarify slice and Vec iteration order

While already being inferable from the doc examples, it wasn't fully specified. This is the only logical way to do a slice iterator, so I think this should be uncontroversial. It also improves the `Vec::into_iter` example to better show the order and that the iterator returns owned values.

2 years agoAuto merge of #96100 - Raekye:master, r=dtolnay
bors [Mon, 23 May 2022 05:32:04 +0000 (05:32 +0000)]
Auto merge of #96100 - Raekye:master, r=dtolnay

Change `NonNull::as_uninit_*` to take self by value (as opposed to reference), matching primitive pointers.

Copied from my comment on [#75402](https://github.com/rust-lang/rust/issues/75402#issuecomment-1100496823):

> I noticed that `as_uninit_*` on pointers take `self` by value (and pointers are `Copy`), e.g. see [`as_uninit_mut`](https://doc.rust-lang.org/core/primitive.pointer.html#method.as_uninit_mut).
>
> However, on `NonNull`, these functions take `self` by reference, e.g. see the function with the same name by for `NonNull`: [`as_uninit_mut`](https://doc.rust-lang.org/std/ptr/struct.NonNull.html#method.as_uninit_mut) takes `self` by mutable reference. Even more inconsistent, [`as_uninit_slice_mut`](https://doc.rust-lang.org/std/ptr/struct.NonNull.html#method.as_uninit_slice_mut) returns a mutable reference, but takes `self` by immutable reference.
>
> I think these methods should take `self` by value for consistency. The returned lifetime is unbounded anyways and not tied to the pointer/NonNull value anyways

I realized the change is trivial (if desired) so here I am creating my first PR. I think it's not a breaking change since (it's on nightly and) `NonNull` is `Copy`; all previous usages of these methods taking `self` by reference should continue to compile. However, it might cause warnings to appear on usages of `NonNull::as_uninit_mut`, which used to require the the `NonNull` variable be declared `mut`, but now it's not necessary.

2 years agoFix some typos in arg checking algorithm
Michael Goulet [Mon, 23 May 2022 05:06:27 +0000 (22:06 -0700)]
Fix some typos in arg checking algorithm

2 years agoDisallow non-same compare-mode-nll
Jack Huey [Sun, 22 May 2022 07:04:12 +0000 (03:04 -0400)]
Disallow non-same compare-mode-nll

2 years agoAuto merge of #96455 - dtolnay:writetmp, r=m-ou-se
bors [Mon, 23 May 2022 02:50:50 +0000 (02:50 +0000)]
Auto merge of #96455 - dtolnay:writetmp, r=m-ou-se

Make write/print macros eagerly drop temporaries

This PR fixes the 2 regressions in #96434 (`println` and `eprintln`) and changes all the other similar macros (`write`, `writeln`, `print`, `eprint`) to match the old pre-#94868 behavior of `println` and `eprintln`.

argument position | before #94868 | after #94868 | after this PR
--- |:---:|:---:|:---:
`write!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat:
`write!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat:
`writeln!($tmp, "…", …)` | :rage: | :rage: | :smiley_cat:
`writeln!(…, "…", $tmp)` | :rage: | :rage: | :smiley_cat:
`print!("…", $tmp)` | :rage: | :rage: | :smiley_cat:
`println!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`eprint!("…", $tmp)` | :rage: | :rage: | :smiley_cat:
`eprintln!("…", $tmp)` | :smiley_cat: | :rage: | :smiley_cat:
`panic!("…", $tmp)` | :smiley_cat: | :smiley_cat: | :smiley_cat:

Example of code that is affected by this change:

```rust
use std::sync::Mutex;

fn main() {
    let mutex = Mutex::new(0);
    print!("{}", mutex.lock().unwrap()) /* no semicolon */
}
```

You can see several real-world examples like this in the Crater links at the top of #96434. This code failed to compile prior to this PR as follows, but works after this PR.

```console
error[E0597]: `mutex` does not live long enough
 --> src/main.rs:5:18
  |
5 |     print!("{}", mutex.lock().unwrap()) /* no semicolon */
  |                  ^^^^^^^^^^^^---------
  |                  |
  |                  borrowed value does not live long enough
  |                  a temporary with access to the borrow is created here ...
6 | }
  | -
  | |
  | `mutex` dropped here while still borrowed
  | ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `MutexGuard`
```

2 years agoFix clippy explicit_write lint for new writeln implementation
David Tolnay [Mon, 23 May 2022 00:39:44 +0000 (17:39 -0700)]
Fix clippy explicit_write lint for new writeln implementation

2 years agoAuto merge of #96906 - tbu-:pr_stabilize_to_ipv4_mapped, r=dtolnay
bors [Mon, 23 May 2022 00:10:07 +0000 (00:10 +0000)]
Auto merge of #96906 - tbu-:pr_stabilize_to_ipv4_mapped, r=dtolnay

Stabilize `Ipv6Addr::to_ipv4_mapped`

CC https://github.com/rust-lang/rust/issues/27709 (tracking issue for the `ip` feature which contains more
functions)

The function `Ipv6Addr::to_ipv4` is bad because it also returns an IPv4
address for the IPv6 loopback address `::1`. Stabilize
`Ipv6Addr::to_ipv4_mapped` so we can recommend that function instead.

2 years agoMake write/print macros eagerly drop temporaries
David Tolnay [Tue, 26 Apr 2022 22:16:23 +0000 (15:16 -0700)]
Make write/print macros eagerly drop temporaries

2 years agoAdd test of temporaries inside format_args of core/std macros
David Tolnay [Tue, 26 Apr 2022 22:00:36 +0000 (15:00 -0700)]
Add test of temporaries inside format_args of core/std macros

2 years agoClean up `&args[..]`, use more readable `args.iter()` instead
Michael Howell [Sun, 22 May 2022 22:03:51 +0000 (15:03 -0700)]
Clean up `&args[..]`, use more readable `args.iter()` instead

2 years agostd::time : fix doc variable name
jersou [Sun, 22 May 2022 22:02:09 +0000 (00:02 +0200)]
std::time : fix doc variable name

2 years agoAuto merge of #97258 - jackh726:nll-revisions, r=cjgillot
bors [Sun, 22 May 2022 21:45:42 +0000 (21:45 +0000)]
Auto merge of #97258 - jackh726:nll-revisions, r=cjgillot

Move remaining tests with NLL differences to revisions

Based on #97206

I've already filed issues for any important differences that I've spotted: #97252 #97253 #97256 #97267

There is a lot here, but each commit is self-contained as a separate directory. I can split into separate PRs as wanted or needed.

2 years agoLifetime variance fixes for rustc
Michael Goulet [Sun, 22 May 2022 19:48:19 +0000 (12:48 -0700)]
Lifetime variance fixes for rustc

2 years agoAdd new eslint rule to prevent whitespace before function call paren
Guillaume Gomez [Sun, 22 May 2022 20:29:44 +0000 (22:29 +0200)]
Add new eslint rule to prevent whitespace before function call paren

2 years agoUse revisions for NLL in lifetimes
Jack Huey [Sun, 22 May 2022 06:05:15 +0000 (02:05 -0400)]
Use revisions for NLL in lifetimes

2 years agoUse revisions for NLL in suggestions
Jack Huey [Sun, 22 May 2022 05:36:12 +0000 (01:36 -0400)]
Use revisions for NLL in suggestions

2 years agoUse revisions for NLL in issues
Jack Huey [Sun, 22 May 2022 05:02:55 +0000 (01:02 -0400)]
Use revisions for NLL in issues

2 years agoUse revisions for NLL in hrtb
Jack Huey [Sun, 22 May 2022 04:39:32 +0000 (00:39 -0400)]
Use revisions for NLL in hrtb

2 years agoUse revisions for NLL in traits
Jack Huey [Sun, 22 May 2022 04:26:21 +0000 (00:26 -0400)]
Use revisions for NLL in traits

2 years agoUse revisions for NLL in async-await
Jack Huey [Sat, 21 May 2022 19:46:25 +0000 (15:46 -0400)]
Use revisions for NLL in async-await

2 years agoUse revisions or ignore-compare-mode-nll for NLL in generic-associated-types
Jack Huey [Sat, 21 May 2022 19:33:42 +0000 (15:33 -0400)]
Use revisions or ignore-compare-mode-nll for NLL in generic-associated-types

2 years agoUse revisions for NLL in generator
Jack Huey [Sat, 21 May 2022 19:26:58 +0000 (15:26 -0400)]
Use revisions for NLL in generator

2 years agoUse revisions for NLL in various directories
Jack Huey [Sat, 21 May 2022 19:14:11 +0000 (15:14 -0400)]
Use revisions for NLL in various directories

2 years agoUse revisions for NLL in object-lifetime
Jack Huey [Sat, 21 May 2022 18:45:57 +0000 (14:45 -0400)]
Use revisions for NLL in object-lifetime

2 years agoUse revisions for NLL in borrowck
Jack Huey [Sat, 21 May 2022 18:34:03 +0000 (14:34 -0400)]
Use revisions for NLL in borrowck

2 years agoUse revisions for NLL in const-generics and match
Jack Huey [Sat, 21 May 2022 18:27:58 +0000 (14:27 -0400)]
Use revisions for NLL in const-generics and match

2 years agoUse revisions for NLL in closures
Jack Huey [Sat, 21 May 2022 18:22:42 +0000 (14:22 -0400)]
Use revisions for NLL in closures

2 years agoUse revisions for NLL in associated-types
Jack Huey [Sat, 21 May 2022 18:14:28 +0000 (14:14 -0400)]
Use revisions for NLL in associated-types

2 years agoUse revisions for NLL in nll
Jack Huey [Sat, 21 May 2022 17:42:16 +0000 (13:42 -0400)]
Use revisions for NLL in nll

2 years agoUse revisions for NLL in impl-trait
Jack Huey [Sat, 21 May 2022 17:15:53 +0000 (13:15 -0400)]
Use revisions for NLL in impl-trait

2 years agoUse revisions for NLL (consistently) in higher-ranked-trait-bounds
Jack Huey [Sat, 21 May 2022 16:59:02 +0000 (12:59 -0400)]
Use revisions for NLL (consistently) in higher-ranked-trait-bounds

2 years agoFor hr-subtype test, use check-pass instead of rustc_error and split nll differences...
Jack Huey [Sat, 21 May 2022 16:45:44 +0000 (12:45 -0400)]
For hr-subtype test, use check-pass instead of rustc_error and split nll differences to separate test

2 years agoAuto merge of #97281 - est31:remove_box, r=compiler-errors
bors [Sun, 22 May 2022 19:16:17 +0000 (19:16 +0000)]
Auto merge of #97281 - est31:remove_box, r=compiler-errors

Remove box syntax from rustc_mir_dataflow and rustc_mir_transform

Continuation of #87781, inspired by #97239. The usages that this PR removes have not appeared from nothing, instead the usage in `rustc_mir_dataflow` and `rustc_mir_transform` was from #80522 which split up `rustc_mir`, and which was filed before I filed #87781, so it was using the state from before my PR. But it was merged after my PR was merged, so the `box_syntax` uses were able to survive here. Outside of this introduction due to the code being outside of the master branch at the point of merging of my PR, there was only one other introduction of box syntax, in #95159. That box syntax was removed again though in #95555. Outside of that, `box_syntax` has not made its reoccurrance in compiler crates.

2 years agoAuto merge of #97283 - jackh726:rollup-ga84p7n, r=jackh726
bors [Sun, 22 May 2022 16:47:17 +0000 (16:47 +0000)]
Auto merge of #97283 - jackh726:rollup-ga84p7n, r=jackh726

Rollup of 5 pull requests

Successful merges:

 - #97043 (Move some tests to more reasonable directories)
 - #97206 (Do leak check after function pointer coercion)
 - #97275 (small change)
 - #97277 (Avoid accidentally enabling unstable features in compilers (take 2))
 - #97280 (Quote replace target in bootstrap configure)

Failed merges:

 - #97214 (Finish bumping stage0)

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

2 years agoRollup merge of #97280 - yue4u:quote-replace-target-in-bootstrap-configure, r=Mark...
Jack Huey [Sun, 22 May 2022 15:37:43 +0000 (11:37 -0400)]
Rollup merge of #97280 - yue4u:quote-replace-target-in-bootstrap-configure, r=Mark-Simulacrum

Quote replace target in bootstrap configure

close #97263

2 years agoRollup merge of #97277 - jyn514:no-unstable-for-bootstrap, r=Mark-Simulacrum
Jack Huey [Sun, 22 May 2022 15:37:42 +0000 (11:37 -0400)]
Rollup merge of #97277 - jyn514:no-unstable-for-bootstrap, r=Mark-Simulacrum

Avoid accidentally enabling unstable features in compilers (take 2)

This allows rustbuild to control whether crates can use nightly features or not.
It also prevents rustbuild from using nightly features itself.

This is #92261, but I fixed the CI error.

2 years agoRollup merge of #97275 - pro465:patch-1, r=Dylan-DPC
Jack Huey [Sun, 22 May 2022 15:37:42 +0000 (11:37 -0400)]
Rollup merge of #97275 - pro465:patch-1, r=Dylan-DPC

small change

probably not worth writing a comment about...

2 years agoRollup merge of #97206 - jackh726:issue-73154, r=nikomatsakis
Jack Huey [Sun, 22 May 2022 15:37:40 +0000 (11:37 -0400)]
Rollup merge of #97206 - jackh726:issue-73154, r=nikomatsakis

Do leak check after function pointer coercion

cc #73154

I still need to clean diagnostics just a tad, but figured I would put this up anyways.

This change is made in order to make match arm coercion order-independent.

Basically, any time we do function pointer coercion, we follow it by doing a leak check. This is necessary because the LUB code doesn't handler higher-ranked things correctly, leading us to "coerce", but use the wrong type. A proper fix is to actually fix that code (so the type returned by `unify_and` is a supertype of both `a` and `b` if `Ok`). However, that requires a more in-depth fix, likely heavily overlapping with the new subtyping changes.

Here, I've been conservative and error early if we generate unsatisfiable constraints. Note, this should *mostly* only affect NLL, since migrate mode falls back to the LUB implementation (followed by leak check), whereas NLL only does sub.

There could be other coercion code that has an order-dependence where a leak check in the coercion code might be useful. However, this is more of a spot-fix for #73154 than a "permanent" fix, since we likely want to go the other way long-term, and allow this pattern without error.

r? `@nikomatsakis`

2 years agoRollup merge of #97043 - c410-f3r:z-errors, r=petrochenkov
Jack Huey [Sun, 22 May 2022 15:37:39 +0000 (11:37 -0400)]
Rollup merge of #97043 - c410-f3r:z-errors, r=petrochenkov

Move some tests to more reasonable directories

r? `@petrochenkov`

2 years agoRemove box syntax from rustc_mir_dataflow and rustc_mir_transform
est31 [Sun, 22 May 2022 14:39:32 +0000 (16:39 +0200)]
Remove box syntax from rustc_mir_dataflow and rustc_mir_transform

2 years agoDo leak check after function ptr coercion
Jack Huey [Fri, 20 May 2022 06:00:42 +0000 (02:00 -0400)]
Do leak check after function ptr coercion

2 years agoDisable unstable features in bootstrap tools
Joshua Nelson [Sun, 22 May 2022 14:44:23 +0000 (09:44 -0500)]
Disable unstable features in bootstrap tools

This statically prevents issues like https://github.com/rust-lang/rust/issues/59264,
where tools can only be built with the in-tree compiler and not beta.

2 years agoQuote replace target in bootstrap configure
yue4u [Sun, 22 May 2022 14:17:44 +0000 (23:17 +0900)]
Quote replace target in bootstrap configure

2 years agoAvoid accidentally enabling unstable features in compilers (take 2)
Joshua Nelson [Sun, 22 May 2022 13:30:56 +0000 (08:30 -0500)]
Avoid accidentally enabling unstable features in compilers (take 2)

This allows rustbuild to control whether crates can use nightly features or not.
It also prevents rustbuild from using nightly features itself.

2 years agosmall change
Proloy Mishra [Sun, 22 May 2022 12:22:04 +0000 (17:52 +0530)]
small change

2 years agoAuto merge of #97251 - petrochenkov:eqtokens, r=nnethercote
bors [Sun, 22 May 2022 11:51:25 +0000 (11:51 +0000)]
Auto merge of #97251 - petrochenkov:eqtokens, r=nnethercote

rustc_parse: Move AST -> TokenStream conversion logic to rustc_ast

In the past falling back to reparsing pretty-printed strings was common, so some of this logic had to live in `rustc_parse`, but now the reparsing fallback is only used in two corner cases so we can move this logic to `rustc_ast` which makes many things simpler.

It also helps to fix `MacArgs::inner_tokens` for `MacArgs::Eq` with non-literal expressions, which is done in the second commit.
r? `@nnethercote`

2 years agorustc_ast: Support MacArgs::inner_tokens for arbitrary expressions
Vadim Petrochenkov [Sun, 22 May 2022 09:00:59 +0000 (12:00 +0300)]
rustc_ast: Support MacArgs::inner_tokens for arbitrary expressions

2 years agorustc_parse: Move AST -> TokenStream conversion logic to `rustc_ast`
Vadim Petrochenkov [Sat, 21 May 2022 12:50:39 +0000 (15:50 +0300)]
rustc_parse: Move AST -> TokenStream conversion logic to `rustc_ast`

2 years agoAuto merge of #95563 - dingxiangfei2009:dxf-rfc66-refactor, r=nikomatsakis
bors [Sun, 22 May 2022 09:00:30 +0000 (09:00 +0000)]
Auto merge of #95563 - dingxiangfei2009:dxf-rfc66-refactor, r=nikomatsakis

Move the extended lifetime resolution into typeck context

Related to #15023

This PR is based on the [idea](https://github.com/rust-lang/rust/issues/15023#issuecomment-1070931433) of #15023 by `@nikomatsakis.`

This PR specifically proposes to
- Delay the resolution of scopes of rvalues to a later stage, so that enough type information is available to refine those scopes based on relationships of lifetimes.
- Highlight relevant parts that would help future reviews on the next installments of works to fully implement a solution to RFC 66.

2 years agofactor out the rvalue lifetime rule
Ding Xiang Fei [Fri, 1 Apr 2022 13:12:18 +0000 (21:12 +0800)]
factor out the rvalue lifetime rule

remove region_scope_tree from RegionCtxt

Apply suggestions from code review

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2 years agoAdd regression test for #91949
Yuki Okushi [Sun, 22 May 2022 07:13:25 +0000 (16:13 +0900)]
Add regression test for #91949

2 years agoAuto merge of #97177 - oli-obk:const-stability, r=davidtwco
bors [Sun, 22 May 2022 06:47:36 +0000 (06:47 +0000)]
Auto merge of #97177 - oli-obk:const-stability, r=davidtwco

Implement proper stability check for const impl Trait, fall back to unstable const when undeclared

Continuation of #93960

`@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?

2 years agoAuto merge of #97265 - JohnTitor:rollup-kgthnjt, r=JohnTitor
bors [Sun, 22 May 2022 04:27:10 +0000 (04:27 +0000)]
Auto merge of #97265 - JohnTitor:rollup-kgthnjt, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #97144 (Fix rusty grammar in `std::error::Reporter` docs)
 - #97225 (Fix `Display` for `cell::{Ref,RefMut}`)
 - #97228 (Omit stdarch workspace from rust-src)
 - #97236 (Recover when resolution did not resolve lifetimes.)
 - #97245 (Fix typo in futex RwLock::write_contended.)
 - #97259 (Fix typo in Mir phase docs)

Failed merges:

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

2 years agoRollup merge of #97259 - jyn514:fix-typo, r=JohnTitor
Yuki Okushi [Sun, 22 May 2022 02:53:09 +0000 (11:53 +0900)]
Rollup merge of #97259 - jyn514:fix-typo, r=JohnTitor

Fix typo in Mir phase docs

2 years agoRollup merge of #97245 - m-ou-se:rwlock-state-typo, r=JohnTitor
Yuki Okushi [Sun, 22 May 2022 02:53:08 +0000 (11:53 +0900)]
Rollup merge of #97245 - m-ou-se:rwlock-state-typo, r=JohnTitor

Fix typo in futex RwLock::write_contended.

I wrote `state` where I should've used `s`.

This was spotted by `@Warrenren.`

This change removes the unnecessary `s` variable to prevent that mistake.

Fortunately, this typo didn't affect the correctness of the lock, as the
second half of the condition (!has_writers_waiting) is enough for
correctness, which explains why this mistake didn't show up during
testing.

Fixes https://github.com/rust-lang/rust/issues/97162

2 years agoRollup merge of #97236 - cjgillot:recover-lifetime-res, r=jackh726
Yuki Okushi [Sun, 22 May 2022 02:53:07 +0000 (11:53 +0900)]
Rollup merge of #97236 - cjgillot:recover-lifetime-res, r=jackh726

Recover when resolution did not resolve lifetimes.

This can happen for items inside a foreign fn's body, which are not visited at all.

Fixes https://github.com/rust-lang/rust/issues/97193
Fixes https://github.com/rust-lang/rust/issues/97194

2 years agoRollup merge of #97228 - jonhoo:patch-1, r=bjorn3
Yuki Okushi [Sun, 22 May 2022 02:53:06 +0000 (11:53 +0900)]
Rollup merge of #97228 - jonhoo:patch-1, r=bjorn3

Omit stdarch workspace from rust-src

The path `library/stdarch/crates/Cargo.toml` does not exist.

In Rust 1.61.0, `rust-src` still includes `src/rust/library/stdarch/Cargo.toml` (but not `stdarch-verify`), which includes
```toml
[workspace]
members = [
  "crates/stdarch-verify"
```

This didn't show up when testing with `-Zbuild-std` in https://github.com/rust-lang/rust/pull/94907 since the [standard list of crates](https://github.com/rust-lang/cargo/blob/f624095e1c98228a74a165ddb702078c0dd8b81e/src/cargo/core/compiler/standard_lib.rs#L26-L30) to include when building `std` does not include `stdarch`, but it will show up if a user explicitly requests `stdarch`. Or, perhaps more importantly, because of https://github.com/rust-lang/rust/issues/95736, many editors (like IntelliJ) won't treat the root of `rust-src` as a workspace, and will instead recurse into all the sub-crates directly, which then includes `stdarch`.

Also related to https://github.com/rust-lang/rust/issues/94906.

2 years agoRollup merge of #97225 - cuviper:ref-display, r=scottmcm
Yuki Okushi [Sun, 22 May 2022 02:53:05 +0000 (11:53 +0900)]
Rollup merge of #97225 - cuviper:ref-display, r=scottmcm

Fix `Display` for `cell::{Ref,RefMut}`

These guards changed to pointers in #97027, but their `Display` was
formatting that field directly, which made it show the raw pointer
value. Now we go through `Deref` to display the real value again.

Miri noticed this change, #97204, so hopefully that will be fixed.

2 years agoRollup merge of #97144 - samziz:patch-1, r=Dylan-DPC
Yuki Okushi [Sun, 22 May 2022 02:53:04 +0000 (11:53 +0900)]
Rollup merge of #97144 - samziz:patch-1, r=Dylan-DPC

Fix rusty grammar in `std::error::Reporter` docs

### Commit

I initially saw "print's" instead of "prints" at the start of the doc comment for `std::error::Reporter`, while reading the docs for that type. Then I figured 'probably more where that came from', so, as well as correcting the foregoing to "prints", I've patched up these three minor solecisms (well, two [types](https://en.wikipedia.org/wiki/Type%E2%80%93token_distinction), three [tokens](https://en.wikipedia.org/wiki/Type%E2%80%93token_distinction)):

- One use of the indicative which should be subjunctive - indeed the sentence immediately following it, which mirrors its structure, _does_ use the subjunctive ([L871](https://github.com/rust-lang/rust/blob/master/library/std/src/error.rs?plain=1#L871)). Replaced with the subjunctive.
- Two separate clauses joined with commas ([L975](https://github.com/rust-lang/rust/blob/master/library/std/src/error.rs?plain=1#L975), [L1023](https://github.com/rust-lang/rust/blob/master/library/std/src/error.rs?plain=1#L1023)). Replaced the first with a semicolon and the second with a period. Admittedly those judgements are pretty much 100% subjective, based on my sense of how the sentences flowed into each other (though ofc the _replacement of the comma itself_ is not subjective or opinion-based).

I know this is silly and finicky, but I hope it helps tidy up the docs a bit for future readers!

### PR notes

**This is very much non-urgent (and, honestly, non-important).** I just figured it might be a nice quality-of-life improvement and bit of tidying up for the core contributors themselves not to have to do. 🙂

I'm tagging Steve, per the [contributing guidelines](https://rustc-dev-guide.rust-lang.org/contributing.html#r) ("Steve usually reviews documentation changes. So if you were to make a documentation change, add `r? `@steveklabnik`"):`

r? `@steveklabnik`