Commit Graph

168872 Commits

Author SHA1 Message Date
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
est31
99603ef074 Remove box syntax from rustc_mir_dataflow and rustc_mir_transform 2022-05-22 17:19:44 +02:00
Jack Huey
683a9c8391 Do leak check after function ptr coercion 2022-05-22 11:18:36 -04:00
Joshua Nelson
751ad4a0e9 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.
2022-05-22 09:44:23 -05:00
yue4u
1532fd8cd0 Quote replace target in bootstrap configure 2022-05-22 23:17:44 +09:00
Joshua Nelson
b0ea4e74cb 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.
2022-05-22 08:31:50 -05:00
Proloy Mishra
2e2836ad14
small change 2022-05-22 17:52:04 +05:30
bors
4bb4dc4672 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`
2022-05-22 11:51:25 +00:00
Caio
664e8a9ce5 [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
Vadim Petrochenkov
09b4c7c89d rustc_ast: Support MacArgs::inner_tokens for arbitrary expressions 2022-05-22 12:01:07 +03:00
Vadim Petrochenkov
8e8fb4f49e rustc_parse: Move AST -> TokenStream conversion logic to rustc_ast 2022-05-22 12:01:07 +03:00
bors
653463731a 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.
2022-05-22 09:00:30 +00:00
Ding Xiang Fei
6044fbe462
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>
2022-05-22 16:46:50 +08:00
Yuki Okushi
ea9d2fb85c
Add regression test for #91949 2022-05-22 16:13:25 +09:00
bors
acfd327fd4 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?
2022-05-22 06:47:36 +00:00
bors
bb5e6c984d 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
2022-05-22 04:27:10 +00:00
Yuki Okushi
97e1ab0005
Rollup merge of #97259 - jyn514:fix-typo, r=JohnTitor
Fix typo in Mir phase docs
2022-05-22 11:53:09 +09:00
Yuki Okushi
76725e081d
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
2022-05-22 11:53:08 +09:00
Yuki Okushi
6ef4911b99
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
2022-05-22 11:53:07 +09:00
Yuki Okushi
c7c5980e90
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](f624095e1c/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.
2022-05-22 11:53:06 +09:00
Yuki Okushi
d22ebf0d13
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.
2022-05-22 11:53:05 +09:00
Yuki Okushi
e1340f2d3c
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`
2022-05-22 11:53:04 +09:00