]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoMigrate "function cannot return without recursing" diagnostic
TheOddGarlic [Sat, 20 Aug 2022 11:28:43 +0000 (14:28 +0300)]
Migrate "function cannot return without recursing" diagnostic

19 months agoAuto merge of #105800 - lqd:dylib-thinlto, r=bjorn3
bors [Sat, 17 Dec 2022 14:51:10 +0000 (14:51 +0000)]
Auto merge of #105800 - lqd:dylib-thinlto, r=bjorn3

Don't copy symbols from dylibs with `-Zdylib-lto`

When `rustc_driver` started being built with `-Zdylib-lto -Clto=thin`, some libstd symbols were copied by the LTO process into the dylib. That causes duplicate local symbols that are not present otherwise.

Depending on the situation (lib loading order apparently), the duplicated symbols could cause issues: `rustc_driver` overrode the panic hook, but it didn't apply to rustc main's hook (the default from libstd). This is the cause of #105637, in some situations the panic hook installed by `rustc_driver` isn't executed, and only libstd's backtrace is shown (and a double panic). The query stack, as well as the various notes to open a GH about the ICE, don't appear.

It's not clear exactly what is needed to trigger the issue, but I have simulated a reproducer [here](https://github.com/lqd/issue-105637) with cargo involved, the incorrect panic hook is executed on my machine. It is hard to reproduce in a unit test: `cargo run` + `rustup` involves LD_LIBRARY_PATH, which is not the case for `compiletest`. cargo also adds unconditional flags that are then overridden in [`bootstrap` when building rustc with `rust.lto = thin`](https://github.com/rust-lang/rust/blob/9c07efe84f28a44f3044237696acc295aa407ee5/src/bootstrap/compile.rs#L702-L714) as done on CI).

All this to say the compilation and execution environment in `bootstrap` leading to the bug building `rustc_driver` is different from our UI tests, and I believe one of the reasons it's hard to make an exact reproducer test. Thankfully there's _still_ a difference in the behavior though: although in the unit test the correct panic hook seems to be executed compared to my repro and the current nightly, only the fix removes the double panic here.

The `7e8277aefa12f1469fb1df01418ff5846a7854a9` `try` build:
- fixes the reproducer repo linked above
- restores the ICE messages from https://github.com/rust-lang/rust/issues/105321 back to the state in its OP compared to the description in https://github.com/rust-lang/rust/issues/105637
- restores the ICE message and the query stack from https://github.com/rust-lang/rust/issues/105777 compared to nightly

While I believe this technically fixes the P-critical issue https://github.com/rust-lang/rust/issues/105637, I would not want to close it yet as we may want to backport to beta/stable (if a point release happens, it would fix the ICEs reported on 1.66.0, which is built with ThinLTO on linux). Once this PR lands, I'll also open another PR to re-enable ThinLTO on x64 darwin's dist builder.

19 months agoAuto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa
bors [Sat, 17 Dec 2022 12:10:27 +0000 (12:10 +0000)]
Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa

Check AArch64 branch-protection earlier in the pipeline.

As suggested in #93516.

r? `@nagisa`

19 months agoAuto merge of #105820 - matthiaskrgr:rollup-uzm1l8f, r=matthiaskrgr
bors [Sat, 17 Dec 2022 09:08:07 +0000 (09:08 +0000)]
Auto merge of #105820 - matthiaskrgr:rollup-uzm1l8f, r=matthiaskrgr

Rollup of 2 pull requests

Successful merges:

 - #105770 (Rename ConstS to ConstData)
 - #105785 (Add regression test for #55976)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoRollup merge of #105785 - JohnTitor:issue-55976-2, r=compiler-errors
Matthias Krüger [Sat, 17 Dec 2022 08:25:53 +0000 (09:25 +0100)]
Rollup merge of #105785 - JohnTitor:issue-55976-2, r=compiler-errors

Add regression test for #55976

Closes #55976
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
19 months agoRollup merge of #105770 - oli-obk:deref_all_the_things, r=compiler-errors
Matthias Krüger [Sat, 17 Dec 2022 08:25:53 +0000 (09:25 +0100)]
Rollup merge of #105770 - oli-obk:deref_all_the_things, r=compiler-errors

Rename ConstS to ConstData

just a style nit to get it in sync with all the other interned datastructures

19 months agoAuto merge of #105794 - ChrisDenton:internal-doc, r=jyn514
bors [Sat, 17 Dec 2022 06:27:30 +0000 (06:27 +0000)]
Auto merge of #105794 - ChrisDenton:internal-doc, r=jyn514

Add CI test for documentation of hidden items in std

Fixes #87844

r? `@jyn514`

19 months agoAuto merge of #105811 - ojeda:Dwarnings-no_fp_fmt_parse, r=Mark-Simulacrum
bors [Sat, 17 Dec 2022 03:11:39 +0000 (03:11 +0000)]
Auto merge of #105811 - ojeda:Dwarnings-no_fp_fmt_parse, r=Mark-Simulacrum

core: ensure `no_fp_fmt_parse` builds are warning-free

Rust recently introduced a new `unused_imports` warning in `no_fp_fmt_parse` builds, which was fixed in
https://github.com/rust-lang/rust/pull/105434.

To avoid accumulating more over time, let's keep the builds warning-free. This ensures projects compiling `core` with this custom config do not see the warnings in the future and that they can keep enabling `-Dwarnings`.

Similarly, https://github.com/rust-lang/rust/pull/98652 did it for `alloc`'s `no_global_oom_handling`.

