Commit Graph

220002 Commits

Author SHA1 Message Date
Michael Goulet
79ad7cca45 Erase escaping late-bound regions when probing for ambiguous associated types 2023-03-17 15:33:24 +00:00
bors
c50c62d225 Auto merge of #109241 - saethlin:miri, r=oli-obk
update Miri

r? `@oli-obk`
2023-03-17 12:01:17 +00:00
bors
2d64f229a0 Auto merge of #109085 - tmiasko:index-based, r=WaffleLapkin
Use index based drop loop for slices and arrays

Instead of building two kinds of drop pair loops, of which only one will be eventually used at runtime in a given monomorphization, always use index based loop.
2023-03-17 08:17:21 +00:00
bors
3831a25490 Auto merge of #2817 - saethlin:rustup, r=saethlin
rustup

Doing a sync just before I do a rustc-push
2023-03-16 23:05:57 +00:00
Ben Kimock
ba1c09429e Merge from rustc 2023-03-16 19:03:22 -04:00
Ben Kimock
689f24e904 Preparing for merge from rustc 2023-03-16 19:03:17 -04:00
bors
511364e787 Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk
Wrap the whole LocalInfo in ClearCrossCrate.

MIR contains a lot of information about locals. The primary purpose of this information is the quality of borrowck diagnostics.

This PR aims to drop this information after MIR analyses are finished, ie. starting from post-cleanup runtime MIR.
2023-03-16 19:59:56 +00:00
bors
e386217dd9 Auto merge of #107270 - cjgillot:remove-zst, r=oli-obk
Replace ZST operands and debuginfo by constants.

This is work that ConstProp will not have to do.
Split from https://github.com/rust-lang/rust/pull/107267
2023-03-16 16:40:53 +00:00
bors
b024de1673 Auto merge of #2785 - Vanille-N:tree-borrows-merge, r=RalfJung
Tree borrows

This PR implements the experimental Tree Borrows (TB) rules for tracking reference aliasing, as an optional alternative to Stacked Borrows (SB).

SB and TB are mutually exclusive. Using `-Zmiri-tree-borrows` replaces every invocation of SB with the equivalent TB procedure.

