Commit Graph

228133 Commits

Author SHA1 Message Date
Alex Touchet
7bb9de87f6
Use consistent formatting in Readme 2023-07-01 21:14:20 -07: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
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
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
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
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
Rémy Rakic
a158053e35 msvc dist extended: rust-analyzer is optional
The windows tarballs and installers expect rust-analyzer to be present, but
it's not always the case. For example, in try builds.
2023-07-01 07:58:55 +00:00
Rémy Rakic
8a4a6f79dd msvc dist extended: clippy is optional
The windows tarballs and installers expect clippy to be present, but
it's not always the case. For example, in try builds.
2023-07-01 07:55:33 +00:00
Caleb Cartwright
75a6675bc9 update rustfmt version in lockfile 2023-07-01 02:50:52 -05:00
Caleb Cartwright
80ab662420 Merge commit 'dca1cf90ad6b8e45afbed2061803befbb2d159e9' into sync-rustfmt 2023-07-01 02:49:12 -05:00
Caleb Cartwright
dca1cf90ad chore: prep v1.6.0 release 2023-07-01 02:40:21 -05:00
bors
e5bb341f0e Auto merge of #111992 - ferrocene:pa-panic-abort-tests-bench, r=m-ou-se
Test benchmarks with `-Z panic-abort-tests`

During test execution, when a `#[bench]` benchmark is encountered it's executed once to check whether it works. Unfortunately that was not compatible with `-Z panic-abort-tests`: the feature works by spawning a subprocess for each test, which prevents the use of dynamic tests as we cannot pass closures to child processes, and before this PR the conversion from benchmark to test was done by turning benchmarks into dynamic tests whose closures execute the benchmark once.

The approach this PR took was to add two new kinds of `TestFn`s: `StaticBenchAsTestFn` and `DynBenchAsTestFn` (⚠️ **this is a breaking change** ⚠️). With that change, a `StaticBenchFn` can be converted into a `StaticBenchAsTestFn` without creating dynamic tests, and making it possible to test `#[bench]` functions with `-Z panic-abort-tests`. The subprocess test runner also had to be updated to perform the conversion from benchmark to test when appropriate.

Along with the bug fix, in the first commit I refactored how tests are executed: rather than executing the test function in multiple places across `libtest`, there is now a private `TestFn::into_runnable()` method, which returns either a `RunnableTest` or `RunnableBench`, on which you can call the `run()` method. This simplified the rest of the changes in the PR.

This PR is best reviewed commit-by-commit.
Fixes https://github.com/rust-lang/rust/issues/73509
2023-07-01 07:07:50 +00:00
Caleb Cartwright
3045c03b22 deps: bump proc-macro2 in config 2023-07-01 02:05:29 -05:00
Caleb Cartwright
23f48d9bb3 deps: bump proc-macro2 and toolchain 2023-07-01 02:05:29 -05:00
Maybe Waffle
aa691480c0 Implement become expression formatting in rustfmt 2023-07-01 02:05:29 -05:00
Yacin Tmimi
1de65a2711 wrap else to next line if let-else pattern is multi-lined
This rule wasn't explicity stated in the style guide so it was missed,
but luckily we caught it during testing.
2023-07-01 01:06:35 -05:00
Yacin Tmimi
7b4e8a6d31 update else_block_exceeds_width calculation in let-else rewrite
By reversing the logic I felt that the code became a clearer. Also,
added a comment to make it clear that we need to take the trailing
semicolon for the `let-else` statement into account.
2023-07-01 01:06:35 -05:00
Yacin Tmimi
fe8b72d98e implement single_line_let_else_max_width
This allows users to configure the maximum length of a single line
`let-else` statements. `let-else` statements that otherwise meet the
requirements to be formatted on a single line will have their divergent
`else` block formatted over multiple lines if they exceed this length.

**Note**: `single_line_let_else_max_widt` will be introduced as a stable
configuration option.
2023-07-01 01:06:35 -05:00
bors
6b06fdfcd4 Auto merge of #113194 - lu-zero:intrinsics-inline, r=thomcc
Mark wrapped intrinsics as inline(always)