19 months agoAuto merge of #105804 - matthiaskrgr:rollup-iaqlbl3, r=matthiaskrgr
bors [Sat, 17 Dec 2022 00:41:15 +0000 (00:41 +0000)]
Auto merge of #105804 - matthiaskrgr:rollup-iaqlbl3, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #105493 (Help rust-analyzer normalize query return types)
 - #105710 (Don't bug if we're trying to cast `dyn*` to another type)
 - #105711 (bail in `collect_trait_impl_trait_tys` if signatures reference errors)
 - #105768 (Detect inherent associated types not having CamelCase)
 - #105780 (rustdoc: Don't add "Read more" link if there is no extra content)
 - #105802 (Make enum-match.rs test robust against variable name changes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoRollup merge of #105802 - chbaker0:enum-match-filecheck, r=tmiasko
Matthias Krüger [Fri, 16 Dec 2022 23:45:54 +0000 (00:45 +0100)]
Rollup merge of #105802 - chbaker0:enum-match-filecheck, r=tmiasko

Make enum-match.rs test robust against variable name changes

https://reviews.llvm.org/D140192 caused the LLVM variable generated for enum discriminant checks to be named differently (%narrow vs %1).

This adjusts the test CHECK directives to match any name.

19 months agoRollup merge of #105780 - GuillaumeGomez:read-more-links, r=notriddle
Matthias Krüger [Fri, 16 Dec 2022 23:45:53 +0000 (00:45 +0100)]
Rollup merge of #105780 - GuillaumeGomez:read-more-links, r=notriddle

rustdoc: Don't add "Read more" link if there is no extra content

Fixes #105677.

19 months agoRollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholk
Matthias Krüger [Fri, 16 Dec 2022 23:45:52 +0000 (00:45 +0100)]
Rollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholk

Detect inherent associated types not having CamelCase

Fixes #105341.

19 months agoRollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholk
Matthias Krüger [Fri, 16 Dec 2022 23:45:52 +0000 (00:45 +0100)]
Rollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholk

bail in `collect_trait_impl_trait_tys` if signatures reference errors

Fixes #105290

19 months agoRollup merge of #105710 - compiler-errors:dyn-star-rigid-cast, r=eholk
Matthias Krüger [Fri, 16 Dec 2022 23:45:51 +0000 (00:45 +0100)]
Rollup merge of #105710 - compiler-errors:dyn-star-rigid-cast, r=eholk

Don't bug if we're trying to cast `dyn*` to another type

Fixes #105097

19 months agoRollup merge of #105493 - WaffleLapkin:unchoke-r-a, r=Nilstrieb
Matthias Krüger [Fri, 16 Dec 2022 23:45:50 +0000 (00:45 +0100)]
Rollup merge of #105493 - WaffleLapkin:unchoke-r-a, r=Nilstrieb

Help rust-analyzer normalize query return types

See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/rustc.20query.20types.20are.20not.20normalized.20since.20recently/near/312686086), since https://github.com/rust-lang/rust/pull/103808, rust analyzer doesn't normalize return types of queries. This is because r-a doesn't support associated type defaults (yet).

The easiest fix is to not use associated type defaults (duh), which this PR does.

r? `@cjgillot`

19 months agocore: ensure `no_fp_fmt_parse` builds are warning-free
Miguel Ojeda [Fri, 16 Dec 2022 23:19:59 +0000 (00:19 +0100)]
core: ensure `no_fp_fmt_parse` builds are warning-free

Rust recently introduced a new `unused_imports` warning
in `no_fp_fmt_parse` builds, which was fixed in
https://github.com/rust-lang/rust/pull/105434.

To avoid accumulating more over time, let's keep the builds
warning-free. This ensures projects compiling `core` with
this custom config do not see the warnings in the future
and that they can keep enabling `-Dwarnings`.

Similarly, https://github.com/rust-lang/rust/pull/98652 did it
for `alloc`'s `no_global_oom_handling`.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
19 months agoMake enum-match.rs test robust against variable name changes
Collin Baker [Fri, 16 Dec 2022 22:32:29 +0000 (17:32 -0500)]
Make enum-match.rs test robust against variable name changes

https://reviews.llvm.org/D140192 caused the LLVM variable generated
for enum discriminant checks to be named differently (%narrow vs %1).

This adjusts the test CHECK directives to match any name.

19 months agoAuto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obk
bors [Fri, 16 Dec 2022 21:08:45 +0000 (21:08 +0000)]
Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obk

Stabilize default_alloc_error_handler

Tracking issue: #66741

This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided.

The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked.

Closes #66741

19 months agoadd simulated non-regression test for issue 105637
Rémy Rakic [Fri, 16 Dec 2022 20:38:32 +0000 (20:38 +0000)]
add simulated non-regression test for issue 105637

19 months agodon't copy symbols from dylibs with -Zdylib-lto
Rémy Rakic [Fri, 16 Dec 2022 20:37:53 +0000 (20:37 +0000)]
don't copy symbols from dylibs with -Zdylib-lto

19 months agoFix intra-doc link
Chris Denton [Fri, 16 Dec 2022 19:46:14 +0000 (19:46 +0000)]
Fix intra-doc link

19 months agoTest documentation of hidden items in std
Chris Denton [Fri, 16 Dec 2022 19:33:24 +0000 (19:33 +0000)]
Test documentation of hidden items in std

19 months agoAuto merge of #105018 - zertosh:path_buf_deref_mut, r=dtolnay
bors [Fri, 16 Dec 2022 18:06:10 +0000 (18:06 +0000)]
Auto merge of #105018 - zertosh:path_buf_deref_mut, r=dtolnay

