Commit Graph

218537 Commits

Author SHA1 Message Date
Michael Howell f058bb0fcf diagnostics: avoid querying `associated_item` in the resolver
Fixes #108529
2023-02-27 09:22:51 -07:00
Coca162 22b65fc275
Clarify that Copy is a trait in array docs 2023-02-27 15:16:39 +00:00
bors f540a25745 Auto merge of #108493 - cjgillot:thir-print, r=compiler-errors
Move THIR printing to rustc_mir_build.

https://github.com/rust-lang/rust/pull/107451 increased the compilation time of `rustc_middle` by 10% = 3s.

As https://github.com/rust-lang/rust/pull/107006 adds quite a lot of code to rustc_middle, I suspect it to be the cause.

This PR moves the THIR printing code to `rustc_mir_build`, where the query provider lives, in order to benefit from higher parallelism when compiling rustc.
2023-02-27 15:07:47 +00:00
Coca162 dc9732620d
Update docs to show [expr; N] can repeat const expr 2023-02-27 13:51:10 +00:00
Nilstrieb 5f593da4e6 Unify all validity check intrinsics
Also merges the inhabitedness check into the query to further unify the
code paths.
2023-02-27 13:30:44 +00:00
nx2k3 0883973d2a check double negation 2023-02-27 13:25:03 +00:00
bors 7d782b7ff4 Auto merge of #108175 - cjgillot:validate-storage, r=tmiasko
MIR-Validate StorageLive.

`StorageLive` statements on a local which already has storage is banned by miri.

This check is easy enough, and can detect bugs in MIR opts.
2023-02-27 11:41:41 +00:00
bjorn3 fdbc3c2dcf Allow building serde and serde_derive in parallel
This reduces build time of bootstrap by ~6s
2023-02-27 11:19:02 +00:00
bors 49b9cc5139 Auto merge of #108521 - matthiaskrgr:rollup-exkviev, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108319 (Don't project specializable RPITIT projection)
 - #108364 (Unify validity checks into a single query)
 - #108463 (bootstrap: Update the output of the `check` descriptions)
 - #108477 (Make `match` arm comma suggestion more clear)
 - #108486 (Merge diagnostic_items duplicate diagnostics)
 - #108494 (Clean up JS files code a bit)
 - #108500 (update Miri)
 - #108502 (Don't trigger error for ReError when other region is empty.)
 - #108513 (Remove `@nagisa` from review rotation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-27 07:00:27 +00:00
Takayuki Maeda 934c8c2299 avoid `&str` to `String` conversions 2023-02-27 14:27:13 +09:00
Michael Goulet e1485202ac Commit some new solver tests 2023-02-27 05:23:26 +00:00
Matthias Krüger ce3397503b
Rollup merge of #108513 - nagisa:unrotate, r=joshtriplett
Remove @nagisa from review rotation

I have been reviewing PRs for a long while during weekends, however recently I’ve been having trouble commiting to that as well. Every weekend I’ve been spending working on a house.

I may return myself to the rotation in a couple of months. I may also just start ninja'ing up some PRs from the PR list whenever I find some time for reviews again, without putting myself back into the rotation, in acknowledgement that me being able to review every weekend or every second weekend is not a great experience for the contributors waiting on reviews from me.
2023-02-27 06:11:55 +01:00
Matthias Krüger bade5566da
Rollup merge of #108502 - lenko-d:cannot_relate_region, r=compiler-errors
Don't trigger error for ReError when other region is empty.

