Commit Graph

228983 Commits

Author SHA1 Message Date
bors
131a03664e Auto merge of #113040 - Kobzol:llvm-remark-streamer, r=tmiasko
Add `-Zremark-dir` unstable flag to write LLVM optimization remarks to YAML

This PR adds an option for `rustc` to emit LLVM optimization remarks to a set of YAML files, which can then be digested by existing tools, like https://github.com/OfekShilon/optview2. When `-Cremark-dir` is passed, and remarks are enabled (`-Cremark=all`), the remarks will be now written to the specified directory, **instead** of being printed to standard error output.  The files are named based on the CGU from which they are being generated.

Currently, the remarks are written using the LLVM streaming machinery, directly in the diagnostics handler. It seemed easier than going back to Rust and then form there back to C++ to use the streamer from the diagnostics handler. But there are many ways to implement this, of course, so I'm open to suggestions :)

I included some comments with questions into the code. Also, I'm not sure how to test this.

r? `@tmiasko`
2023-07-02 12:48:44 +00:00
Jakub Beránek
62728c7aaf
Add rustc option to output LLVM optimization remarks to YAML files 2023-07-02 13:41:36 +02:00
bors
4c3f8c728b Auto merge of #113256 - matthiaskrgr:rollup-poex8w2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113147 (Fix document examples of Vec::from_raw_parts and Vec::from_raw_parts_in)
 - #113202 (std docs: factorize literal in Barrier example)
 - #113228 (Migrate GUI colors test to original CSS color format)
 - #113231 (Fix `dropping_copy_types` lint from linting in match-arm with side-effects)
 - #113233 (Update chalk)
 - #113234 (Don't pass --test-args to `python -m unitest`)
 - #113244 (Make Rust Analyzer tests faster by compiling less code)
 - #113249 (Document tracking issue for rustdoc `show-type-layout`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-02 10:22:49 +00:00
Mu001999
b913f5593d Suggest x build library for a custom toolchain that fails to load core 2023-07-02 17:53:44 +08:00
Guillaume Gomez
c7847e991a Migrate GUI colors test to original CSS color format 2023-07-02 11:15:23 +02:00
Matthias Krüger
fde41023db
Rollup merge of #113249 - tgross35:patch-2, r=jyn514
Document tracking issue for rustdoc `show-type-layout`

Tracking issue: https://github.com/rust-lang/rust/issues/113248

``@rustbot`` label +T-rustdoc +A-docs
2023-07-02 10:27:23 +02:00
Matthias Krüger
efd2739ac4
Rollup merge of #113244 - Kobzol:bootstrap-rust-analyzer-tests, r=jyn514
Make Rust Analyzer tests faster by compiling less code

This should bring down the test duration of RA significantly.
2023-07-02 10:27:22 +02:00
Matthias Krüger
a353cb0cd8
Rollup merge of #113234 - jyn514:revert-python-test-args, r=clubby789
Don't pass --test-args to `python -m unitest`

The args for unittest and cargo test are mutually incompatible. Suggest that people use `python -m unittest ...` manually instead.

This also changes `bootstrap_test.py` to be easier to run standalone; see the commit for details.

r? `@clubby789` cc https://github.com/rust-lang/rust/pull/112281#discussion_r1248849172
2023-07-02 10:27:22 +02:00
Matthias Krüger
fda22efbf0
Rollup merge of #113233 - Nilstrieb:chaaalk, r=jackh726
Update chalk

For #109302

r? jackh726
2023-07-02 10:27:21 +02:00
Matthias Krüger
74a272d3d7
Rollup merge of #113231 - Urgau:fix_false_positive_drop_copy, r=Nilstrieb
Fix `dropping_copy_types` lint from linting in match-arm with side-effects

This PR fixes an issue with the `dropping_copy_types` and `dropping_references` lints when not all patterns that can have side-effects were detected and ignored.

Nearly _fixes_ https://github.com/rust-lang/rust/issues/112653 (will need beta-backport to completely fix the issue)
r? ``@Nilstrieb``
2023-07-02 10:27:21 +02:00
Matthias Krüger
37c50653fe
Rollup merge of #113228 - GuillaumeGomez:migrate-gui-test-color-18, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? ``@notriddle``
2023-07-02 10:27:20 +02:00
Matthias Krüger
c4ba0a6912
Rollup merge of #113202 - guilliamxavier:patch-1, r=workingjubilee
std docs: factorize literal in Barrier example