Implement DerefMut for PathBuf

Without this, there's no way to get a `&mut Path` from `PathBuf` without
going through `into_boxed_path`. This is relevant now that #105002 adds
`PathBuf::as_mut_os_string` and `Path::as_mut_os_str`.

19 months agoAuto merge of #105775 - matthiaskrgr:rollup-2o8qn7e, r=matthiaskrgr
bors [Fri, 16 Dec 2022 15:12:00 +0000 (15:12 +0000)]
Auto merge of #105775 - matthiaskrgr:rollup-2o8qn7e, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #105725 (Allow `impl ~const Trait` opaque types)
 - #105744 (Rewrite `E0158` error-code docs for clarity)
 - #105747 (Fix ICE calling method on auto trait)
 - #105748 (doc: Fix a few small issues)
 - #105756 (rustdoc: simplify CSS for codeblock tooltips)
 - #105757 (rustdoc: remove unused CSS `.sub-settings`)
 - #105764 (rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`)
 - #105774 (Remove unused stderr files)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoAdd a comment warning against using associated type defaults <3
Maybe Waffle [Fri, 16 Dec 2022 15:10:48 +0000 (15:10 +0000)]
Add a comment warning against using associated type defaults <3

19 months agoDetect inherent associated types not having CamelCase
Deadbeef [Fri, 16 Dec 2022 04:05:26 +0000 (04:05 +0000)]
Detect inherent associated types not having CamelCase

Fixes #105341.

19 months agoAdd test for presence of read more links
Guillaume Gomez [Fri, 16 Dec 2022 13:52:25 +0000 (14:52 +0100)]
Add test for presence of read more links

19 months agoDon't add "Read more" link if there is no extra content
Guillaume Gomez [Fri, 16 Dec 2022 13:51:48 +0000 (14:51 +0100)]
Don't add "Read more" link if there is no extra content

19 months agoRollup merge of #105774 - TaKO8Ki:remove-unused-stderr-files, r=tmiasko
Matthias Krüger [Fri, 16 Dec 2022 13:02:21 +0000 (14:02 +0100)]
Rollup merge of #105774 - TaKO8Ki:remove-unused-stderr-files, r=tmiasko

Remove unused stderr files

19 months agoRollup merge of #105764 - notriddle:notriddle/src-sidebar-toggle, r=GuillaumeGomez
Matthias Krüger [Fri, 16 Dec 2022 13:02:20 +0000 (14:02 +0100)]
Rollup merge of #105764 - notriddle:notriddle/src-sidebar-toggle, r=GuillaumeGomez

rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`

The old name doesn't get across where it's really supposed to be used.

19 months agoRollup merge of #105757 - notriddle:notriddle/sub-settings, r=GuillaumeGomez
Matthias Krüger [Fri, 16 Dec 2022 13:02:20 +0000 (14:02 +0100)]
Rollup merge of #105757 - notriddle:notriddle/sub-settings, r=GuillaumeGomez

rustdoc: remove unused CSS `.sub-settings`

Obsoleted when 9625ed8be7fa66c3ee5f78180a3d5911817096f6 changed the DOM.

19 months agoRollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, r=GuillaumeGomez
Matthias Krüger [Fri, 16 Dec 2022 13:02:19 +0000 (14:02 +0100)]
Rollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, r=GuillaumeGomez

rustdoc: simplify CSS for codeblock tooltips

Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.

19 months agoRollup merge of #105748 - hakoerber:master, r=Dylan-DPC
Matthias Krüger [Fri, 16 Dec 2022 13:02:19 +0000 (14:02 +0100)]
Rollup merge of #105748 - hakoerber:master, r=Dylan-DPC

doc: Fix a few small issues

Hey, while reading through the (awesome) stdlib docs, I found a few minor typos.

* A few typos around generic types (`;` vs `,`)
* Use inline code formatting for code fragments
* One instance of wrong wording

19 months agoRollup merge of #105747 - chenyukang:yukang/fix-105732-auto-trait, r=compiler-errors
Matthias Krüger [Fri, 16 Dec 2022 13:02:18 +0000 (14:02 +0100)]
Rollup merge of #105747 - chenyukang:yukang/fix-105732-auto-trait, r=compiler-errors

Fix ICE calling method on auto trait

Fixes #105732
r? `@compiler-errors`

19 months agoRollup merge of #105744 - Ezrashaw:e0158-clarity, r=GuillaumeGomez
Matthias Krüger [Fri, 16 Dec 2022 13:02:18 +0000 (14:02 +0100)]
Rollup merge of #105744 - Ezrashaw:e0158-clarity, r=GuillaumeGomez

Rewrite `E0158` error-code docs for clarity

Fixes #105585.

The `E0158` error-code docs are unclear. It doesn't explain all three different variants of the error and doesn't explain *why* the error occurs. This PR cleans it up a bit and brings it properly into line with [RFC1567](https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html).

I'm a first time Rust contributor so I've probably not got it quite right. I also haven't run the whole build process because I assume that my minor docs changes shouldn't break everything.

19 months agoRollup merge of #105725 - fee1-dead-contrib:allow-impl-const-trait, r=oli-obk
Matthias Krüger [Fri, 16 Dec 2022 13:02:17 +0000 (14:02 +0100)]
Rollup merge of #105725 - fee1-dead-contrib:allow-impl-const-trait, r=oli-obk

Allow `impl ~const Trait` opaque types

19 months agoAuto merge of #103880 - b-naber:field-ty-mir, r=lcnr
bors [Fri, 16 Dec 2022 12:47:49 +0000 (12:47 +0000)]
Auto merge of #103880 - b-naber:field-ty-mir, r=lcnr

Use non-ascribed type as field's type in mir

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

r? `@lcnr`

19 months agoremove unused stderr files
Takayuki Maeda [Fri, 16 Dec 2022 11:55:06 +0000 (20:55 +0900)]
remove unused stderr files

19 months agoMake a field only as public as it needs to be
Oli Scherer [Fri, 16 Dec 2022 10:09:23 +0000 (10:09 +0000)]
Make a field only as public as it needs to be

19 months agoRename ConstS to ConstData
Oli Scherer [Fri, 25 Nov 2022 15:33:51 +0000 (15:33 +0000)]
Rename ConstS to ConstData

19 months agoAuto merge of #105763 - Ezrashaw:rustc-book-relative-links, r=jyn514
bors [Fri, 16 Dec 2022 09:30:56 +0000 (09:30 +0000)]
Auto merge of #105763 - Ezrashaw:rustc-book-relative-links, r=jyn514

Use relative links in the unstable and rustc book

Fixes #98227.

As it stands, potential issues could arise from mismatch of stable/ nightly in the books. This PR fixes this issue by using relative links instead of absolute ones. I have replaced every absolute link under `src/doc/rustc` and `src/doc/unstable-book/` and tested each manually.

The link at `src/doc/rustc/src/targets/index.md:7`:
`[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html).`
I need help with because my local directory structure and https://doc.rust-lang.org/ seem to be different, where is `nightly-rustc`?

`@jyn514`

19 months agoAuto merge of #105717 - compiler-errors:anonymize, r=jackh726
bors [Fri, 16 Dec 2022 06:45:08 +0000 (06:45 +0000)]
Auto merge of #105717 - compiler-errors:anonymize, r=jackh726

always use `anonymize_bound_vars`

Unless this is perf-sensitive, it's probably best to always use one anonymize function that does the right thing for all bound vars.

r? types

19 months agoAuto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebank
bors [Fri, 16 Dec 2022 03:57:10 +0000 (03:57 +0000)]
Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebank

Use impl's def id when calculating type to specify in UFCS

Fixes #104327
Fixes #104328

Also addresses https://github.com/rust-lang/rust/pull/102670#discussion_r987381197

19 months agorustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`
Michael Howell [Thu, 15 Dec 2022 23:29:52 +0000 (16:29 -0700)]
rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`

The old name doesn't get across where it's really supposed to be used.

19 months agoAuto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgr
bors [Thu, 15 Dec 2022 22:53:03 +0000 (22:53 +0000)]
Auto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #105481 (Start improving monomorphization items stats)
 - #105674 (Point at method chains on `E0271` errors)
 - #105679 (Suggest constraining type parameter with `Clone`)
 - #105694 (Don't create dummy if val has escaping bounds var)
 - #105727 (Tweak output for bare `dyn Trait` in arguments)
 - #105739 (Migrate Jump to def links background to CSS variable)
 - #105743 (`SimplifiedType` cleanups)
 - #105758 (Move `TypeckResults` to separate module)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agoremove relative links from `rustc-book` and `unstable-book`
Ezra Shaw [Thu, 15 Dec 2022 21:27:03 +0000 (10:27 +1300)]
remove relative links from `rustc-book` and `unstable-book`

Co-authored-by: Joshua Nelson <github@jyn.dev>
19 months agofix #105732, Fix ICE calling method on auto trait
yukang [Thu, 15 Dec 2022 11:21:39 +0000 (19:21 +0800)]
fix #105732, Fix ICE calling method on auto trait

19 months agoRollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 21:03:01 +0000 (22:03 +0100)]
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors

Move `TypeckResults` to separate module

`ty::context` is really big and the typeck results aren't directly related to `TyCtxt`, so move them to a separate module. Also contains a small drive-by macro "improvement".

19 months agoRollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnr
Matthias Krüger [Thu, 15 Dec 2022 21:03:01 +0000 (22:03 +0100)]
Rollup merge of #105743 - nnethercote:SimplifiedType-cleanups, r=lcnr

`SimplifiedType` cleanups

r? `@lcnr`

19 months agoRollup merge of #105739 - GuillaumeGomez:migrate-jump-to-def-link-to-css-var, r=notriddle
Matthias Krüger [Thu, 15 Dec 2022 21:03:00 +0000 (22:03 +0100)]
Rollup merge of #105739 - GuillaumeGomez:migrate-jump-to-def-link-to-css-var, r=notriddle

Migrate Jump to def links background to CSS variable

It's already tested in `src/test/rustdoc-gui/jump-to-def-background.goml`.

r? `@notriddle`

19 months agoRollup merge of #105727 - estebank:use-impl-trait, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 21:02:59 +0000 (22:02 +0100)]
Rollup merge of #105727 - estebank:use-impl-trait, r=oli-obk

Tweak output for bare `dyn Trait` in arguments

Fix #35825.

19 months agoRollup merge of #105694 - ouz-a:issue_105689, r=estebank
Matthias Krüger [Thu, 15 Dec 2022 21:02:59 +0000 (22:02 +0100)]
Rollup merge of #105694 - ouz-a:issue_105689, r=estebank

Don't create dummy if val has escaping bounds var

Skips creating/pushing obligations if val has escaping bounds vars.

Fixes #105689

19 months agoRollup merge of #105679 - estebank:suggest-clone, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 21:02:58 +0000 (22:02 +0100)]
Rollup merge of #105679 - estebank:suggest-clone, r=compiler-errors

Suggest constraining type parameter with `Clone`

Fix #34896.

19 months agoRollup merge of #105674 - estebank:iterator-chains, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 21:02:58 +0000 (22:02 +0100)]
Rollup merge of #105674 - estebank:iterator-chains, r=oli-obk

Point at method chains on `E0271` errors

Follow up to #105332. Fix #33941. CC #9082.

r? `@oli-obk`

19 months agoRollup merge of #105481 - lqd:mono-stats, r=wesleywiser
Matthias Krüger [Thu, 15 Dec 2022 21:02:57 +0000 (22:02 +0100)]
Rollup merge of #105481 - lqd:mono-stats, r=wesleywiser

Start improving monomorphization items stats

As described in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Compile-time.20case-study.3A.20AWS.20crates/near/314560832), some stats about monomorphization collection would be interesting to have, in a different form than `-Zprint-mono-items`: to have some visibility into the cost of the mono items, we'd like to know how many are instantiated and what is their estimated size.

That can be a proxy to analyze sources of slow compile times, although in the future, we'd also like to add more realistic stats from the actual backend's lowering.

This PR adds a new `-Z dump-mono-stats` flag which will output some stats in a `{crate_name}.mono-items.md` file (the flag optionally takes an output directory parameter, for easier use within a workspace than printing to stdout).

For example,

```rust
fn compute<T>(collection: Vec<T>) -> usize {
    collection.len() + 19 - 0 * 9 - 18 - 1 * 1 // random code to increase the function's size
}