Fixes [#107988](https://github.com/rust-lang/rust/issues/107988)
2023-02-27 06:11:55 +01:00
Matthias Krüger 37338b8d99
Rollup merge of #108500 - RalfJung:miri, r=RalfJung
update Miri

r? ``@ghost``
2023-02-27 06:11:54 +01:00
Matthias Krüger c813994f7a
Rollup merge of #108494 - GuillaumeGomez:cleanup-js, r=notriddle
Clean up JS files code a bit

I mostly moved values closer to where they are used to make the code reading easier.

r? ```@notriddle```
2023-02-27 06:11:54 +01:00
Matthias Krüger abc82484d4
Rollup merge of #108486 - cjgillot:owner-ditem, r=Nilstrieb
Merge diagnostic_items duplicate diagnostics

To deduplicate how we diagnose duplication.
2023-02-27 06:11:53 +01:00
Matthias Krüger 69b1b94d0c
Rollup merge of #108477 - y21:replace-semi-with-comma-sugg, r=compiler-errors
Make `match` arm comma suggestion more clear

Fixes #108472
2023-02-27 06:11:53 +01:00
Matthias Krüger 2f6ba7b4da
Rollup merge of #108463 - clubby789:update-check-output, r=albertlarsan68
bootstrap: Update the output of the `check` descriptions

This should bring the output from `x check` in line with the changes in #108171
2023-02-27 06:11:52 +01:00
Matthias Krüger 3fcc79f04a
Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compiler-errors
Unify validity checks into a single query

Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern.

I am planning on adding a further initness to check in #100423, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.

I am not entirely happy with the naming and key type and open for improvements.

r? oli-obk
2023-02-27 06:11:52 +01:00
Matthias Krüger 3a6c5429c2
Rollup merge of #108319 - compiler-errors:dont-project-to-specializable-rpitits, r=lcnr
Don't project specializable RPITIT projection

This effective rejects specialization + RPITIT/AFIT (usages of `impl Trait` in traits) because the implementation is significantly complicated over making regular "default" trait method bodies work.

I have another PR that experimentally fixes all this, but the code may not be worth investing in.
2023-02-27 06:11:51 +01:00
0xf333 56d7b9ce1b Bages for easy access links to Rust community 2023-02-26 22:20:09 -05:00
Lenko Donchev 65e56616fc Don't trigger ICE for ReError when the other region is empty. 2023-02-26 20:47:18 -06:00
Michael Goulet ff336aa6f9 Small cleanup to one_bound_for_assoc_type 2023-02-26 23:51:49 +00:00
Simonas Kazlauskas 4afb2d467e Remove @nagisa from review rotation
I have been reviewing PRs for a long while during weekends, however
recently I’ve been having trouble commiting to that as well. Every
weekend I’ve been spending working on a house.

I may return myself to the rotation in a couple of months. I may also
just start ninja'ing up some PRs from the PR list whenever I find some
time for reviews again, without putting myself back into the rotation,
in acknowledgement that me being able to review every weekend or every
second weekend is not a great experience for the contributors waiting on
reviews from me.
2023-02-27 01:21:49 +02:00
bors 58136ffa92 Auto merge of #108440 - Zoxc:encoder-enum, r=cjgillot
Emit the enum discriminant separately for the Encodable macro

This changes the `Encodable` proc macro to first emit the discriminant with a separate `match` statement, then emit the fields. LLVM can optimize down the first `match` to just a read of the enum discriminant. This avoids generating a `emit_usize` call per variant and enums with no fields now optimize down to just a single `emit_usize` call.

The no variant case is special cased to avoid warnings about unreachable code.

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.4676s</td><td align="right">0.4640s</td><td align="right"> -0.78%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1348s</td><td align="right">0.1338s</td><td align="right"> -0.75%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.3370s</td><td align="right">0.3352s</td><td align="right"> -0.54%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.6326s</td><td align="right">0.6281s</td><td align="right"> -0.71%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:unchanged</td><td align="right">1.8561s</td><td align="right">1.8589s</td><td align="right"> 0.15%</td></tr><tr><td>Total</td><td align="right">3.4282s</td><td align="right">3.4200s</td><td align="right"> -0.24%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9947s</td><td align="right"> -0.53%</td></tr></table>
2023-02-26 21:41:17 +00:00
Guillaume Gomez 27db688203 Clean up JS files code a bit 2023-02-26 20:58:36 +01:00
bors d962ea5789 Auto merge of #108474 - Jarcho:clippyup, r=Manishearth
Update Clippy

Seems like `@flip1995` so this is a couple days late.

r? `@Manishearth`
2023-02-26 18:45:47 +00:00
Ralf Jung 3f88f4ce9b update lockfile 2023-02-26 19:09:17 +01:00
bors 56ac6bfc87 Auto merge of #2803 - RalfJung:rustup, r=RalfJung
Rustup
2023-02-26 17:17:25 +00:00
Ralf Jung cb45103358 Merge from rustc 2023-02-26 18:13:57 +01:00
Ralf Jung 9fb185210e Preparing for merge from rustc 2023-02-26 18:13:46 +01:00
nx2k3 13a741afac fix some comments 2023-02-26 16:24:08 +00:00
nx2k3 46ea12a499 fix #108495, postfix decrement and prefix decrement has no warning 2023-02-26 16:17:23 +00:00
bors dfa5643705 Auto merge of #108253 - nnethercote:ena-rm-VarValue-methods, r=joshtriplett
Upgrade to ena-0.14.1.

It avoids some inlining within its `inlined_probe_value` function, which seems to result in better codegen for the very large `process_obligations` function within rustc. It might also help with reducing the bimodal perf results we see for the `keccak` and `cranelift-codegen-0.82.1` benchmarks.

r? `@ghost`
2023-02-26 15:28:24 +00:00
Camille GILLOT 380ca0c9e6 Move THIR printing to rustc_mir_build. 2023-02-26 14:31:15 +00:00
Josh Triplett 1291216ac9 Add tracking issue 2023-02-26 13:50:10 +01:00
Linus Färnstrand 68f275c4ec Adapt issue-77982.stderr to new rustc error 2023-02-26 13:50:10 +01:00
Linus Färnstrand 6cb34492a6 Move IpAddr and SocketAddr to core 2023-02-26 13:50:08 +01:00
bors c4e0cd9660 Auto merge of #108488 - matthiaskrgr:rollup-i61epcw, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #107941 (Treat `str` as containing `[u8]` for auto trait purposes)
 - #108299 (Require `literal`s for some `(u)int_impl!` parameters)
 - #108337 (hir-analysis: make a helpful note)
 - #108379 (Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants)
 - #108418 (Replace parse_[sth]_expr with parse_expr_[sth] function names)
 - #108424 (rustc_infer: Consolidate obligation elaboration de-duplication)
 - #108475 (Fix `VecDeque::shrink_to` and add tests.)
 - #108482 (statically guarantee that current error codes are documented)
 - #108484 (Remove `from` lang item)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-26 12:40:05 +00:00
Matthias Krüger 9c27fc7d34
Rollup merge of #108484 - Nilstrieb:˂DiagnosticItem˂FromFn˃ as From˂˂LangItemFromFn˃˃˃꞉꞉from, r=cjgillot
Remove `from` lang item

It was probably a leftover from the old `?` desugaring but anyways, it's unused now except for clippy, which can just use a diagnostics item.
2023-02-26 12:05:01 +01:00
Matthias Krüger edd27cf4ca
Rollup merge of #108482 - Ezrashaw:force-error-docs, r=GuillaumeGomez
statically guarantee that current error codes are documented

Closes #61137 (that's right!)

Pretty simple refactor (often just a change from `Result<Option<&str>>` to `Result<&str>`)

r? `@GuillaumeGomez` (could you specially look at 53044158eff0d64673a6100f701c57b484232aca? I believe you wrote that in the first place, just want to make sure you're happy with the change)
2023-02-26 12:05:00 +01:00
Matthias Krüger be23b326dc
Rollup merge of #108475 - Sp00ph:fix_shrink_to, r=thomcc
Fix `VecDeque::shrink_to` and add tests.

Fixes #108453.

Also adds both a specific test with the code from #108453 and an exhaustive test that checks all possible head positions, lengths and target capacities for deques with capacity 16.

cc `@trinity-1686a` `@scottmcm`
2023-02-26 12:05:00 +01:00
Matthias Krüger c815e03447
Rollup merge of #108424 - megakorre:elaborator_refactor, r=compiler-errors
rustc_infer: Consolidate obligation elaboration de-duplication

# Explanation

The obligations `Elaborator` is doing de-duplication of obligations in 3 different locations. 1 off which has a comment.
This PR consolidates the functionality and comment to a single function.
2023-02-26 12:04:59 +01:00
Matthias Krüger 786a75a65f
Rollup merge of #108418 - est31:parser_function_names, r=Nilstrieb
Replace parse_[sth]_expr with parse_expr_[sth] function names

This resolves an inconsistency in naming style for functions on the parser, where:

* functions parsing specific kinds of items are named `parse_item_[sth]` and
* functions parsing specific kinds of *expressions* are named `parse_[sth]_expr`

favoring the style used by functions for items. There are multiple advantages of that style:

* functions of both categories are collected in the same place in the [rustdoc output](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html).
* it helps with autocompletion, as you can narrow down your search for a function to those about expressions.
* it mirrors rust's path syntax where less specific things come first, then it gets more specific, i.e. `std::collections::hash_map::Entry`.

The disadvantage is that it doesn't "read like a sentence" any more. But I think the advantages weigh more greatly.

This change was mostly application of this command:

```
sed -i -E 's/(fn |\.)parse_([[:alnum:]_]+)_expr/\1parse_expr_\2/' compiler/rustc_parse/src/parser/*.rs
```

Plus very minor fixes outside of `rustc_parse`, and an invocation of `x fmt`.
2023-02-26 12:04:59 +01:00
Matthias Krüger 19b8685b06
Rollup merge of #108379 - compiler-errors:hir-error-guaranteed, r=cjgillot
Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants

First step in making the `Err` variants of `ExprKind` and `TyKind` require an `ErrorGuaranteed` during parsing. Making the corresponding AST versions require `ErrorGuaranteed` is a bit harder, whereas it was pretty easy to do this for HIR, so let's do that first.

The only weird thing about this PR is that `ErrorGuaranteed` is moved to `rustc_span`. This is *certainly* not the right place to put it, but `rustc_hir` cannot depend on `rustc_error` because the latter already depends on the former. Should I just pull out some of the error machinery from `rustc_error` into an even more minimal crate that `rustc_hir` can depend on? Advice would be appreciated.
2023-02-26 12:04:58 +01:00
Matthias Krüger b27f37da07
Rollup merge of #108337 - tshepang:translatable-hir-analysis, r=cjgillot
hir-analysis: make a helpful note
2023-02-26 12:04:58 +01:00
Matthias Krüger 3d2319f1d6
Rollup merge of #108299 - scottmcm:literal-bits, r=Nilstrieb
Require `literal`s for some `(u)int_impl!` parameters

The point of these is to be seen *lexically* in the docs, so they should always be passed as the correct literal, not as an expression.

(Otherwise we could just compute `Min`/`Max` from `BITS`, for example.)

r? Nilstrieb
2023-02-26 12:04:57 +01:00
Matthias Krüger 2bc553c6ea
Rollup merge of #107941 - compiler-errors:str-has-u8-slice-for-auto, r=lcnr
Treat `str` as containing `[u8]` for auto trait purposes

Wanted to gauge ``@rust-lang/lang`` and ``@rust-lang/types`` teams' thoughts on treating `str` as "containing" a `[u8]` slice for auto-trait purposes.

``@dtolnay`` brought this up in https://github.com/rust-lang/rust/issues/13231#issuecomment-1399386472 as a blocker for future `str` type librarification, and I think it's both a valid concern and very easy to fix. I'm interested in actually doing that `str` type librarification (#107939), but this probably should be considered in the mean time regardless of that PR.

r? types for the impl, though this definitely needs an FCP.
2023-02-26 12:04:57 +01:00
y21 32da026c35 generalize help message 2023-02-26 11:58:49 +01:00
Camille GILLOT cb51d2da7a Avoid more calls to typeck. 2023-02-26 10:30:27 +00:00