This should mitigate having the inliner decide not to inline when the architecture is lacking an implementation of
TargetTransformInfo::areInlineCompatible aware of the target features (e.g. PowerPC as today).

See https://github.com/rust-lang/stdarch/pull/1443#issuecomment-1613788080
2023-07-01 04:24:26 +00:00
bohan
549f48d0ed fix(resolve): skip assertion judgment when NonModule is dummy 2023-07-01 11:53:31 +08:00
bors
7383ab7378 Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errors
change snapshot tracking in fulfillment contexts

use the exact snapshot number to prevent misuse even when created inside of a snapshot
2023-07-01 01:53:10 +00:00
bors
e013d8f8b3 Auto merge of #113216 - matthiaskrgr:rollup-8xe65sj, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113072 (str docs: remove "Basic usage" text where not useful)
 - #113153 (make HashMap::or_insert_with example more simple)
 - #113185 (Set `channel = nightly` in dist profile)
 - #113186 (document that the panic in collect_intra_doc_links is load-bearing)
 - #113187 (No need to distinguish `LocalTy` from `Ty`)
 - #113189 (compiletest: Only trim the end of process output)
 - #113191 (Update browser-ui-test version and improve GUI test)
 - #113206 (User may want to skip tidy check sometimes)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-30 22:40:34 +00:00
Matthias Krüger
58a61eea89
Rollup merge of #113206 - chenyukang:yukang-trivial-fix-113135, r=Kobzol
User may want to skip tidy check sometimes

Fixes #113135
2023-07-01 00:35:08 +02:00
Matthias Krüger
626e1ea63c
Rollup merge of #113191 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Update browser-ui-test version and improve GUI test

Few small fixes and added new commands which allow to compare elements size.

r? ``@notriddle``
2023-07-01 00:35:07 +02:00
Matthias Krüger
00efc94a6c
Rollup merge of #113189 - Zalathar:trim-end, r=ozkanonur
compiletest: Only trim the end of process output

As of #94196, compiletest automatically trims process stderr/stdout output before printing it, to make failure info more compact.

This causes the first line of `run-coverage` output to be displayed incorrectly, because it uses leading whitespace to align line numbers.

Trimming only the end of the output string should still have the intended effect (e.g. removing trailing newlines), without causing problems for output that deliberately uses leading whitespace on the first line.

## Before
```
--- stdout -------------------------------
1|      1|fn main() { //
    2|      1|    let num = 9;
    3|      1|    while num >= 10 {
    4|      0|    }
    5|      1|}
------------------------------------------
stderr: none
```

## After
```
--- stdout -------------------------------
    1|      1|fn main() { //
    2|      1|    let num = 9;
    3|      1|    while num >= 10 {
    4|      0|    }
    5|      1|}
------------------------------------------
stderr: none
```
2023-07-01 00:35:07 +02:00
Matthias Krüger
e1165300e8
Rollup merge of #113187 - compiler-errors:local-ty, r=b-naber
No need to distinguish `LocalTy` from `Ty`

I think the distinction between `decl_ty` and `revealed_ty` was from when you were allowed to put `impl Trait` in let bindings... I don't think we need that anymore, and it makes typeck that much more confusing 😆

Side-note: I don't know why we store this in a separate field [`locals`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/struct.Inherited.html#structfield.locals) in `Inherited`, rather than just the `TypeckResults`... Might look into changing that next.
2023-07-01 00:35:06 +02:00
Matthias Krüger
e823969573
Rollup merge of #113186 - jyn514:intra-doc-panic, r=petrochenkov
document that the panic in collect_intra_doc_links is load-bearing

r? ``@petrochenkov``
2023-07-01 00:35:06 +02:00
Matthias Krüger
a2c18616e3
Rollup merge of #113185 - jyn514:dist-channel, r=ozkanonur
Set `channel = nightly` in dist profile