fn main() {
    dbg!(compute(vec![0u8, 1, 2]));
    dbg!(compute(vec![0u64, 1, 2]));
    dbg!(compute(vec!["0", "1", "2", "3"]));
}
```

will output a file with this markdown table (abridged for readability), for a debug build:

| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
...

<details>
<summary>Click for full output</summary>

| Item | Instantiation count | Estimated Cost Per Instantiation | Total Estimated Cost |
| --- | ---: | ---: | ---: |
| alloc::alloc::box_free | 3 | 122 | 366 |
| std::alloc::Global::alloc_impl | 1 | 284 | 284 |
| alloc::raw_vec::RawVec::<T, A>::current_memory | 3 | 82 | 246 |
| std::ptr::align_offset | 1 | 222 | 222 |
| std::slice::hack::into_vec | 3 | 67 | 201 |
| <std::vec::Vec<T, A> as std::ops::Drop>::drop | 3 | 66 | 198 |
| std::ptr::mut_ptr::<impl *mut T>::is_null | 4 | 47 | 188 |
| main | 1 | 163 | 163 |
| std::ptr::NonNull::<T>::new_unchecked | 4 | 37 | 148 |
| std::boxed::Box::<T, A>::into_unique | 3 | 48 | 144 |
| std::boxed::Box::<T, A>::leak | 3 | 39 | 117 |
| std::alloc::Layout::array::inner | 1 | 107 | 107 |
| std::ptr::align_offset::mod_inv | 1 | 103 | 103 |
| std::boxed::Box::<T, A>::into_raw_with_allocator | 3 | 31 | 93 |
| std::fmt::Arguments::<'a>::new_v1 | 1 | 80 | 80 |
| <alloc::raw_vec::RawVec<T, A> as std::ops::Drop>::drop | 3 | 26 | 78 |
| alloc::raw_vec::RawVec::<T, A>::from_raw_parts_in | 3 | 26 | 78 |
| alloc::alloc::exchange_malloc | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_null | 1 | 75 | 75 |
| std::ptr::const_ptr::<impl *const T>::is_aligned_to | 1 | 64 | 64 |
| compute | 3 | 20 | 60 |
| std::ptr::const_ptr::<impl *const T>::align_offset | 1 | 55 | 55 |
| std::ptr::read | 1 | 52 | 52 |
| <std::alloc::Global as std::alloc::Allocator>::deallocate | 1 | 50 | 50 |
| std::ptr::mut_ptr::<impl *mut T>::guaranteed_eq | 1 | 48 | 48 |
| std::fmt::ArgumentV1::<'a>::new_display | 2 | 22 | 44 |
| std::ptr::Alignment::new_unchecked | 1 | 42 | 42 |
| core::fmt::num::<impl std::fmt::Debug for usize>::fmt | 1 | 40 | 40 |
| std::result::Result::<T, E>::unwrap_unchecked | 1 | 37 | 37 |
| std::cmp::Ord::min | 1 | 32 | 32 |
| std::cmp::impls::<impl std::cmp::Ord for usize>::cmp | 1 | 31 | 31 |
| std::intrinsics::is_aligned_and_not_null | 1 | 27 | 27 |
| std::rt::lang_start | 1 | 27 | 27 |
| std::ptr::NonNull::<T>::new | 1 | 24 | 24 |
| std::fmt::ArgumentV1::<'a>::new_debug | 1 | 22 | 22 |
| std::fmt::Arguments::<'a>::new_v1_formatted | 1 | 19 | 19 |
| std::rt::lang_start::{closure#0} | 1 | 17 | 17 |
| std::sys_common::backtrace::__rust_begin_short_backtrace | 1 | 16 | 16 |
| std::slice::<impl [T]>::into_vec | 3 | 5 | 15 |
| <std::ptr::NonNull<T> as std::convert::From<std::ptr::Unique<T>>>::from | 1 | 14 | 14 |
| <&T as std::fmt::Debug>::fmt | 1 | 12 | 12 |
| <&T as std::fmt::Display>::fmt | 1 | 12 | 12 |
| std::vec::Vec::<T, A>::len | 3 | 2 | 6 |
| <T as std::convert::Into<U>>::into | 1 | 5 | 5 |
| <T as std::convert::From<T>>::from | 1 | 2 | 2 |
| <() as std::process::Termination>::report | 1 | 2 | 2 |
| std::hint::unreachable_unchecked | 1 | 2 | 2 |
| core::fmt::UnsafeArg::new | 1 | 1 | 1 |

</details>

Since we discussed it together, r? `@wesleywiser.`

19 months agoAuto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obk
bors [Thu, 15 Dec 2022 19:59:48 +0000 (19:59 +0000)]
Auto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obk

Custom MIR: Many more improvements

Commits are each atomic changes, best reviewed one at a time, with the exception that the last commit includes all the documentation.

### First commit

Unsafetyck was not correctly disabled before for `dialect = "built"` custom MIR. This is fixed and a regression test is added.

### Second commit

Implements `Discriminant`, `SetDiscriminant`, and `SwitchInt`.

### Third commit

Implements indexing, field, and variant projections.

### Fourth commit

Documents the previous commits and everything else.

There is some amount of weirdness here due to having to beat Rust syntax into cooperating with MIR concepts, but it hopefully should not be too much. All of it is documented.

r? `@oli-obk`

19 months agoConsider lifetimes when comparing assoc types in method chain
Esteban Küber [Wed, 14 Dec 2022 02:00:24 +0000 (18:00 -0800)]
Consider lifetimes when comparing assoc types in method chain

Do not say "Type changed to X here" when the only difference is caused
by lifetimes.

19 months agoTrim paths in E0599
Esteban Küber [Wed, 14 Dec 2022 00:57:34 +0000 (16:57 -0800)]
Trim paths in E0599

19 months agoMove `TypeckResults` to seperate module
Nilstrieb [Thu, 15 Dec 2022 19:40:16 +0000 (20:40 +0100)]
Move `TypeckResults` to seperate module

19 months agoSmall cleanup in parameterized
Nilstrieb [Thu, 15 Dec 2022 19:40:10 +0000 (20:40 +0100)]
Small cleanup in parameterized

19 months agodocs: rewrite E0158 error-code docs for clarity
Ezra Shaw [Thu, 15 Dec 2022 19:36:40 +0000 (08:36 +1300)]
docs: rewrite E0158 error-code docs for clarity

19 months agorustdoc: remove unused CSS `.sub-settings`
Michael Howell [Thu, 15 Dec 2022 19:27:32 +0000 (12:27 -0700)]
rustdoc: remove unused CSS `.sub-settings`

Obsoleted when 9625ed8be7fa66c3ee5f78180a3d5911817096f6 changed the DOM.

19 months agoShorten trimmed display of closures
Esteban Küber [Wed, 14 Dec 2022 00:34:04 +0000 (16:34 -0800)]
Shorten trimmed display of closures

When `with_forced_trimmed_paths` is used, only print filename and start
of the closure's span, to reduce their verbosity.

19 months agoUse `with_forced_trimmed_paths` more
Esteban Küber [Tue, 13 Dec 2022 23:52:16 +0000 (15:52 -0800)]
Use `with_forced_trimmed_paths` more

19 months agoPoint at method chains on `E0271` errors
Esteban Küber [Tue, 13 Dec 2022 01:39:08 +0000 (17:39 -0800)]
Point at method chains on `E0271` errors

19 months agorustdoc: simplify CSS for codeblock tooltips
Michael Howell [Thu, 15 Dec 2022 19:05:27 +0000 (12:05 -0700)]
rustdoc: simplify CSS for codeblock tooltips

Instead of making its parts `display: none` and then changing it on hover,
just make the pseudo-element itself on hover.

19 months agoMigrate Jump to def links background to CSS variable
Guillaume Gomez [Thu, 15 Dec 2022 07:55:23 +0000 (08:55 +0100)]
Migrate Jump to def links background to CSS variable

19 months agoSuggest `#[derive(Clone)]`
Esteban Küber [Wed, 14 Dec 2022 03:52:42 +0000 (19:52 -0800)]
Suggest `#[derive(Clone)]`

