Commit Graph

168948 Commits

Author SHA1 Message Date
Takayuki Maeda
39caed08ae add typo suggestions for all AssocSuggestion variants 2022-05-23 19:58:20 +09:00
bors
32c8c5df06 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.
2022-05-23 10:46:50 +00:00
Yuki Okushi
622244ac58
Add some regression tests for #90400 2022-05-23 18:23:38 +09:00
Yuki Okushi
65242592c9
Stabilize cell_filter_map 2022-05-23 18:04:53 +09:00
bors
9e2f655863 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
2022-05-23 07:57:15 +00:00
Dylan DPC
b5ff4ad02c
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
2022-05-23 07:43:52 +02:00
Dylan DPC
06e89fdcfd
Rollup merge of #97294 - jersou:patch-1, r=Dylan-DPC
std::time : fix variable name in the doc
2022-05-23 07:43:51 +02:00
Dylan DPC
6d366f15d4
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`
2022-05-23 07:43:50 +02:00
Dylan DPC
b73f1c77a7
Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot
Remove feature: `crate` visibility modifier

FCP completed in #53120.
2022-05-23 07:43:50 +02:00
Dylan DPC
e5cf3cb97d
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.
2022-05-23 07:43:49 +02:00
bors
03c8b0b6ed 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.
2022-05-23 05:32:04 +00:00
Michael Goulet
21a7b4cb97 Fix some typos in arg checking algorithm 2022-05-22 22:07:09 -07:00
Michael Goulet
e9215bb7a9 Do writeback of child expressions before parent expression 2022-05-22 21:42:01 -07:00
Jack Huey
2c75eca035 Disallow non-same compare-mode-nll 2022-05-22 23:57:55 -04:00
bors
c186f7c079 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, "…", …)` | 😡 | 😡 | 😺
`write!(…, "…", $tmp)` | 😡 | 😡 | 😺
`writeln!($tmp, "…", …)` | 😡 | 😡 | 😺
`writeln!(…, "…", $tmp)` | 😡 | 😡 | 😺
`print!("…", $tmp)` | 😡 | 😡 | 😺
`println!("…", $tmp)` | 😺 | 😡 | 😺
`eprint!("…", $tmp)` | 😡 | 😡 | 😺
`eprintln!("…", $tmp)` | 😺 | 😡 | 😺
`panic!("…", $tmp)` | 😺 | 😺 | 😺

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`
```
2022-05-23 02:50:50 +00:00
David Tolnay
a6100988ff
Fix clippy explicit_write lint for new writeln implementation 2022-05-22 17:39:56 -07:00
bors
d12557407c 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.
2022-05-23 00:10:07 +00:00
David Tolnay
0502496b1e
Make write/print macros eagerly drop temporaries 2022-05-22 16:11:08 -07:00
David Tolnay
ae29890ab6
Add test of temporaries inside format_args of core/std macros 2022-05-22 16:11:08 -07:00
Michael Howell
207f64948f Clean up &args[..], use more readable args.iter() instead 2022-05-22 15:03:51 -07:00
jersou
526a665e96
std::time : fix doc variable name 2022-05-23 00:02:09 +02:00
bors
07e7b4346c 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.
2022-05-22 21:45:42 +00:00
Michael Goulet
1784634a39 Lifetime variance fixes for rustc 2022-05-22 14:29:32 -07:00
Michael Goulet
b2a95cb582 Lifetime variance fixes for rustdoc 2022-05-22 14:22:40 -07:00
Guillaume Gomez
399299fba2 Add new eslint rule to prevent whitespace before function call paren 2022-05-22 22:29:44 +02:00
Jack Huey
383fbeec63 Use revisions for NLL in lifetimes 2022-05-22 15:21:27 -04:00
Jack Huey
fe91cfd684 Use revisions for NLL in suggestions 2022-05-22 15:21:27 -04:00
Jack Huey
b391b329f0 Use revisions for NLL in issues 2022-05-22 15:21:27 -04:00
Jack Huey
b7c192e346 Use revisions for NLL in hrtb 2022-05-22 15:21:27 -04:00
Jack Huey
b16bd7c3e2 Use revisions for NLL in traits 2022-05-22 15:21:27 -04:00
Jack Huey
34a3154bd9 Use revisions for NLL in async-await 2022-05-22 15:21:27 -04:00
Jack Huey
0fbb315be7 Use revisions or ignore-compare-mode-nll for NLL in generic-associated-types 2022-05-22 15:21:27 -04:00
Jack Huey
62806f7536 Use revisions for NLL in generator 2022-05-22 15:21:27 -04:00
Jack Huey
12a2d7967c Use revisions for NLL in various directories 2022-05-22 15:21:27 -04:00
Jack Huey
99daba2a4a Use revisions for NLL in object-lifetime 2022-05-22 15:21:27 -04:00
Jack Huey
8220be5240 Use revisions for NLL in borrowck 2022-05-22 15:21:26 -04:00
Jack Huey
1e435e332e Use revisions for NLL in const-generics and match 2022-05-22 15:21:26 -04:00
Jack Huey
f1a7f9ab40 Use revisions for NLL in closures 2022-05-22 15:21:26 -04:00
Jack Huey
eb222bf943 Use revisions for NLL in associated-types 2022-05-22 15:21:26 -04:00
Jack Huey
cc97875d26 Use revisions for NLL in nll 2022-05-22 15:21:26 -04:00
Jack Huey
b9f241d407 Use revisions for NLL in impl-trait 2022-05-22 15:21:26 -04:00
Jack Huey
707d2ebb5b Use revisions for NLL (consistently) in higher-ranked-trait-bounds 2022-05-22 15:21:26 -04:00
Jack Huey
dc435ee762 For hr-subtype test, use check-pass instead of rustc_error and split nll differences to separate test 2022-05-22 15:21:26 -04:00
bors
b2eed72a6f 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.
2022-05-22 19:16:17 +00:00
bors
0a437b2ca0 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
2022-05-22 16:47:17 +00:00
Jack Huey
b392cdf7de
Rollup merge of #97280 - yue4u:quote-replace-target-in-bootstrap-configure, r=Mark-Simulacrum
Quote replace target in bootstrap configure

close #97263
2022-05-22 11:37:43 -04:00
Jack Huey
b4c17d43a6
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.
2022-05-22 11:37:42 -04:00
Jack Huey
c370e303ae
Rollup merge of #97275 - pro465:patch-1, r=Dylan-DPC
small change

probably not worth writing a comment about...
2022-05-22 11:37:42 -04:00
Jack Huey
4f97de8dc5
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`
2022-05-22 11:37:40 -04:00
Jack Huey
41994470de
Rollup merge of #97043 - c410-f3r:z-errors, r=petrochenkov
Move some tests to more reasonable directories

r? `@petrochenkov`
2022-05-22 11:37:39 -04:00