Commit Graph

219961 Commits

Author SHA1 Message Date
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
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
Lukas Markeffsky
3f250a9241 Mention UEFI target promotion in release notes for 1.67.0 2023-03-15 22:33:10 +01:00
bors
c90eb4825a Auto merge of #108282 - cjgillot:mir-checked-sh, r=tmiasko
Implement checked Shl/Shr at MIR building.

This does not require any special handling by codegen backends,
as the overflow behaviour is entirely determined by the rhs (shift amount).

This allows MIR ConstProp to remove the overflow check for constant shifts.

~There is an existing different behaviour between cg_llvm and cg_clif (cc `@bjorn3).`
I took cg_llvm's one as reference: overflow if `rhs < 0 || rhs > number_of_bits_in_lhs_ty`.~

EDIT: `cg_llvm` and `cg_clif` implement the overflow check differently. This PR uses `cg_llvm`'s implementation based on a `BitAnd` instead of `cg_clif`'s one based on an unsigned comparison.
2023-03-15 21:31:06 +00:00
Michael Howell
683c12cb91 rustdoc: remove std:: from primitive intra-doc link tooltips 2023-03-15 11:34:37 -07:00
bors
ab654863c3 Auto merge of #109169 - bjorn3:sync_cg_clif-2023-03-15, r=bjorn3
Sync rustc_codegen_cranelift

Bunch of bug fixes this time. Also an update to Cranelift 0.93 which adds a brand new optimization pass which cg_clif exposes when using `--release`. And various improvements to cg_clif's test suite, making it faster to run. And finally two small perf improvements.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-03-15 18:30:04 +00:00
gimbles
e5a5b90afc unequal → not equal 2023-03-15 23:55:48 +05:30
Camille GILLOT
2adf2cd2f7 Account for debuginfo on _0 without naming it. 2023-03-15 18:02:19 +01:00
Guillaume Gomez
e667872bfd Update docsfs module documentation 2023-03-15 16:47:14 +01:00
Rémy Rakic
5ad1083e5b Revert "Auto merge of #107376 - aliemjay:remove-givens, r=lcnr"
This reverts commit e84e5ff04a, reversing
changes made to 1716932743.
2023-03-15 15:09:29 +00:00
bors
a167cbddac Auto merge of #109164 - Dylan-DPC:rollup-0bwxwos, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #108991 (add `enable-warnings` flag for llvm, and disable it by default.)
 - #109109 (Use `unused_generic_params` from crate metadata)
 - #109111 (Create dirs for build_triple)
 - #109136 (Simplify proc macro signature validity check)
 - #109150 (Update cargo)
 - #109154 (Fix MappingToUnit  to support no span of arg_ty)
 - #109157 (Remove mw from review rotation for a while)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-15 14:50:03 +00:00
bjorn3
fce629d2e9 Merge commit 'dec0daa8f6d0a0e1c702f169abb6bf3eee198c67' into sync_cg_clif-2023-03-15 2023-03-15 14:41:48 +00:00
bjorn3
dec0daa8f6 Rustup to rustc 1.70.0-nightly (171693274 2023-03-14) 2023-03-15 14:33:54 +00:00
bjorn3
fed9534323 Sync from rust 1716932743 2023-03-15 14:28:47 +00:00
bjorn3
6f6007156b Introduce Box::new in mini_core 2023-03-15 14:26:03 +00:00
bjorn3
b42358a23f Use patched git-subtree from bjorn3/git@tqc-subtree-portable
This patched has been necessary for subtree syncs from the start, but
previously it was necessary to locally install tqc's patched git
version, which hasn't been updated for quite a while. I made a small
change to allow downloading it as script without requiring an entire git
installation for the patched version.
2023-03-15 14:20:18 +00:00
lcnr
d2b7604db9 always make define_opaque_types explicit 2023-03-15 14:00:15 +01:00
Dylan DPC
ff8f659501
Rollup merge of #109157 - michaelwoerister:tb, r=Mark-Simulacrum
Remove mw from review rotation for a while

I'm triple booked right now 📚
2023-03-15 17:51:34 +05:30
Dylan DPC
19d575851a
Rollup merge of #109154 - chenyukang:yukang/fix-109152, r=compiler-errors
Fix MappingToUnit  to support no span of arg_ty

Fixes #109152
2023-03-15 17:51:33 +05:30
Dylan DPC
a08516be86
Rollup merge of #109150 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in 7d3033d2e59383fd76193daf9423c3d141972a7d..4a3c588b1f0a8e2dc8dd8789dbf3b6a71b02ed49
2023-03-08 17:05:08 +0000 to 2023-03-14 14:05:36 +0000
- ci: make clean-test-output a script for reuse (rust-lang/cargo#11848)
- Accurately show status when downgrading dependencies (rust-lang/cargo#11839)
- docs(contrib): Move Design Principles earlier in the book (rust-lang/cargo#11842)
- docs(contrib): Point compilation docs to doc comments (rust-lang/cargo#11841)
- `cargo install --git` multiple packages with binaries found hint (rust-lang/cargo#11835)
- Disable flaky auth tests when `gitoxide` runs them (rust-lang/cargo#11830)
- Add some documentation on writing cross-compilation tests (rust-lang/cargo#11825)
- chore: Use sparse protocol on stable CI (rust-lang/cargo#11829)
- Notice for potential unexpected shell expansions in help text of `cargo-add` (rust-lang/cargo#11826)
- Add tracking issue to gitoxide unstable docs (rust-lang/cargo#11822)
- Bump crates-io to 0.36.0 (rust-lang/cargo#11820)
- Bump to 0.71.0; update changelog (rust-lang/cargo#11815)
- docs(contrib): Move overview to lib (rust-lang/cargo#11809)
- Fix semver check for 1.68 (rust-lang/cargo#11817)

r? `@ghost`
2023-03-15 17:51:33 +05:30