A detailed explanation of the TB rules is currently under review, you can find the latest version [here [work in progress]](https://github.com/Vanille-N/tree-borrows/blob/master/model/treebor.pdf).

This PR does NOT yet include
- enough `fail` tests for TB (although TB is less reliant than SB on `fail` tests to check that the implementation matches the design due to `pass` tests being more strict)
- good diagnostics for TB violations
2023-03-16 14:55:28 +00:00
Neven Villani
782b869224 TB: select tests to run both TB and SB 2023-03-16 14:56:18 +01:00
Neven Villani
e243206ae3 TB: new tests 2023-03-16 14:56:18 +01:00
Neven Villani
8741303f6e TB: document TB changes in README 2023-03-16 14:56:16 +01:00
Neven Villani
8bbb0404f8 TB: integration 2023-03-16 14:54:00 +01:00
Neven Villani
0afab595b4 TB: Reborrow policy and connection to the main machine 2023-03-16 14:52:46 +01:00
Neven Villani
7d4e8b9bc0 TB: error and tree formatting 2023-03-16 14:52:46 +01:00
Neven Villani
eb3ff3ccb0 TB: tree traversal 2023-03-16 14:52:46 +01:00
Neven Villani
cd954dbf14 TB: public interface to permissions 2023-03-16 14:52:46 +01:00
Neven Villani
362863787b TB: Tree structure 2023-03-16 14:52:46 +01:00
Neven Villani
8c7104fb6c TB: Util: an efficient mapping for permissions 2023-03-16 14:52:46 +01:00
Neven Villani
8fcfd9e11d TB: encoding of the underlying state machine
+ properties about the transitions
2023-03-16 14:52:46 +01:00
bors
1203e0866e Auto merge of #106824 - m-ou-se:format-args-flatten, r=oli-obk
Flatten/inline format_args!() and (string and int) literal arguments into format_args!()

Implements https://github.com/rust-lang/rust/issues/78356

Gated behind `-Zflatten-format-args=yes`.

Part of #99012

This change inlines string literals, integer literals and nested format_args!() into format_args!() during ast lowering, making all of the following pairs result in equivalent hir:

```rust
println!("Hello, {}!", "World");
println!("Hello, World!");
```

```rust
println!("[info] {}", format_args!("error"));
println!("[info] error");
```

```rust
println!("[{}] {}", status, format_args!("error: {}", msg));
println!("[{}] error: {}", status, msg);
```

```rust
println!("{} + {} = {}", 1, 2, 1 + 2);
println!("1 + 2 = {}", 1 + 2);
```

And so on.

This is useful for macros. E.g. a `log::info!()` macro could just pass the tokens from the user directly into a `format_args!()` that gets efficiently flattened/inlined into a `format_args!("info: {}")`.

It also means that `dbg!(x)` will have its file, line, and expression name inlined:

```rust
eprintln!("[{}:{}] {} = {:#?}", file!(), line!(), stringify!(x), x); // before
eprintln!("[example.rs:1] x = {:#?}", x); // after
```

Which can be nice in some cases, but also means a lot more unique static strings than before if dbg!() is used a lot.
2023-03-16 13:46:52 +00:00
Mara Bos
a080165148 Bless -Zhelp output test. 2023-03-16 12:26:20 +01:00
Mara Bos
4d840223b0 Add test for -Zflatten-format-args=yes. 2023-03-16 12:16:27 +01:00
Mara Bos
653124ac44 Fix clippy. 2023-03-16 12:08:07 +01:00
bors
7ac4b82ddd Auto merge of #109206 - matthiaskrgr:rollup-oev8ax6, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #108875 (rustdoc: fix type search for `Option` combinators)
 - #108971 (error-msg: impl better suggestion for `E0532`)
 - #109139 (rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets)
 - #109151 (Assert def-kind is correct for alias types)
 - #109158 (error-msg: expand suggestion for `unused_def` lint)
 - #109166 (make `define_opaque_types` fully explicit)
 - #109171 (Some cleanups in our normalization logic)
 - #109180 (Unequal → Not equal)
 - #109185 (rustdoc: remove `std::` from primitive intra-doc link tooltips)
 - #109192 (Mention UEFI target promotion in release notes for 1.67.0)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-16 11:06:02 +00:00
Mara Bos
995e57b89e Gate fmt args flattening behind -Zflatten-format-args. 2023-03-16 11:21:50 +01:00
Mara Bos
1d59081bfd Bless pretty tests. 2023-03-16 11:21:50 +01:00
Mara Bos
f2f6bcc499 Don't allow new const panic through format flattening.
panic!("a {}", "b") is still not allowed in const,
even if the hir flattens to panic!("a b").
2023-03-16 11:21:50 +01:00
Mara Bos
96d252160e Update format_args!() test to account for inlining. 2023-03-16 11:21:50 +01:00
Mara Bos
6a535dfff4 Also inline integer literals into format_args!(). 2023-03-16 11:21:50 +01:00
Mara Bos
df8c14ca61 Check all arg indexes before removing inlined format args. 2023-03-16 11:21:50 +01:00
Mara Bos
0554401fcc Remove unreachable branch in format_args ast lowering. 2023-03-16 11:21:48 +01:00
Mara Bos
b6c988b041 Fix argument index remapping in format_args flattening. 2023-03-16 11:19:31 +01:00
Mara Bos
b7678d48b8 Only inline {} string literals in format_args.
Placeholders like {:123} would incorrectly get inlined.
2023-03-16 11:19:31 +01:00
Mara Bos
caa6ba9e86 Support flattening/inlining format_args through & and ().
E.g. format_args!("{}", &(format_args!("abc"))).
2023-03-16 11:19:31 +01:00
Mara Bos
85ef2f0cfe Inline string literals into format_args!(). 2023-03-16 11:19:31 +01:00
Mara Bos
94ad7e881d Coalesce adjacent literal pieces in expand_format_args. 2023-03-16 11:19:31 +01:00
Mara Bos
a769b30a93 Flatten nested format_args!() into one. 2023-03-16 11:19:30 +01:00
Matthias Krüger
a70e138ed8
Rollup merge of #109192 - lukas-code:uefi-relnotes, r=joshtriplett
Mention UEFI target promotion in release notes for 1.67.0

The promotion happened in https://github.com/rust-lang/rust/pull/103933/, but it was forgotten in the release notes for 1.67.0.

See also discussion in https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/UEFI.20targets.20relnotes
2023-03-16 08:57:10 +01:00
Matthias Krüger
570636a586
Rollup merge of #109185 - notriddle:notriddle/primitive-tooltip, r=jsha
rustdoc: remove `std::` from primitive intra-doc link tooltips

Take the intra-doc link to the method `iter` from https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html

Before: `method std::slice::iter`

After: `method slice::iter`
2023-03-16 08:57:09 +01:00
Matthias Krüger
76962482e6
Rollup merge of #109180 - gimbles:master, r=compiler-errors
Unequal → Not equal

Fixes #109168
2023-03-16 08:57:09 +01:00
Matthias Krüger
113e815b36
Rollup merge of #109171 - oli-obk:normalization_cleanup, r=compiler-errors
Some cleanups in our normalization logic

Changed a match to be exhaustive and deduplicated some code.

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

this pulls out the uncontroversial part of https://github.com/rust-lang/rust/pull/108860
2023-03-16 08:57:08 +01:00
Matthias Krüger
f0205d55ce
Rollup merge of #109166 - lcnr:define_opaque_types-explicit, r=oli-obk
make `define_opaque_types` fully explicit

based on the idea of #108389. Moved `define_opaque_types` into the actual operations, e.g. `eq`, instead of `infcx.at` because normalization doesn't use `define_opaque_types` and even creates it's own `At` with a different `define_opaque_types` internally.

Somewhat surprisingly, coherence actually relies on `DefineOpaqueTypes::Yes` for soundness which was revealed because I've incorrectly used `DefineOpaqueTypes::No` in `equate_impl_headers`. It feels concerning that even though this is the case, we still sometimes use `DefineOpaqueTypes::No` in coherence. I did not look into this as part of this PR as it is purely changing the structure of the code without changing behavior in any way.

r? ```@oli-obk```
2023-03-16 08:57:07 +01:00
Matthias Krüger
36b82373e0
Rollup merge of #109158 - Ezrashaw:expand-sugg-for-unused-lint, r=Nilstrieb
error-msg: expand suggestion for `unused_def` lint

Fixes #108885

Expands `let _ = ..` suggestion into more positions.
2023-03-16 08:57:07 +01:00
Matthias Krüger
9d5d447421
Rollup merge of #109151 - compiler-errors:debug-assert-alias, r=WaffleLapkin
Assert def-kind is correct for alias types

Make sure we're not constructing alias types for the wrong def-kind, at least for debug cases 😅
2023-03-16 08:57:06 +01:00
Matthias Krüger
6cf2f470b0
Rollup merge of #109139 - GuillaumeGomez:rustdoc-windows-wait-for-write, r=notriddle
rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets

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

Switching to `threadpool` makes it a bit simpler for us to wait for all tasks in `DocFS` directly in the `Drop` implementation. I'm also curious if making all the writes into a thread pool could improve run time for rustdoc on all other platforms than Windows as well.

I'll run a perf check to see.

cc ```@ehuss```
r? ```@notriddle```
2023-03-16 08:57:06 +01:00
Matthias Krüger
1385a32b62
Rollup merge of #108971 - Ezrashaw:E0532-better-binding-names, r=WaffleLapkin
error-msg: impl better suggestion for `E0532`

Fixes #106862

No test as there is already a test which is nearly identical to the example in the linked issue.
2023-03-16 08:57:05 +01:00
Matthias Krüger
aa881f16ec
Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomez
rustdoc: fix type search for `Option` combinators
2023-03-16 08:57:05 +01:00
bors
cd6c574af3 Auto merge of #108809 - lqd:fix-ignore, r=pietroalbini
fix ignore header in MSVC test

From `@pietroalbini's` [zulip message](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/better.20compiletest.20ignore.20messages/near/339845864)

> there are tests like `tests/ui/panic-runtime/unwind-tables-target-required.rs` which have `only-x86_64-windows-msvc` which I'm pretty sure is invalid

This test is currently ignored on x64 MSVC CI because of this incorrect target. We'll see if it still passes.

r? `@pietroalbini`
2023-03-16 07:35:20 +00:00
bors
18e305dfca Auto merge of #109183 - lqd:revert-107376, r=compiler-errors
Revert #107376 to fix potential `bincode` breakage and `rustc-perf` benchmark.

#107376 caused `rustc-perf`'s `webrender` benchmark to break, by regressing on the `bincode-1.3.3` crate.

~~This PR is a draft revert in case we can't land a fix soon enough, and we'd like to land the revert instead~~

(Though I myself think it'd be safer to do the revert, and run crater when relanding #107376.)

cc `@aliemjay`
2023-03-16 02:56:24 +00:00