Commit Graph

21612 Commits

Author SHA1 Message Date
bors
50d3ba5bcb Auto merge of #107672 - matthiaskrgr:rollup-7e6dbuk, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #107116 (consolidate bootstrap docs)
 - #107646 (Provide structured suggestion for binding needing type on E0594)
 - #107661 (Remove Esteban from review queues for a while)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-04 21:07:10 +00:00
Matthias Krüger
d381eca5dc
Rollup merge of #107646 - estebank:specific-span, r=compiler-errors
Provide structured suggestion for binding needing type on E0594

Partially address #45405.
2023-02-04 20:29:06 +01:00
bors
3de7d7fb22 Auto merge of #107549 - Zoxc:rustc-shared, r=jyn514
Move code in `rustc_driver` out to a new `rustc_driver_impl` crate to allow pipelining

That adds a `rustc_shared` library which contains all the rustc library crates in a single dylib. It takes over this role from `rustc_driver`. This is done so that `rustc_driver` can be compiled in parallel with other crates. `rustc_shared` is intentionally left empty so it only does linking.

An alternative could be to move the code currently in `rustc_driver` into a new crate to avoid changing the name of the distributed library.
2023-02-04 18:11:02 +00:00
bors
9dee4e4c42 Auto merge of #107267 - cjgillot:keep-aggregate, r=oli-obk
Do not deaggregate MIR

This turns out to simplify a lot of things.
I haven't checked the consequences for miri yet.

cc `@JakobDegen`
r? `@oli-obk`
2023-02-04 15:17:32 +00:00
bors
91eb6f9acf Auto merge of #107591 - krasimirgg:llvm-17-pgoopts, r=cuviper
llvm-wrapper: adapt for LLVM API changes

Adapts the wrapper for 516e301752, where the constructor of PGOOptions gained a new FileSystem argument. Adapted to use the real file system, similarly to the changes inside of LLVM:
516e301752 (diff-f409934ba27ad86494f3012324e9a3995b56e0743609ded7a387ba62bbf5edb0R236)

Found via our experimental Rust + LLVM at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/16853#01860e2e-5eba-4f07-8359-0325913ff410/219-517
2023-02-04 03:41:57 +00:00
Esteban Küber
e6c56cda09 review comments 2023-02-03 23:41:39 +00:00
Michael Goulet
72599c69b5
Rollup merge of #107621 - compiler-errors:intern-external-constraints, r=lcnr
Intern external constraints in new solver

Makes the query response `Copy`, fixing a few FIXMEs.
2023-02-03 14:15:23 -08:00
Michael Goulet
1594b58ce7
Rollup merge of #107595 - michaelwoerister:retry_proc_macro_loading, r=petrochenkov
Retry opening proc-macro DLLs a few times on Windows.

