Commit Graph

230575 Commits

Author SHA1 Message Date
bors
e40e22be55 Auto merge of #112390 - MoskalykA:move-two-tests-from-library-to-tests, r=workingjubilee
Move two tests from `tests/ui/std` to `library/std/tests`

Hi, there,
This pull request comes from this issue (#99417), sorry I made some mistakes creating the pull request, it's my first one.
2023-07-28 05:00:22 +00:00
bors
0ca28c3da7 Auto merge of #97571 - ehuss:symbol-mangling, r=michaelwoerister
Add documentation on v0 symbol mangling.

This adds official documentation for the v0 symbol mangling format, migrating the documentation from [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html).
The format was originally stabilized as the `-C symbol-mangling-version` option, but the specifics were not stabilized (per https://github.com/rust-lang/rust/pull/90128#issuecomment-948569123).
Per the discussion at https://github.com/rust-lang/rust/pull/93661#discussion_r799783363 this adds those specifics as an official description of the format.

cc #89917
2023-07-28 03:12:29 +00:00
bors
0699d99516 Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkov
Less `TokenTree` cloning

`TokenTreeCursor` has this comment on it:
```
// FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones.
```
This PR completes that FIXME. It doesn't have much perf effect, but at least we now know that.

r? `@petrochenkov`
2023-07-28 01:21:27 +00:00
bors
6cacb5247f Auto merge of #108980 - Enselic:println-and-broken-pipe, r=workingjubilee
Regression test `println!()` panic message on `ErrorKind::BrokenPipe`

No existing test (that I could find) failed if the `panic!()` of the `println!()` family of functions was removed, or if its message was changed:

104f4300cf/library/std/src/io/stdio.rs (L1007-L1009)

So add such a test.

This is in preparation of adding a hint about the existence of [`unix_sigpipe`](https://github.com/rust-lang/rust/issues/97889) if that is the reason for the panic.

Even if we don't end up adding a hint, this is still a sensible test to have, I think.

`@rustbot` label +A-testsuite +A-io +T-libs +O-unix
2023-07-27 23:33:00 +00:00
bors
500647fd81 Auto merge of #114144 - workingjubilee:rollup-jkmtgdo, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #97571 (Add documentation on v0 symbol mangling.)
 - #114122 (tests/ui/hello_world/main.rs: Remove FIXME (#62277))
 - #114133 (Revert "add tidy check that forbids issue ui test filenames")
 - #114139 (Make `--print` with path unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-27 21:46:25 +00:00
Jubilee
b457992130
Rollup merge of #114139 - Urgau:make-print-with-path-unstable, r=jackh726
Make `--print` with path unstable

https://github.com/rust-lang/rust/pull/113780 should have gone through an MCP+FCP but wasn't, but instead of reverting the original PR, this PR just make that new option unstable.

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202023-07-27/near/379199738)
cc `@dtolnay`
2023-07-27 13:22:07 -07:00
Jubilee
b5f83a9550
Rollup merge of #114133 - workingjubilee:revert-add-tidy-check-issue-12345, r=jackh726
Revert "add tidy check that forbids issue ui test filenames"

This reverts commit 13e2abf6b3.

Reverting because an MCP was requested and it turned out there was a lack of a consensus on what to do in this area.
2023-07-27 13:22:07 -07:00
Jubilee
9b7b993ebf
Rollup merge of #114122 - Enselic:hello-build-pass, r=petrochenkov
tests/ui/hello_world/main.rs: Remove FIXME (#62277)

The purpose of the test is to make sure that compiling hello world produces no compiler output. To properly test that, we need to run the entire compiler pipeline. We don't want the test to pass if codegen accidentally starts writing to stdout. So keep it as build-pass.

Part of #62277
2023-07-27 13:22:05 -07:00
bors
0be1152311 Auto merge of #113779 - Kobzol:try-build-no-lto, r=Mark-Simulacrum
Build the first LLVM without LTO in try builds

Currently, we perform three LLVM builds in the Linux x64 dist builder, which is used for `try` builds:
1) "Normal" LLVM - takes ~5s to compile thanks to `sccache`, but ~8 minutes to link because of ThinLTO
2) PGO instrumented LLVM - same timings as 1)
3) PGO optimized LLVM - takes about 20 minutes to build