19 months agoSuggest constraining type parameter with `Clone`
Esteban Küber [Wed, 14 Dec 2022 02:55:00 +0000 (18:55 -0800)]
Suggest constraining type parameter with `Clone`

Fix #34896.

19 months agoAuto merge of #104616 - RalfJung:ctfe-alignment, r=oli-obk,RalfJung
bors [Thu, 15 Dec 2022 17:04:25 +0000 (17:04 +0000)]
Auto merge of #104616 - RalfJung:ctfe-alignment, r=oli-obk,RalfJung

always check alignment during CTFE

We originally disabled alignment checks because they got in the way -- there are some things we do with the interpreter during CTFE which does not correspond to actually running user-written code, but is purely administrative, and we didn't want alignment checks there, so we just disabled them entirely. But with `-Zextra-const-ub-checks` we anyway had to figure out how to disable those alignment checks while doing checks in regular code. So now it is easy to enable CTFE alignment checking by default. Let's see what the perf consequences of that are.

r? `@oli-obk`

19 months agoMake the test actually emit the future incompat lint
Oli Scherer [Wed, 23 Nov 2022 14:41:06 +0000 (14:41 +0000)]
Make the test actually emit the future incompat lint

19 months agosimplify alignment_check_failed a bit
Ralf Jung [Tue, 22 Nov 2022 21:04:08 +0000 (22:04 +0100)]
simplify alignment_check_failed a bit

