Commit Graph

220274 Commits

Author SHA1 Message Date
Mu42
550e3087d1 Suggest surrounding the macro with {} to interpret as a statement 2023-03-17 14:36:22 +08:00
NagaChaitanya Vellanki
0aad0b32ae run rustfmt on changes 2023-03-16 17:07:41 -07:00
yukang
c22f154e3f Do not ICE for native_lib without name 2023-03-17 07:59:08 +08:00
NagaChaitanya Vellanki
2dbda0af15 fallback to lstat when stat fails on Windows 2023-03-16 16:57:55 -07:00
yukang
827a990255 Do not ICE for unexpected lifetime with ConstGeneric rib 2023-03-17 07:36:18 +08: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
Tomasz Miąsko
27b430bcb3 Tweak implementation of overflow checking assertions
Extract and reuse logic controlling behaviour of overflow checking
assertions instead of duplicating it three times.
2023-03-16 22:55:45 +01: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
DaniPopes
7a1a02ec9b
Fix invalid markdown link references 2023-03-16 20:55:50 +01:00
klensy
1f01433607 clean up few alloc 2023-03-16 20:38:33 +03:00
feniljain
6778d1a6eb feat: do not remove other variants, just push them down in list 2023-03-16 22:54:12 +05:30
est31
f663f09467 Beautify pin! docs
This makes pin docs a little bit less jargon-y and easier to read, by

* splitting up the sentences
* making them less interrupted by punctuation
* turning the footnotes into paragraphs, as they contain useful information
  that shouldn't be hidden in footnotes. Footnotes also interrupt the read flow.
* other improvements and simplifications
2023-03-16 18:03:23 +01: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
est31
a8839c3de7 Use sort_by_key instead of sort_by
I went over the cases where sort_by is used and in these two,
one can use sort_by_key instead.
2023-03-16 13:06:31 +01: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
Jamilya Shurukhova
1f12c3e397 E0206 - removed space 2023-03-16 10:26:34 +01:00
Jamilya Shurukhova
dc39bf8efc E0206 - added union to description 2023-03-16 10:18:31 +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