When I tried to disable LTO for build 1), it suddenly takes only about a minute to build, because the linking step is much faster. The first LLVM doesn't really need LTO all that much. Without it, it will be a bit slower to build `rustc` in two subsequent steps, but it seems that the ~7 minutes saved on linking it do win that back.

Btw, we can't use the host LLVM for build 1), because this LLVM then builds `rustc` in PGO instrumented mode, and we need the same compiler when later PGO optimizing `rustc`. And we want to use our in-house LLVM for that I think.
2023-07-27 19:35:19 +00:00
bors
0eb5efc7ae Auto merge of #113298 - tgross35:update-bless-envs, r=oli-obk
Unite bless environment variables under `RUST_BLESS`

Currently, Clippy and Miri both use an environment variable to indicate that output should be blessed, but they use different variable names. In order to improve consistency, this patch applies the following changes:

- Rename the variable `MIRI_BLESS` (as used in the Miri subtree) to `RUST_BLESS`
- Rename the variable `BLESS` (as used in the Clippy subtree) to `RUST_BLESS`
- Move emitting `RUST_BLESS` into `prepare_cargo_test` so it is always available (I need this for a WIP PR)

---

I prefer something like `RUST_BLESS` to `BLESS` just for a lower chance of conflict (not super common but other tools [do use `BLESS`](https://grep.app/search?q=%22BLESS%22&case=true&words=true&filter[lang][0]=Text&filter[lang][1]=Rust&filter[lang][2]=Python&filter[lang][3]=C%2B%2B&filter[lang][4]=Markdown&filter[lang][5]=C&filter[lang][6]=JSON)), but I can change it to whatever is preferred.

Original discussion: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/BLESS.20env.20var.3A.20rename.20to.20CLIPPY_BLESS

r? `@oli-obk`
cc `@flip1995`
2023-07-27 17:45:11 +00:00
Urgau
9268a8b060 Make --print KIND=PATH unstable
https://github.com/rust-lang/rust/pull/113780 should have gone through
an MCP+FCP but wasn't, but instead of reverting the original PR, this PR
just make that new option unstable.
2023-07-27 19:05:17 +02:00
bors
9339f446a5 Auto merge of #113374 - GuillaumeGomez:private-to-public-path, r=notriddle,fmease
[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes #81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? `@notriddle`
2023-07-27 15:56:50 +00:00
Jubilee Young
686b3debfc Revert "add tidy check that forbids issue ui test filenames"
This reverts commit 13e2abf6b3.

Reverting because an MCP was requested and it turned out there
was a lack of a consensus on what to do in this area.
2023-07-27 08:40:21 -07:00
bors
b73e9a48ae Auto merge of #114130 - GuillaumeGomez:rollup-69ihuaj, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #114032 (typos)
 - #114059 (rustdoc: fix cross-crate `impl Sized` & `impl ?Sized`)
 - #114088 (Bump syn dependency)
 - #114091 (docs: fmt::Debug*: Fix comments for finish method.)
 - #114109 (Docs: Fix URL for `rmatches`)
 - #114117 (Restore region uniquification in the new solver 🎉  )
 - #114123 (Turns out opaque types can have hidden types registered during mir validation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-27 14:10:02 +00:00
Guillaume Gomez
218e88e5d8
Rollup merge of #114123 - oli-obk:tait_wtf, r=WaffleLapkin
Turns out opaque types can have hidden types registered during mir validation

See the newly added test's documentation for an explanation.

fixes #114121
2023-07-27 16:05:15 +02:00
Guillaume Gomez
0bebfa39cc
Rollup merge of #114117 - compiler-errors:return-to-uniq, r=lcnr
Restore region uniquification in the new solver 🎉

All of the bugs that were "due" to uniquification have been settled via other means (e.g. bidirectional alias-relate, param-env incompleteness, etc).

Firstly, revert the functional changes in #110180. 😸

Secondly, we need to ignore regions when considering if a goal has changed (the "has_changed" boolean returned from `evaluate_goal`) -- otherwise, because we're doing region uniquification, we may perpetually consider a goal to be changed. See the UI test I committed for an explanation.
2023-07-27 16:05:15 +02:00
Guillaume Gomez
eb1f1a4cc0
Rollup merge of #114109 - veera-sivarajan:fix-str-docs, r=GuillaumeGomez
Docs: Fix URL for `rmatches`

This PR fixes a link to `str::rmatches()` by pointing it to the correct URL.
2023-07-27 16:05:14 +02:00
Guillaume Gomez
ee54896ca1
Rollup merge of #114091 - waywardmonkeys:doc-fmt-finish-comments, r=GuillaumeGomez
docs: fmt::Debug*: Fix comments for finish method.

In the code sample for the `finish` method on `DebugList`, `DebugMap`, and `DebugSet`, refer to finishing the list, map, or set, rather than struct as it did.
2023-07-27 16:05:14 +02:00
Guillaume Gomez
f7123db888
Rollup merge of #114088 - oli-obk:syn, r=davidtwco
Bump syn dependency

r? `@davidtwco` because this affects diagnostics derive diagnostics (yes this sentence is grammatically correct)
2023-07-27 16:05:13 +02:00
Guillaume Gomez
1fa0c4db4f
Rollup merge of #114059 - fmease:rustdoc-fix-x-crate-impl-sized, r=GuillaumeGomez
rustdoc: fix cross-crate `impl Sized` & `impl ?Sized`

Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single `Sized` bound (modulo outlives-bounds) and ones that are `?Sized` were incorrectly rendered. To give you a taste (before vs. after):

```diff
- fn sized(x: impl ) -> impl
+ fn sized(x: impl Sized) -> impl Sized

- fn sized_outlives<'a>(x: impl 'a) -> impl 'a
+ fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a

- fn maybe_sized(x: &impl ) -> &impl
+ fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized

- fn debug_maybe_sized(x: &impl Debug) -> &impl ?Sized + Debug
+ fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized)
```

Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error *ambiguous `+` in a type* if we fed the rendered code back to it).

---

Best reviewed commit by commit :)

`@rustbot` label A-cross-crate-reexports
2023-07-27 16:05:13 +02:00
Guillaume Gomez
b8414fe02e
Rollup merge of #114032 - tshepang:patch-1, r=GuillaumeGomez
typos
2023-07-27 16:05:12 +02:00
bors
49a16b64b0 Auto merge of #114105 - dicej:llvm-update, r=cuviper
Update LLVM submodule

This adds https://github.com/rust-lang/llvm-project/pull/148.
2023-07-27 12:12:31 +00:00
bors
f239bb6bea Auto merge of #113281 - dayo05:master, r=davidtwco
Implement diagnostic translation for rustc-errors

This is my first PR to rustc yeah~

I'm going to implement diagnostic translation on rustc-errors crate.

This PR is WIP, the reason of opening this as draft, I want to show my code to prevent the issue caused by misunderstanding and also I have few questions.

Some error messages are processed by `pluralize!` macro which determines to use plural word or not. From now, I make two kinds of keys and combine with enum but I'm not sure is this best method to do it.

Is there any prefered method to do this? => This resolved on conversation on PR.

I'll remain to perform force-push until my first implementation looks good to me
2023-07-27 09:20:40 +00:00
Guillaume Gomez
2461d0cf9c Remove transmute calls and caching for use paths 2023-07-27 10:54:10 +02:00
Oli Scherer
99a9a63ca6 Turns out opaque types can have hidden types registered during mir validation 2023-07-27 08:23:06 +00:00
Martin Nordholts
f4c4f96d16 tests/ui/hello_world/main.rs: Remove FIXME
The purpose of the test is to make sure that compiling hello world
produces no compiler output. To properly test that, we need to run the
entire compiler pipeline. We don't want the test to pass if codegen
accidentally starts writing to stdout. So keep it as build-pass.
2023-07-27 10:17:01 +02:00
bors
2efa46dc15 Auto merge of #114080 - compiler-errors:negative, r=spastorino
Don't treat negative trait predicates as always knowable

We don't need this. It was added in #90104 but I don't really know why. It's not sound afaict -- negative trait predicates need the same coherence-ambiguity/orphan check rules as positive ones.

r? `@lcnr`

cc `@spastorino,` do you remember why?
2023-07-27 07:29:00 +00:00
bors
3e11b223d7 Auto merge of #114116 - matthiaskrgr:rollup-dtdfk76, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113872 (Tweak CGU sorting in a couple of places.)
 - #114053 (CI: fix CMake installation for 32/64 bit `dist` Linux)
 - #114075 (inline format!() args from rustc_codegen_llvm to the end (4))
 - #114081 (`desugar_doc_comments` cleanups)
 - #114082 (add stable NullaryOp)
 - #114098 (replace atty crate with std's IsTerminal)
 - #114102 (Dont pass `-Zwrite-long-types-to-disk=no` for `ui-fulldeps --stage=1`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-27 04:37:48 +00:00
Matthias Krüger
8cae3439b0
Rollup merge of #114102 - compiler-errors:fulldeps-stage1-hack, r=pnkfelix
Dont pass `-Zwrite-long-types-to-disk=no` for `ui-fulldeps --stage=1`

Due to this hack:

601a34de8c/src/bootstrap/test.rs (L1473-L1484)

We use the stage 0 compiler to build the stage 1 fulldeps tests. That means that we don't have `-Zwrite-long-types-to-disk=no` which was added in #113893.

Add a temporary hack to fix this (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Some.20tests.20failing.20with.20--stage.201) until the next beta bump.
2023-07-27 06:04:15 +02:00
Matthias Krüger
dea5b4fff3
Rollup merge of #114098 - klensy:drop-atty, r=fee1-dead
replace atty crate with std's IsTerminal
2023-07-27 06:04:15 +02:00
Matthias Krüger
17e4f80257
Rollup merge of #114082 - ericmarkmartin:smir-nullary-op, r=spastorino
add stable NullaryOp

r? `@spastorino`
2023-07-27 06:04:14 +02:00
Matthias Krüger
a926c73b5b
Rollup merge of #114081 - nnethercote:desugar_doc_comments-cleanups, r=petrochenkov
`desugar_doc_comments` cleanups

r? `@petrochenkov`
2023-07-27 06:04:14 +02:00
Matthias Krüger
fa21a8c6f8
Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiser
inline format!() args from rustc_codegen_llvm to the end (4)

r? `@WaffleLapkin`
2023-07-27 06:04:13 +02:00
Matthias Krüger
14669cbb9a
Rollup merge of #114053 - Kobzol:ci-linux-fix-cmake, r=nikic
CI: fix CMake installation for 32/64 bit `dist` Linux

Should hopefully fix LLVM 17 build (https://github.com/rust-lang/rust/pull/114048#issuecomment-1649586577).
2023-07-27 06:04:13 +02:00
Matthias Krüger
c3cd05198a
Rollup merge of #113872 - nnethercote:tweak-cgu-sorting, r=pnkfelix
Tweak CGU sorting in a couple of places.

In `base.rs`, tweak how the CGU size interleaving works. Since #113777, it's much more common to have multiple CGUs with identical sizes. With the existing code these same-sized items ended up in the opposite-to-desired order due to the stable sorting. The code now starts with a reverse sort (like is done in `partitioning.rs`) which gives the behaviour we want. This doesn't matter much for perf, but makes profiles in `samply` look more like what we expect.

In `partitioning.rs`, we can use `sort_by_key` instead of `sort_by_cached_key` because `CGU::size_estimate()` is cheap. (There is an identical CGU sort earlier in that function that already uses `sort_by_key`.)

r? `@pnkfelix`
2023-07-27 06:04:12 +02:00
Michael Goulet
1ffc6ca9a5 Consider a goal as NOT changed if its response is identity modulo regions 2023-07-27 04:00:49 +00:00
Michael Goulet
99f60ec411 Revert "don't uniquify regions when canonicalizing"
This reverts commit 171f541470.
2023-07-27 03:16:34 +00:00
bors
d150dbb067 Auto merge of #113708 - rcvalle:rust-cfi-fix-100778, r=compiler-errors
CFI: Fix ICE: encode_const: unexpected type [usize

Fixes #100778 and #113366, and complements #106547 by adding support for encoding const parameters.
2023-07-27 02:48:38 +00:00
Nicholas Nethercote
4ebf2be8bb Remove Iterator impl for TokenTreeCursor.
This is surprising, but the new comment explains why. It's a logical
conclusion in the drive to avoid `TokenTree` clones.

`TokenTreeCursor` is now only used within `Parser`. It's still needed
due to `replace_prev_and_rewind`.
2023-07-27 11:59:03 +10:00
Nicholas Nethercote
ee6ed60373 Avoid into_trees usage in rustfmt.
Token tree cloning is only needed in one place.
2023-07-27 11:58:42 +10:00
Nicholas Nethercote
d2f7f67921 Avoid some token tree cloning in decl macro parsing.
By changing `into_trees` into `trees`. Some of the subsequent paths
require explicit clones, but not all.
2023-07-27 11:58:42 +10:00
Nicholas Nethercote
853f453d57 Avoid some token cloning in filter_tokens_from_list.
Now the cloning only happens on some paths, instead of all paths.
2023-07-27 11:58:42 +10:00
Nicholas Nethercote
55a732461d Make TokenTree::uninterpolate take &self and return a Cow.
Making it similar to `Token::uninterpolate`. This avoids some more token
tree cloning.
2023-07-27 11:58:42 +10:00
Nicholas Nethercote
103bd4a820 Use TokenStream::trees instead of into_trees for attributes.
This avoids cloning some token trees. A couple of `clone` calls were
inserted, but only on some paths, and the next commit will remove them.
2023-07-27 11:58:42 +10:00
bors
e7d6ce3a6f Auto merge of #114034 - Amanieu:riscv-atomicbool, r=thomcc
Optimize `AtomicBool` for target that don't support byte-sized atomics

`AtomicBool` is defined to have the same layout as `bool`, which means that we guarantee that it has a size of 1 byte. However on certain architectures such as RISC-V, LLVM will emulate byte atomics using a masked CAS loop on an aligned word.

We can take advantage of the fact that `bool` only ever has a value of 0 or 1 to replace `swap` operations with `and`/`or` operations that LLVM can lower to word-sized atomic `and`/`or` operations. This takes advantage of the fact that the incoming value to a `swap` or `compare_exchange` for `AtomicBool` is often a compile-time constant.

### Example

```rust
pub fn swap_true(atomic: &AtomicBool) -> bool {
    atomic.swap(true, Ordering::Relaxed)
}
```

### Old

```asm
	andi	a1, a0, -4
	slli	a0, a0, 3
	li	a2, 255
	sllw	a2, a2, a0
	li	a3, 1
	sllw	a3, a3, a0
	slli	a3, a3, 32
	srli	a3, a3, 32
.LBB1_1:
	lr.w	a4, (a1)
	mv	a5, a3
	xor	a5, a5, a4
	and	a5, a5, a2
	xor	a5, a5, a4
	sc.w	a5, a5, (a1)
	bnez	a5, .LBB1_1
	srlw	a0, a4, a0
	andi	a0, a0, 255
	snez	a0, a0
	ret
```

### New

```asm
	andi	a1, a0, -4
	slli	a0, a0, 3
	li	a2, 1
	sllw	a2, a2, a0
	amoor.w	a1, a2, (a1)
	srlw	a0, a1, a0
	andi	a0, a0, 255
	snez	a0, a0
	ret
```
2023-07-27 01:00:12 +00:00
Nicholas Nethercote
a9d8459299 Replace into_trees with trees in a test.
There's no need for token tree cloning here.
2023-07-27 10:40:39 +10:00
Nicholas Nethercote
53379a7b65 Simplify the ttdelim_span test.
The existing code is a very complex and inefficient way to the get the
span of the last token.
2023-07-27 09:41:49 +10:00
Veera
0169ce968c Fix URL for rmatches 2023-07-26 17:57:56 -05:00
bors
0d95f91329 Auto merge of #113843 - wesleywiser:replace_rustc_apfloat, r=pnkfelix
Replace in-tree `rustc_apfloat` with the new version of the crate

Replace the in-tree version of `rustc_apfloat` with the new version of the crate which has been correctly licensed. The new crate incorporates upstream changes from LLVM since the original port was done including many correctness fixes and has been extensively fuzz tested to validate correctness.

Fixes #100233
Fixes #102403
Fixes #113407
Fixes #113409
Fixes #55993
Fixes #93224
Closes #93225
Closes #109573
2023-07-26 21:21:19 +00:00
Joel Dice
6776265d1b
Update LLVM submodule
This adds https://github.com/rust-lang/llvm-project/pull/148.
2023-07-26 14:55:50 -06:00