Commit Graph

218388 Commits

Author SHA1 Message Date
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
Lenko Donchev
65e56616fc Don't trigger ICE for ReError when the other region is empty. 2023-02-26 20:47:18 -06: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
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
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
752ddd028c Merge the two diagnostics. 2023-02-26 10:29:25 +00:00
Camille GILLOT
11fbb57395 Simplify diagnostic_items. 2023-02-26 10:06:03 +00:00
bors
43ee4d15bf Auto merge of #108375 - Zoxc:query-inline, r=cjgillot
Add inlining attributes for query system functions

These only have a single caller, but don't always get inlined.
2023-02-26 09:44:54 +00:00
Nilstrieb
312020ef6a Remove from_fn 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 09:15:54 +00:00
Ezra Shaw
53044158ef
refactor: improve error-index-generator dependency 2023-02-26 20:13:06 +13:00
Ezra Shaw
90677edcba
refactor: statically guarantee that current error codes are documented 2023-02-26 20:12:36 +13:00
Markus Everling
4a4f43e4e9 Disambiguate comments 2023-02-26 03:13:56 +01:00
Markus Everling
9e22516877 Fix VecDeque::shrink_to and add tests.
This adds both a test specific to #108453 as well as an exhaustive test
that goes through all possible combinations of head index, length and target capacity
for a deque with capacity 16.
2023-02-26 03:13:44 +01:00
bors
70fd012439 Auto merge of #108473 - matthiaskrgr:rollup-qjyae58, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107062 (Do some cleanup of doc/index.md)
 - #107890 (Lint against `Iterator::map` receiving a callable that returns `()`)
 - #108431 (Add regression test for #107918)
 - #108432 (test: drop unused deps)
 - #108436 (make "proc macro panicked" translatable)
 - #108444 (docs/test: add UI test and docs for `E0476`)
 - #108449 (Do not lint ineffective unstable trait impl for unresolved trait)
 - #108456 (Complete migrating `ast_passes` to derive diagnostics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-26 02:04:23 +00:00
Jason Newcomb
4a2de63ae3 Merge commit '149392b0baa4730c68f3c3eadf5c6ed7b16b85a4' into clippyup 2023-02-25 19:28:50 -05:00
Matthias Krüger
767c865f07
Rollup merge of #108456 - clubby789:ast-passes-diag-migrate, r=compiler-errors
Complete migrating `ast_passes` to derive diagnostics

cc #100717

```@rustbot``` label +A-translation
2023-02-26 00:46:28 +01:00
Matthias Krüger
a223ff7cea
Rollup merge of #108449 - fee1-dead-contrib:do_not_lint_unresolved, r=compiler-errors
Do not lint ineffective unstable trait impl for unresolved trait
2023-02-26 00:46:28 +01:00
Matthias Krüger
65eecc6b59
Rollup merge of #108444 - Ezrashaw:add-test+docs-for-e0476, r=GuillaumeGomez
docs/test: add UI test and docs for `E0476`

Final undocumented error code. Not entirely sure about wording in the docs.

Part of https://github.com/rust-lang/rust/issues/61137.

r? ```@compiler-errors```

cc ```@compiler-errors```
2023-02-26 00:46:28 +01:00
Matthias Krüger
9631f4b5c9
Rollup merge of #108436 - tshepang:translatable-proc-macro-panicked, r=estebank
make "proc macro panicked" translatable
2023-02-26 00:46:27 +01:00
Matthias Krüger
4ab1c74b77
Rollup merge of #108432 - klensy:test-deps, r=Mark-Simulacrum
test: drop unused deps

Looks unused. Anyway, tests should catch any breakage.
2023-02-26 00:46:26 +01:00
Matthias Krüger
5196e9114c
Rollup merge of #108431 - GuillaumeGomez:regression-test-for-107918, r=notriddle
Add regression test for #107918

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

r? ```@notriddle```
2023-02-26 00:46:26 +01:00
Matthias Krüger
fa10a21bd2
Rollup merge of #107890 - obeis:mapping-to-unit, r=cjgillot
Lint against `Iterator::map` receiving a callable that returns `()`

Close #106991
2023-02-26 00:46:25 +01:00
Matthias Krüger
f840799385
Rollup merge of #107062 - tgross35:update-doc-index, r=ehuss
Do some cleanup of doc/index.md

I think a lot of people get to this landing page from `rustup doc`, and it's a bit tricky to find some useful information. I attempted to clean it up here a bit, from the commit message:

- Add quick link to API docs
- Add marker for external links, to help offline users
- Add information about using 'cargo doc' and the playground
- Clean up some of the wording
- Update body & header style to match rustdoc defaults
- Bump heading levels so main page header is 1, others are 2 (all were level 1 before)
2023-02-26 00:46:25 +01:00
bors
149392b0ba Auto merge of #10402 - Jarcho:rustup, r=Jarcho
Rustup

Looks like `@flip1995`  is busy.

r? `@ghost`

changelog: None
2023-02-25 23:34:06 +00:00
bors
f37f9f6512 Auto merge of #108464 - compiler-errors:rollup-trl1g70, r=compiler-errors
Rollup of 7 pull requests

Successful merges:

 - #105736 (Test that the compiler/library builds with validate-mir)
 - #107291 ([breaking change] Remove a rustdoc back compat warning)
 - #107675 (Implement -Zlink-directives=yes/no)
 - #107848 (Split `x setup` sub-actions to CLI arguments)
 - #107911 (Add check for invalid #[macro_export] arguments)
 - #108229 ([107049] Recognise top level keys in config.toml.example)
 - #108333 (Make object bound candidates sound in the new trait solver)

Failed merges:

 - #108337 (hir-analysis: make a helpful note)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-25 23:15:10 +00:00
Jason Newcomb
69c4ff6df8 Emit unnecessary_def_path in source order. 2023-02-25 18:09:24 -05:00
Jason Newcomb
e825adf637 Fix normalization of custom_ice_message test. 2023-02-25 18:08:51 -05:00