Motivated by https://www.reddit.com/r/rust/comments/rnh5hu/barrier_question_barrier_does_not_sync_many/ (but maybe not worth it?)
2023-07-02 10:27:20 +02:00
Matthias Krüger
2a3766e7fe
Rollup merge of #113147 - lizhanhui:fix_vec_from_raw_parts_doc_example, r=Mark-Simulacrum
Fix document examples of Vec::from_raw_parts and Vec::from_raw_parts_in

These two examples are misplaced.
2023-07-02 10:27:20 +02:00
bors
72b2101434 Auto merge of #112718 - oli-obk:SIMD-destructure_mir_const, r=cjgillot
Make simd_shuffle_indices use valtrees

This removes the second-to-last user of the `destructure_mir_constant` query. So in a follow-up we can remove the query and just move the query provider function directly into pretty printing (which is the last user).

cc `@rust-lang/clippy` there's a small functional change, but I think it is correct?
2023-07-02 07:43:36 +00:00
yukang
b26701ea79 add testcase for 112590 2023-07-02 15:35:18 +08:00
bors
be6e38c617 Auto merge of #112756 - hi-rustin:rustin-patch-bootstrap, r=clubby789
Use RustOptimize to set optimize

close https://github.com/rust-lang/rust/issues/112678

Use RustOptimize to set optimize.
2023-07-02 04:54:15 +00:00
Alex Touchet
7bb9de87f6
Use consistent formatting in Readme 2023-07-01 21:14:20 -07:00
Daniyar Nurmukhamet
99599db8f0 fixed documentation of from<CString> for Rc<CStr>: Arc -> Rc 2023-07-02 10:07:52 +06:00
hi-rustin
7cab8f7862 Fix broken tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-07-02 12:07:25 +08:00
bors
8e2d5e3a58 Auto merge of #112910 - lqd:mcp510, r=petrochenkov
Implement most of MCP510