19 months agoFix docs
Oli Scherer [Tue, 22 Nov 2022 13:55:37 +0000 (13:55 +0000)]
Fix docs

19 months agoReuse the ctfe error emitting logic for the future incompat lint
Oli Scherer [Tue, 22 Nov 2022 12:06:17 +0000 (12:06 +0000)]
Reuse the ctfe error emitting logic for the future incompat lint

19 months agoFactor decorate closure out into a method
Oli Scherer [Tue, 22 Nov 2022 12:00:07 +0000 (12:00 +0000)]
Factor decorate closure out into a method

19 months agoAlways report alignment failures in future incompat summaries
Oli Scherer [Tue, 22 Nov 2022 11:52:26 +0000 (11:52 +0000)]
Always report alignment failures in future incompat summaries

19 months agoMove alignment failure error reporting to machine
Oli Scherer [Tue, 22 Nov 2022 11:16:33 +0000 (11:16 +0000)]
Move alignment failure error reporting to machine

19 months agoMake alignment checks a future incompat lint
Oli Scherer [Mon, 21 Nov 2022 16:51:16 +0000 (16:51 +0000)]
Make alignment checks a future incompat lint

19 months agoAlways pass alignment and handle checking lazily
Oli Scherer [Mon, 21 Nov 2022 14:56:12 +0000 (14:56 +0000)]
Always pass alignment and handle checking lazily

19 months agoadjust tests
Ralf Jung [Sun, 20 Nov 2022 08:54:45 +0000 (09:54 +0100)]
adjust tests

19 months agoalways check alignment during CTFE
Ralf Jung [Sat, 19 Nov 2022 22:36:20 +0000 (23:36 +0100)]
always check alignment during CTFE

19 months agofix tidy and add rpitit test
Deadbeef [Thu, 15 Dec 2022 14:17:38 +0000 (14:17 +0000)]
fix tidy and add rpitit test

19 months agoAuto merge of #105746 - matthiaskrgr:rollup-sz3grbv, r=matthiaskrgr
bors [Thu, 15 Dec 2022 14:04:24 +0000 (14:04 +0000)]
Auto merge of #105746 - matthiaskrgr:rollup-sz3grbv, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #104592 (Ensure async trait impls are async (or otherwise return an opaque type))
 - #105623 (Fix `-Z print-type-sizes` for generators with discriminant field ordered first)
 - #105627 (Auto traits in `dyn Trait + Auto` are suggestable)
 - #105633 (Make `report_projection_error` more `Term` agnostic)
 - #105683 (Various cleanups to dest prop)
 - #105692 (Add regression test for #104678)
 - #105707 (rustdoc: remove unnecessary CSS `kbd { cursor: default }`)
 - #105715 (Do not mention long types in E0599 label)
 - #105722 (more clippy::complexity fixes)
 - #105724 (rustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`)
 - #105730 (rustdoc: remove no-op CSS `.item-info:before { color }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

19 months agodoc: Fix a few small issues
Hannes Körber [Thu, 15 Dec 2022 13:05:01 +0000 (14:05 +0100)]
doc: Fix a few small issues

* A few typos around generic types (`;` vs `,`)
* Use inline code formatting for code fragments
* One instance of wrong wording

19 months agoRollup merge of #105730 - notriddle:notriddle/item-info-before, r=GuillaumeGomez
Matthias Krüger [Thu, 15 Dec 2022 11:46:05 +0000 (12:46 +0100)]
Rollup merge of #105730 - notriddle:notriddle/item-info-before, r=GuillaumeGomez

rustdoc: remove no-op CSS `.item-info:before { color }`

No content is set, so this pseudo-element does not exist. The CSS was obsoleted by 73d0f7c7b68784f1db0a1f53855c20d118a7e8b0.

19 months agoRollup merge of #105724 - notriddle:notriddle/scrape-example-src-line-numbers, r...
Matthias Krüger [Thu, 15 Dec 2022 11:46:05 +0000 (12:46 +0100)]
Rollup merge of #105724 - notriddle:notriddle/scrape-example-src-line-numbers, r=GuillaumeGomez

rustdoc: remove no-op CSS `.scrape-example .src-line-numbers { margin: 0 }`

This is the default CSS for `<pre>` tags in `.code-wrapper` anyway, so this line does nothing.

19 months agoRollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:04 +0000 (12:46 +0100)]
Rollup merge of #105722 - matthiaskrgr:compl2, r=compiler-errors

more clippy::complexity fixes

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

19 months agoRollup merge of #105715 - estebank:unsatisfied-bounds-label, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:04 +0000 (12:46 +0100)]
Rollup merge of #105715 - estebank:unsatisfied-bounds-label, r=compiler-errors

Do not mention long types in E0599 label

The type is already mentioned in the main message and the list of unmet bounds.

19 months agoRollup merge of #105707 - notriddle:notriddle/kbd-cursor, r=jhpratt,GuillaumeGomez
Matthias Krüger [Thu, 15 Dec 2022 11:46:03 +0000 (12:46 +0100)]
Rollup merge of #105707 - notriddle:notriddle/kbd-cursor, r=jhpratt,GuillaumeGomez

rustdoc: remove unnecessary CSS `kbd { cursor: default }`

Added along with theme picker changes in https://github.com/rust-lang/rust/pull/47686/files#diff-7dc22a0530802d77c2f2ec9e834024a5657b6eab4055520fca46edc99a544413R1144, but no reason seems to have been given at the time for why this particular rule was added.

Removing this rule results in `<kbd>` elements getting an I-bar, while the rule causes them to use the "default" arrow, but since selecting the text in these elements works fine, the I-bar is not misleading.

