Commit graph

230605 commits

Author SHA1 Message Date
León Orell Valerian Liehr afd009a8d8
Parse generic const items 2023-07-28 22:21:33 +02:00
bors b6dd153fbc Auto merge of #113931 - cuviper:ci-ubuntu-22.04, r=Mark-Simulacrum
ci: update ubuntu:20.04 builders to 22.04

This is mostly just maintenance to avoid bitrotting, but 22.04 also updates to cmake 3.22, so they don't need the manual builds from #113714 anymore.
2023-07-28 17:36:35 +00:00
bors 317ec04d18 Auto merge of #111780 - weiznich:diagnostic_namespace, r=petrochenkov
Diagnostic namespace

This PR implements the basic infrastructure for accepting the `#[diagnostic]` attribute tool namespace as specified in https://github.com/rust-lang/rfcs/pull/3368. Note: This RFC is not merged yet, but it seems like it will be accepted soon. I open this PR early on to get feedback on the actual implementation as soon as possible. This hopefully enables getting at least the diagnostic namespace to stable rust "soon", so that crates do not need to bump their MSRV if we stabilize actual attributes in this namespace.

 This PR only adds infrastructure accept attributes from this namespace, it does not add any specific attribute. Therefore the compiler will emit a lint warning for each attribute that's actually used. This namespace is added behind a feature flag, so it will be only available on a nightly compiler for now.

cc `@estebank` as they've supported me in planing, specifying and implementing this feature.
2023-07-28 14:18:29 +00:00
bors b95fd857fe Auto merge of #114119 - nnethercote:opt-TokenKind-clone, r=petrochenkov
Optimize `TokenKind::clone`.

`TokenKind` would impl `Copy` if it weren't for
`TokenKind::Interpolated`. This commit makes `clone` reflect that.

r? `@ghost`
2023-07-28 12:30:27 +00:00
Georg Semmler 5b576665e5
Introduce the #[diagnostic] attribute namespace
Co-authored-by: est31 <est31@users.noreply.github.com>

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-07-28 13:28:02 +02:00
bors e4c98caffe Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnr
discard default auto trait impls if explicit ones exist (rebase of #85048)

Rebase of #85048
2023-07-28 10:41:00 +00:00
Oleksandr Babak 37159345a7
Change the description of SUSPICIOUS_AUTO_TRAIT_IMPLS 2023-07-28 11:50:10 +02:00
bors aafd75a9c5 Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obk
Remove `constness` from `ParamEnv`

This should be replaced by keyword generics/effects. cc #110395

r? `@oli-obk`
2023-07-28 08:53:12 +00:00
bors 37343f4a4d Auto merge of #114154 - calebcartwright:style-match-mac, r=joshtriplett
style-guide: don't flatten match arms with macro call

This pulls forward the gist of the text that was added to the style guide in https://github.com/rust-lang/style-team/pull/159 to account for needing to tweak/soften rustfmt's behavior based on the style guide prescriptions.

There were a few options I considered, noted below, and although I don't particularly love any of them, I felt this was the lesser of the evils.

r? `@joshtriplett`
2023-07-28 06:46:51 +00:00
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
Caleb Cartwright 45b2559e5e docs(style-guide): don't flatten match arms with macro call 2023-07-27 21:36:06 -05: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
Deadbeef b0fa2201d3 bless clippy 2023-07-27 17:56:25 +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
Deadbeef 2d59451274 update tests, adding known-bug 2023-07-27 15:51:02 +00:00
Deadbeef e6b423aebb Remove constness from ParamEnv 2023-07-27 15:50:42 +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
Nicholas Nethercote ac747a8481 Optimize TokenKind::clone.
`TokenKind` would impl `Copy` if it weren't for
`TokenKind::Interpolated`. This commit makes `clone` reflect that.
2023-07-27 15:05:23 +10: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