This implements most of what remains to be done for MCP510:
- turns `-C link-self-contained` into a `+`/`-` list of components, like `-C link-self-contained=+linker,+crto,+libc,+unwind,+sanitizers,+mingw`. The scaffolding is present for all these expected components to be implemented and stabilized in the future on their own time. This PR only handles the `-Zgcc-ld=lld` subset of these link-self-contained components as  `-Clink-self-contained=+linker`
- handles  `-C link-self-contained=y|n`  as-is today, for compatibility with `rustc_codegen_ssa:🔙🔗:self_contained`'s [explicit opt-in and opt-out](9eee230cd0/compiler/rustc_codegen_ssa/src/back/link.rs (L1671-L1676)).
- therefore supports our plan to opt out of `rust-lld` (when it's enabled by default) even for current `-Clink-self-contained` users, with e.g. `-Clink-self-contained -Clink-self-contained=-linker`
- turns `add_gcc_ld_path` into its expected final form, by using the `-C link-self-contained=+linker`  CLI flag, and whether the `LinkerFlavor`  has the expected `Cc::Yes` and `Lld::Yes` shape (this is not yet the case in practice for any CLI linker flavor)
- makes the [new clean linker flavors](https://github.com/rust-lang/rust/pull/96827#issuecomment-1208441595) selectable in the CLI in addition to the legacy ones, in order to opt-in to using `cc` and `lld` to emulate `-Zgcc-ld=lld`
- ensure the new `-C link-self-contained` components, and `-C linker-flavor`s are unstable, and require `-Z unstable-options` to be used

The up-to-date set of flags for the future stable CLI version of `-Zgcc-ld=lld` is currently: `-Clink-self-contained=+linker -Clinker-flavor=gnu-lld-cc -Zunstable-options`.

It's possible we'll also need to do something for distros that don't ship `rust-lld`, but maybe there are already no tool search paths to be added to `cc` in this situation anyways.

r? `@petrochenkov`
2023-07-02 02:25:01 +00:00
yukang
361df86a8d Use scoped-tls for SMIR to map between TyCtxt and SMIR datastructures 2023-07-02 07:48:41 +08:00
Trevor Gross
4fae271352 Document tracking issue for rustdoc show-type-layout 2023-07-01 19:41:26 -04:00
bors
ba76096bf1 Auto merge of #111035 - Nilstrieb:layout-err, r=wesleywiser
Shrink error variants for layout and fn_abi

The errors are bigger than the result, so let's put them behind a reference. Since query results have to be `Copy`, we use a reference into the arena instead of a `Box<T>`.
2023-07-01 23:38:28 +00:00
bors
37f4c1725d Auto merge of #11012 - Centri3:manual_try_fold, r=blyxyas,xFrednet
New lint [`manual_try_fold`]

Closes #10208

---

changelog: New lint [`manual_try_fold`]
[#11012](https://github.com/rust-lang/rust-clippy/pull/11012)
2023-07-01 22:43:12 +00:00
Jan-Mirko Otter
3ed2b46f28 fix compiletest crash 2023-07-01 23:59:21 +02:00
Nilstrieb
4be84771a7 Put FnAbiError behind reference to shrink result
The `FnAbi` is just a pointer, so the error type should not be bigger.
2023-07-01 21:16:27 +02:00
Nilstrieb
3019c1cb2a Put LayoutError behind reference to shrink result
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's
shrink that.
2023-07-01 21:16:25 +02:00
Eric Mark Martin
b9e991a105 add thir-print test 2023-07-01 15:15:22 -04:00
Jakub Beránek
b9df85f6ed
Make Rust Analyzer tests faster by compiling less code 2023-07-01 21:07:28 +02:00
Catherine
cb5d7e344a address comments 2023-07-01 12:37:16 -05:00
Catherine
fbb3f759e2 update docs 2023-07-01 12:36:02 -05:00
Catherine
04b0857691 Typo 2023-07-01 12:36:02 -05:00
Catherine
24039ca2c6 Add msrv tests 2023-07-01 12:36:02 -05:00
Catherine
354172a18e New lint manual_try_fold 2023-07-01 12:36:02 -05:00
jyn
85372005e7 Don't pass --test-args to python -m unitest
The args for unittest and cargo test are mutually incompatible. Suggest that people use `python -m unittest ...` manually instead.

This also changes `bootstrap_test.py` to be easier to run standalone; see the commit for details.
2023-07-01 11:13:08 -05:00
Nilstrieb
e43ec03968 Update chalk 2023-07-01 18:03:36 +02:00
bors
c7bf05c1a4 Auto merge of #11020 - Centri3:tuple_array_conversion, r=llogiq
New lint [`tuple_array_conversions`]

Closes #10748

PS, the implementation is a bit ugly 😅 ~~I will likely refactor soon enough :)~~ Done :D

changelog: New lint [`tuple_array_conversions`]
2023-07-01 15:27:35 +00:00
bors
6162f6f123 Auto merge of #113225 - calebcartwright:sync-rustfmt, r=calebcartwright
Update Rustfmt (add let-else support)

Adds let-else formatting support

Bit more detail in: https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#160-2023-07-02
Accompanying blog post: https://github.com/rust-lang/blog.rust-lang.org/pull/1117

I know we're getting close to tool week, however, there's been extensive discussion and testing of the changes in this between both t-style and t-rustfmt. Our confidence level is extremely high, and even if it's only on nightly for a few days, I'd still much prefer that and being able to get this out with 1.72 vs having to push to 1.73

Closes https://github.com/rust-lang/rustfmt/issues/4914
cc `@rust-lang/style` for awareness
2023-07-01 14:32:35 +00:00
Urgau
908574b5e7 Fix dropping_copy_types lint from linting in match-arm with side-effects 2023-07-01 16:05:55 +02:00
bors
5633798af6 Auto merge of #113229 - matthiaskrgr:rollup-gunqun4, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #113168 (fix(resolve): skip assertion judgment when NonModule is dummy)
 - #113174 (Better messages for next on a iterator inside for loops)
 - #113182 (Error when RPITITs' hidden types capture more lifetimes than their trait definitions)
 - #113196 (Fix associated items effective visibility calculation for type privacy lints)
 - #113226 (Fix try builds on the msvc builder)
 - #113227 (Update cargo)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-01 12:06:23 +00:00
Matthias Krüger
f67d59b43d
Rollup merge of #113227 - weihanglo:update-cargo, r=weihanglo
Update cargo

6 commits in 03bc66b55c290324bd46eb22e369c8fae1908f91..5b377cece0e0dd0af686cf53ce4637d5d85c2a10
2023-06-23 23:27:46 +0000 to 2023-06-30 00:01:00 +0000
- Add READMEs for the credential helpers. (rust-lang/cargo#12322)
- Add some more documentation for Source download functions. (rust-lang/cargo#12319)
- Don't try to compile cargo-credential-gnome-secret on non-Linux platforms. (rust-lang/cargo#12321)
- refactor: use macro to remove duplication of workspace inheritable fields getters (rust-lang/cargo#12317)
- doc: should be `.cargo-ok` (rust-lang/cargo#12318)
- refactor(registry): extract and rearrange items to their own modules (rust-lang/cargo#12290)

r? `@ghost`
2023-07-01 13:46:03 +02:00
Matthias Krüger
f607eb47f6
Rollup merge of #113226 - lqd:win-trys, r=Kobzol
Fix try builds on the msvc builder

Try builds have been optimized to build less components, however bootstrap was still expecting them to be present on msvc. This PR (extracted from https://github.com/rust-lang/rust/pull/112267) fixes that.

r? `@Kobzol`
2023-07-01 13:46:02 +02:00
Matthias Krüger
bcd804ba52
Rollup merge of #113196 - Bryanskiy:assoc_item, r=petrochenkov
Fix associated items effective visibility calculation for type privacy lints

Fixes https://github.com/rust-lang/rust/pull/113126#discussion_r1246555520.
2023-07-01 13:46:02 +02:00
Matthias Krüger
ca7e27a71c
Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obk
Error when RPITITs' hidden types capture more lifetimes than their trait definitions

This implements a stricter set of captures rules for RPITITs. They now may only capture:
1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too)
2. Lifetimes mentioned by the `impl Trait` in the trait method's definition.

Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`.

cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken.
cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.)

Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents.

r? ``@oli-obk``
2023-07-01 13:46:01 +02:00
Matthias Krüger
9082287213
Rollup merge of #113174 - chenyukang:yukang-fix-102972-loop-next, r=compiler-errors
Better messages for next on a iterator inside for loops

Fixes #102972
2023-07-01 13:46:01 +02:00
Matthias Krüger
b63bc0645f
Rollup merge of #113168 - bvanjoi:fix-85992, r=petrochenkov
fix(resolve): skip assertion judgment when NonModule is dummy

Fixes #85992

## Why #85992 panic

During `resolve_imports`, the `path_res` of the import `issue_85992_extern_2::Outcome` is pointing to `external::issue_85992_extern_2` instead of `crate::issue_85992_extern_2`. As a result `import.imported_module.set` had been executed.

Attached 1: the state of `early_resolve_ident_in_lexical_scope` during the `resolve_imports` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` |
| -    | -               | -                                                            |
| init | -               | -                                                            |
| 0    | `CrateRoot`     | Err(Determined)     |
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) |

However, during finalization for `issue_85992_extern_2::Outcome`, the `innermost_result` was pointed to `crate::issue_85992_extern_2` and no ambiguity was generated, leading to a panic.

Attached 2: the state of `early_resolve_ident_in_lexical_scope` during the `finalize_import` for `use issue_85992_extern_2::Outcome` is as follows:

|iter in `visit_scopes`  | `scope` | `result.binding` | `innermost_result` |
| -    | -               | -                                                            | -                     |
| init | -               | -                                                            | `None`                |
| 0    | `CrateRoot`     | pointing to `use crate::issue_85992_extern_2` **(introdcued by dummy)**    | same as `result` but with a `Some` wapper|
| 1    | `ExternPrelude` | pointing to the `issue_85992_extern_2`(external) | smae as above |

## Try to solve

Skip assertion judgment when `NonModule` is dummy

r? `@petrochenkov`
2023-07-01 13:46:00 +02:00
Guillaume Gomez
c607e206be Migrate GUI colors test to original CSS color format 2023-07-01 13:18:28 +02:00
Weihang Lo
80423fd6e7
Update cargo 2023-07-01 11:08:31 +01:00
bors
7905eff5f7 Auto merge of #112550 - loongarch-rs:fix-eflags, r=cjgillot
loongarch: Fix ELF header flags

This patch changes the ELF header flags so that the ABI matches the floating-point features. It also updates the link to the new official documentation.
2023-07-01 09:31:35 +00:00
hi-rustin
878eff1207 Add tests for RustOptimize
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-07-01 16:59:35 +08:00