19 months agoRollup merge of #105692 - JohnTitor:issue-104678, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:03 +0000 (12:46 +0100)]
Rollup merge of #105692 - JohnTitor:issue-104678, r=compiler-errors

Add regression test for #104678

Closes #104678
r? `````@compiler-errors`````

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
19 months agoRollup merge of #105683 - JakobDegen:dest-prop-storage, r=tmiasko
Matthias Krüger [Thu, 15 Dec 2022 11:46:02 +0000 (12:46 +0100)]
Rollup merge of #105683 - JakobDegen:dest-prop-storage, r=tmiasko

Various cleanups to dest prop

This makes fixing the issues identified in #105577 easier. A couple changes

 - Use an enum with names instead of a bool
 - Only call `remove_candidates_if` from one place instead of two. Doing it from two places is far too fragile, since any divergence in the behavior between those callsites is likely to be unsound.
 - Remove `is_constant`. Right now we only merge locals, so this doesn't do anything, and the logic would be wrong if it did.

r? `@tmiasko`

19 months agoRollup merge of #105633 - compiler-errors:term-agnostic, r=oli-obk
Matthias Krüger [Thu, 15 Dec 2022 11:46:01 +0000 (12:46 +0100)]
Rollup merge of #105633 - compiler-errors:term-agnostic, r=oli-obk

Make `report_projection_error` more `Term` agnostic

Fixes #105632

19 months agoRollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwco
Matthias Krüger [Thu, 15 Dec 2022 11:46:01 +0000 (12:46 +0100)]
Rollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwco

Auto traits in `dyn Trait + Auto` are suggestable

Not  sure why I had made the `IsSuggestableVisitor` have that rule to not consider `dyn Trait + Auto` to be suggestable.

It's possible that this was done because of the fact that we don't print the right parentheses for `&(dyn Trait + Auto)`, but that's a problem with printing these types in general that we probably have tracked somewhere else...

19 months agoRollup merge of #105623 - compiler-errors:generator-type-size-fix, r=Nilstrieb
Matthias Krüger [Thu, 15 Dec 2022 11:46:00 +0000 (12:46 +0100)]
Rollup merge of #105623 - compiler-errors:generator-type-size-fix, r=Nilstrieb

Fix `-Z print-type-sizes` for generators with discriminant field ordered first

Fixes #105589
Fixes #105591

19 months agoRollup merge of #104592 - ComputerDruid:async_check, r=compiler-errors
Matthias Krüger [Thu, 15 Dec 2022 11:46:00 +0000 (12:46 +0100)]
Rollup merge of #104592 - ComputerDruid:async_check, r=compiler-errors

Ensure async trait impls are async (or otherwise return an opaque type)

As a workaround for the full `#[refine]` semantics not being implemented
yet, forbit returning a concrete future type like `Box<dyn Future>` or a
manually implemented Future.

`-> impl Future` is still permitted; while that can also cause
accidental refinement, that's behind a different feature gate
(`return_position_impl_trait_in_trait`) and that problem exists
regardless of whether the trait method is async, so will have to be
solved more generally.

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

19 months agoAllow `impl ~const Trait` opaque types
Deadbeef [Thu, 15 Dec 2022 00:51:34 +0000 (00:51 +0000)]
Allow `impl ~const Trait` opaque types

19 months agoAuto merge of #105285 - compiler-errors:conflicting-param-env-2, r=estebank
bors [Thu, 15 Dec 2022 11:11:49 +0000 (11:11 +0000)]
Auto merge of #105285 - compiler-errors:conflicting-param-env-2, r=estebank

Highlight conflicting param-env candidates, again

Un-reverts #98794 (i.e. reverts #99290).

The previous time I attempted to land this PR, it was because of an incremental issue (#99233). The repro instructions in the issue is no longer manifest the ICE -- I think it's because this ambiguity code was refactored (I think by `@lcnr)` to no longer store the ambiguities in the fulfillment error, but instead recompute them on the fly.

The main motivation for trying to re-land this is that it fixes #105131 by highlighting the root-cause of the issue, which is conflicting param-env candidates:

```
error[E0283]: type annotations needed: cannot satisfy `Self: Gen<'source>`
   |
note: multiple `impl`s or `where` clauses satisfying `Self: Gen<'source>` found
  --> $DIR/conflicting-bounds.rs:3:1
   |
LL | pub trait Gen<'source> {
   | ^^^^^^^^^^^^^^^^^^^^^^
...
LL |         Self: for<'s> Gen<'s, Output = T>;
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0283`.
```

Fixes #105131.
Fixes (again) #98786

19 months agoAuto merge of #105713 - bjorn3:sync_cg_clif-2022-12-14, r=bjorn3
bors [Thu, 15 Dec 2022 07:23:38 +0000 (07:23 +0000)]
Auto merge of #105713 - bjorn3:sync_cg_clif-2022-12-14, r=bjorn3

Sync rustc_codegen_cranelift

This time there are a bunch of bugfixes, some new llvm intrinsic implementations and refactorings to the build system in preparation for running cg_clif tests as part of `./x.py test`.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

19 months agoVarious cleanups to dest prop
Jakob Degen [Wed, 14 Dec 2022 05:30:42 +0000 (21:30 -0800)]
Various cleanups to dest prop

19 months agoAdd regression test for #55976
Yuki Okushi [Thu, 15 Dec 2022 06:04:23 +0000 (15:04 +0900)]
Add regression test for #55976

Signed-off-by: Yuki Okushi <jtitor@2k36.org>