On Windows, the compiler [sometimes](https://users.rust-lang.org/t/error-loadlibraryexw-failed/77603) fails with the message `error: LoadLibraryExW failed` when trying to load a proc-macro crate. The error seems to occur intermittently, similar to https://github.com/rust-lang/rust/issues/86929, however, it seems to be almost impossible to reproduce outside of CI environments and thus very hard to debug. The fact that the error only occurs intermittently makes me think that this is a timing related issue.

This PR is an attempt to mitigate the issue by letting the compiler retry a few times when encountering this specific error (which resolved the issue described in https://github.com/rust-lang/rust/issues/86929).
2023-02-03 14:15:22 -08:00
Michael Goulet
e99e05d135
Rollup merge of #107551 - fee1-dead-contrib:rm_const_fnmut_helper, r=oli-obk
Replace `ConstFnMutClosure` with const closures

Also fixes a parser bug. cc `@oli-obk` for compiler changes
2023-02-03 14:15:22 -08:00
Michael Goulet
0b5941aa11 Make const/fn return params more suggestable 2023-02-03 21:37:41 +00:00
Michael Goulet
41883fd19a intern external constraints 2023-02-03 21:36:59 +00:00
Esteban Küber
da1360d981 Provide structured suggestion for binding needing type on E0594
Partially address #45405.
2023-02-03 18:53:27 +00:00
bors
658fad6c55 Auto merge of #107642 - Dylan-DPC:rollup-edcqhm5, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #107082 (Autotrait bounds on dyn-safe trait methods)
 - #107427 (Add candidates for DiscriminantKind builtin)
 - #107539 (Emit warnings on unused parens in index expressions)
 - #107544 (Improve `TokenCursor`.)
 - #107585 (Don't cause a cycle when formatting query description that references a FnDef)
 - #107633 (Fix suggestion for coercing Option<&String> to Option<&str>)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-03 17:53:49 +00:00
Dylan DPC
c9270272df
Rollup merge of #107633 - clubby789:option-string-coerce-fix, r=Nilstrieb
Fix suggestion for coercing Option<&String> to Option<&str>

Fixes #107604

This also makes the diagnostic `MachineApplicable`, and runs `rustfix` to check we're not producing incorrect code.

``@rustbot`` label +A-diagnostics
2023-02-03 23:04:52 +05:30
Dylan DPC
d6f0c51e98
Rollup merge of #107585 - compiler-errors:fndef-sig-cycle, r=oli-obk
Don't cause a cycle when formatting query description that references a FnDef

When a function returns `-> _`, we use typeck to compute what the resulting type of the body _should_ be. If we call another query inside of typeck and hit a cycle error, we attempt to report the cycle error which requires us to compute all of the query descriptions for the stack.

However, if one of the queries in that cycle has a query description that references this function as a FnDef type, we'll cause a *second* cycle error from within the cycle error reporting code, since rendering a FnDef requires us to compute its signature. This causes an unwrap to ICE, since during the *second* cycle reporting code, we try to look for a job that isn't in the active jobs list.

We can avoid this by using `with_no_queries!` when computing these query descriptions.

Fixes #107089

The only drawback is that the rendering of opaque types in cycles regresses a bit :| I'm open to alternate suggestions about how we may handle this...
2023-02-03 23:04:52 +05:30
Dylan DPC
815dc9c480
Rollup merge of #107544 - nnethercote:improve-TokenCursor, r=petrochenkov
Improve `TokenCursor`.

Some small improvements, for things that were bugging me.

Best reviewed one commit at a time.

r? ``@petrochenkov``
2023-02-03 23:04:51 +05:30
Dylan DPC
d9db35785d
Rollup merge of #107539 - PossiblyAShrub:unused-parens-in-index, r=lcnr
Emit warnings on unused parens in index expressions

Fixes: #96606.

I am not sure what the best term for "index expression" is. Is there a better term we could use?
2023-02-03 23:04:51 +05:30
Dylan DPC
e1bf3a1386
Rollup merge of #107427 - detrumi:builtin-impl-candidates, r=compiler-errors
Add candidates for DiscriminantKind builtin

Part of #107379
2023-02-03 23:04:50 +05:30
David Tolnay
4501d3abe1
Autotrait bounds on dyn-safe trait methods 2023-02-03 08:33:40 -08:00
David Tolnay
9e1c600f74
Disallow impl autotrait for trait object 2023-02-03 08:33:40 -08:00
bors
9545094994 Auto merge of #107599 - clubby789:debug-less-ref, r=nnethercote
Don't generate unecessary `&&self.field` in deriving Debug

Since unsized fields may only be the last one in a struct, we only need to generate a double reference (`&&self.field`) for the  final one.

cc `@nnethercote`
2023-02-03 14:22:42 +00:00
clubby789
f874f6768c Fix suggestion for coercing Option<&String> to Option<&str> 2023-02-03 11:44:23 +00:00
bors
a94b9fd0ac Auto merge of #107569 - petrochenkov:optattr, r=nnethercote
ast: Optimize list and value extraction primitives for attributes

It's not necessary to convert the whole attribute into a meta item to extract something specific.
2023-02-03 11:19:03 +00:00
Wilco Kusee
f29000eba9 Use new helper inside probe 2023-02-03 10:04:15 +01:00
Matthias Krüger
743ca67edf
Rollup merge of #107602 - estebank:anon-enum-access, r=compiler-errors
Parse and recover from type ascription in patterns

Reintroduce part of #106960, which was reverted in #107478.

r? `@compiler-errors`
2023-02-03 06:30:24 +01:00
Matthias Krüger
2fdb3559c4
Rollup merge of #106805 - madsravn:master, r=compiler-errors
Suggest `{var:?}` when finding `{?:var}` in inline format strings

Link to issue: https://github.com/rust-lang/rust/issues/106572

This is my first PR to this project, so hopefully I can get some good pointers with me from the first PR.

Currently my idea was to test out whether or not this is the correct solution to this issue and then hopefully expand upon the idea to not only work for Debug formatting but for all of  them. If this is a valid solution, I will create a new issue to give a better error message to a broader range of wrong-order formatting.
2023-02-03 06:30:23 +01:00
Matthias Krüger
6b94f4dccc
Rollup merge of #106575 - estebank:issue-64008, r=pnkfelix
Suggest `move` in nested closure when appropriate

Fix #64008.
2023-02-03 06:30:22 +01:00
Camille GILLOT
473d0c5510 Introduce write_aggregate. 2023-02-02 23:26:34 +00:00
Camille GILLOT
134d819072 Stop deaggegating MIR. 2023-02-02 23:20:29 +00:00
Camille GILLOT
6a0b218161 Stop deaggregating enums in MIR. 2023-02-02 23:20:27 +00:00
Camille GILLOT
b62a9da0c8 Handle aggregates in DataflowConstProp. 2023-02-02 23:09:51 +00:00
Camille GILLOT
20dd5e09fd Codegen SetDiscriminant after field assignment.
This matches the order in which deaggregation was performed.
2023-02-02 23:09:51 +00:00
Camille GILLOT
feccf469fb Interpret aggregates. 2023-02-02 23:09:51 +00:00
Camille GILLOT
0241c29123 Put a DefId in AggregateKind. 2023-02-02 23:09:51 +00:00
Nicholas Nethercote
a86fc727fa Rename Cursor/CursorRef as TokenTreeCursor/RefTokenTreeCursor.
This makes it clear they return token trees, and makes for a nice
comparison against `TokenCursor` which returns tokens.
2023-02-03 10:06:52 +11:00
Nicholas Nethercote
b5ecbbb998 Remove TokenCursorFrame.
The motivation here is to eliminate the `Option<(Delimiter,
DelimSpan)>`, which is `None` for the outermost token stream and `Some`
for all other token streams.

We are already treating the innermost frame specially -- this is the
`frame` vs `stack` distinction in `TokenCursor`. We can push that
further so that `frame` only contains the cursor, and `stack` elements
contain the delimiters for their children. When we are in the outermost
token stream `stack` is empty, so there are no stored delimiters, which
is what we want because the outermost token stream *has* no delimiters.

This change also shrinks `TokenCursor`, which shrinks `Parser` and
`LazyAttrTokenStreamImpl`, which is nice.
2023-02-03 10:06:52 +11:00
Nicholas Nethercote
b23f272db0 Make clear that TokenTree::Token shouldn't contain a delimiter. 2023-02-03 10:06:52 +11:00
Nicholas Nethercote
af1d16e82d Improve doc comment desugaring.
Sometimes the parser needs to desugar a doc comment into `#[doc =
r"foo"]`. Currently it does this in a hacky way: by pushing a "fake" new
frame (one without a delimiter) onto the `TokenCursor` stack.

This commit changes things so that the token stream itself is modified
in place. The nice thing about this is that it means
`TokenCursorFrame::delim_sp` is now only `None` for the outermost frame.
2023-02-03 10:06:52 +11:00
Michael Goulet
745d60c239
Tweak misleading comment 2023-02-02 15:02:21 -08:00
clubby789
d8651aae22 Don't generate unecessary &&self.field in deriving Debug 2023-02-02 22:06:23 +00:00
Aidan Olsen
c3a71ede7c Emit warnings on unused parens/braces in index expressions 2023-02-02 12:46:31 -07:00
Esteban Küber
0ba687a95e Parse and recover from type ascription in patterns 2023-02-02 17:18:48 +00:00
Esteban Küber
e6b84eb797 Suggest move in nested closure when appropriate
Fix #64008.
2023-02-02 16:26:01 +00:00
Matthias Krüger
3d92100955
Rollup merge of #107559 - WaffleLapkin:is_it_2015¿, r=davidtwco
Rename `rust_2015` → `is_rust_2015`

r? ```@compiler-errors```
https://github.com/rust-lang/rust/pull/107508#discussion_r1092300088
2023-02-02 17:14:08 +01:00
Matthias Krüger
3e0995a440
Rollup merge of #107532 - compiler-errors:erase-regions-in-uninhabited, r=jackh726
Erase regions before doing uninhabited check in borrowck

~Also, fingerprint query keys/values when debug assertions are enabled. This should make it easier to check for issues like this without `-Cincremental`, and make UI tests a bit cleaner.~ edit: moving that to a separate PR

Fixes #107505
2023-02-02 17:14:07 +01:00
Matthias Krüger
6917040cf0
Rollup merge of #107524 - cjgillot:both-storage, r=RalfJung
Remove both StorageLive and StorageDead in CopyProp.

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

https://github.com/rust-lang/rust/pull/106908 removed StorageDead without the accompanying StorageLive. In loops, execution would see repeated StorageLive, without any StorageDead, which is UB.

So when removing storage statements, we have to remove both StorageLive and StorageDead.

~I also added a MIR validation pass for StorageLive. It may be a bit overzealous.~
2023-02-02 17:14:06 +01:00
Matthias Krüger
230c9e91fd
Rollup merge of #107515 - Swatinem:hirvalidator, r=compiler-errors
Improve pretty-printing of `HirIdValidator` errors

This now uses `node_to_string` for both missing and seen Ids, which includes the snippet of code for which the Id was allocated. Also removes the duplicated printing of `HirId`, as `node_to_string` also includes that.
2023-02-02 17:14:06 +01:00
Matthias Krüger
e9c4e291c4
Rollup merge of #107493 - clubby789:range-fat-arrow-followup, r=estebank
Improve diagnostic for missing space in range pattern

Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue.

r? `@compiler-errors`
2023-02-02 17:14:05 +01:00
Matthias Krüger
8f47954742
Rollup merge of #106919 - compiler-errors:underscore-typo-in-field-pat, r=jackh726
Recover `_` as `..` in field pattern
2023-02-02 17:14:05 +01:00
Michael Woerister
227b2858da Retry opening proc-macro DLLs a few times on Windows. 2023-02-02 16:18:16 +01:00