This avoids some channel-specific defaults leaking into local installs. It also makes it easier to set options for compiler/library/codegen profiles in the future, since they can be gated off `channel` instead of being duplicated between all three files.

Here are the exact things `channel` controls today:
68d458bb40/src/bootstrap/llvm.rs (L466-L470)
85c4ea0138/src/bootstrap/config.rs (L1374-L1375)
85c4ea0138/src/bootstrap/config.rs (L1464-L1465)
``@cuviper`` i expect you don't want any of those to be set in distro builds, right?
2023-07-01 00:35:05 +02:00
Matthias Krüger
709f184593
Rollup merge of #113153 - tshepang:patch-6, r=cuviper
make HashMap::or_insert_with example more simple
2023-07-01 00:35:05 +02:00
Matthias Krüger
4e8f1357b8
Rollup merge of #113072 - tshepang:patch-1, r=cuviper
str docs: remove "Basic usage" text where not useful

Not "useful" in that there is only one example given
2023-07-01 00:35:04 +02:00
bors
f4b80cacf9 Auto merge of #113200 - ferrocene:pa-fix-mir-opt-bless, r=oli-obk
Fix loading target specs in compiletest not working with custom targets

In https://github.com/rust-lang/rust/pull/112454#issuecomment-1611351168 it was pointed out that the PR broke blessing mir-opt tests. Since #112418, blessing mir-opt tests generates "synthetic targets", which are custom target specs. Those specs are not included in `--print=all-target-specs-json`, and #112454 required that the current target was returned by that flag.

This PR fixes the breakage by loading the target spec for the current target explicitly, if a custom target is detected.

r? `@oli-obk`
2023-06-30 15:02:46 +00:00
Pietro Albini
00cc815e57
fix loading target specs in compiletest not working with custom targets 2023-06-30 14:36:14 +02:00
Bryanskiy
f9a4db7312 Fix associated items effective visibility calculation for type privacy lints 2023-06-30 15:00:24 +03:00
bors
56d507dc92 Auto merge of #109524 - bzEq:aix-embed-llvmbc, r=nagisa
Support embedding LLVM bitcode on AIX
2023-06-30 11:39:58 +00:00
Luca Barbato
528f11c24b Mark wrapped intrinsics as inline(always)
This should mitigate having the inliner decide not to inline when
the architecture is lacking an implementation of
TargetTransformInfo::areInlineCompatible aware of the target
features (e.g. PowerPC as today).
2023-06-30 12:07:21 +02:00
Guillaume Gomez
60c657f73a Improve search-result-display.goml test 2023-06-30 11:45:42 +02:00
Guillaume Gomez
f748aa5634 Update browser-ui-test version to 0.16.8 2023-06-30 11:45:37 +02:00
bors
af9df2fd91 Auto merge of #106619 - agausmann:avr-object-file, r=nagisa
Fix unset e_flags in ELF files generated for AVR targets

Closes #106576

~~Sort-of blocked by gimli-rs/object#500~~ (merged)

I'm not sure whether the list of AVR CPU names is okay here. Maybe it could be moved out-of-line to improve the readability of the function.
2023-06-30 08:55:56 +00:00
Zalathar
115cfda6c2 compiletest: Only trim the end of process output 2023-06-30 17:41:34 +10:00
yukang
cfa1a79009 User may want to skip tidy check sometimes 2023-06-30 15:37:10 +08:00
yukang
4189faa21e add typecheck for iterator 2023-06-30 14:50:27 +08:00
bors
b4591cb04c Auto merge of #113188 - matthiaskrgr:rollup-j3abaks, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107624 (Stabilize `const_cstr_methods`)
 - #111403 (suggest `slice::swap` for `mem::swap(&mut x[0], &mut x[1])` borrowck error)
 - #113071 (Account for late-bound vars from parent arg-position impl trait)
 - #113165 (Encode item bounds for `DefKind::ImplTraitPlaceholder`)
 - #113171 (Properly implement variances_of for RPITIT GAT)
 - #113177 (Use structured suggestion when telling user about `for<'a>`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-30 06:31:57 +00:00