Commit Graph

236875 Commits

Author SHA1 Message Date
GoodDaisy
0d780b108b fix typos in comments 2023-10-23 20:52:14 +08:00
bors
a56bd2b944 Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillot
Avoid a `track_errors` by bubbling up most errors from `check_well_formed`

I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them.

This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`)

cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23 09:59:40 +00:00
Oli Scherer
fe8ebb1890 Allow ensure queries to return Result<(), ErrorGuaranteed> 2023-10-23 08:20:29 +00:00
bors
6bb4ad6dfb Auto merge of #117071 - matthiaskrgr:rollup-1tcxdgj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105666 (rustdoc: align stability badge to baseline instead of bottom)
 - #117042 (coverage: Emit the filenames section before encoding per-function mappings)
 - #117044 (Miri subtree update)
 - #117049 (add a `csky-unknown-linux-gnuabiv2hf` target )
 - #117051 (fix broken link: update incremental compilation url)
 - #117069 (x.ps1: remove the check for Python from Windows Store)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-23 07:32:55 +00:00
Matthias Krüger
cec7d4a075
Rollup merge of #117069 - xobs:x.ps1-remove-windows-store-check, r=albertlarsan68
x.ps1: remove the check for Python from Windows Store

When installing Python from the Windows Store, a copy of `python.exe` is installed inder the Microsoft directory in the user's local AppData directory. Currently, `x.ps1` checks for this file, because by default running `python.exe` opens a link to the Microsoft Store rather than running Python.

Once the user installs Python, however, this contains a valid interpreter. Unfortuantely, `x.ps1` can't tell the difference between a legitimate Python install and the stub.

Remove the check, as it makes it impossible to use the official version from Microsoft once it has been installed.

This resolves #117067
2023-10-23 08:12:41 +02:00
Matthias Krüger
2636745678
Rollup merge of #117051 - gvozdvmozgu:fix-incremental-compilation-link, r=Nilstrieb
fix broken link: update incremental compilation url
2023-10-23 08:12:41 +02:00
Matthias Krüger
9acb775c50
Rollup merge of #117049 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3
add a `csky-unknown-linux-gnuabiv2hf` target

This is the rustc side changes to support csky based Linux target(`csky-unknown-linux-gnuabiv2`).

Tier 3 policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I pledge to do my best maintaining it.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

This `csky`  section is the arch name and the `unknown-linux` section is the same as other linux target, and `gnuabiv2` is from the  cross-compile toolchain of  `gcc`. the `hf`means hardfloat.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

I think the explanation in platform support doc is enough to make this aspect clear.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

It's using open source tools only.

> The target must not introduce license incompatibilities.

No new license

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Understood.

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

There are no new dependencies/features required.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

As previously said it's using open source tools only.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

There are no such terms present/

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

I'm not the reviewer here.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

I'm not the reviewer here.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

It supports for std

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

I have added the documentation, and I think it's clear.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via ``@)`` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Understood.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Understood.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

I believe I didn't break any other target.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

I think there are no such problems in this PR.
2023-10-23 08:12:40 +02:00
Matthias Krüger
fe4fde24e5
Rollup merge of #117044 - RalfJung:miri, r=RalfJung
Miri subtree update

This should unblock https://github.com/rust-lang/rust/pull/116581
2023-10-23 08:12:40 +02:00
Matthias Krüger
dde77f7a33
Rollup merge of #117042 - Zalathar:file-table, r=cjgillot
coverage: Emit the filenames section before encoding per-function mappings

When embedding coverage information in LLVM IR (and ultimately in the resulting binary), there are two main things that each CGU needs to emit:

- A single `__llvm_covmap` record containing a coverage header, which mostly consists of a list of filenames used by the CGU's coverage mappings.
- Several `__llvm_covfun` records, one for each instrumented function, each of which contains the hash of the list of filenames in the header.

There is a kind of loose cyclic dependency between the two: we need the hash of the file table before we can emit the covfun records, but we need to traverse all of the instrumented functions in order to build the file table.

The existing code works by processing the individual functions first. It lazily adds filenames to the file table, and stores the mostly-complete function records in a temporary list. After this it hashes the file table, emits the header (containing the file table), and then uses the hash to emit all of the function records.

This PR reverses that order: first we traverse all of the functions (without trying to prepare their function records) to build a *complete* file table, and then emit it immediately. At this point we have the file table hash, so we can then proceed to build and emit all of the function records, without needing to store them in an intermediate list.

---

Along the way, this PR makes some necessary changes that are also worthwhile in their own right:
- We split `FunctionCoverage` into distinct collector/finished phases, which neatly avoids some borrow-checker hassles when extracting a function's final expression/mapping data.
- We avoid having to re-sort a function's mappings when preparing the list of filenames that it uses.
2023-10-23 08:12:39 +02:00
Matthias Krüger
e86f9b6fce
Rollup merge of #105666 - notriddle:notriddle/stab-baseline, r=GuillaumeGomez
rustdoc: align stability badge to baseline instead of bottom

| desc | img |
|------|-----|
| before | ![image](https://user-images.githubusercontent.com/1593513/207412598-3a6468ca-a169-4810-a689-4797688385df.png) |
| | |
| after | ![image](https://user-images.githubusercontent.com/1593513/207412720-b120269a-48a3-40e9-a9b0-6769bb05e104.png) |

Preview: http://notriddle.com/notriddle-rustdoc-demos/stab-baseline/test_dingus/index.html

Based on comment from https://github.com/rust-lang/rust/pull/105509#discussion_r1044816673

r? ``@joshtriplett``
2023-10-23 08:12:39 +02:00
bors
aec4741d42 Auto merge of #116606 - ChrisDenton:empty, r=dtolnay
On Windows make `read_dir` error on the empty path

This makes Windows consistent with other platforms. Note that this should not be taken to imply any decision on #114149 has been taken. However it was felt that while there is a lack of libs-api consensus, we should be consistent across platforms in the meantime.

This is a change in behaviour for Windows so will also need an fcp before merging.

r? libs-api
2023-10-23 05:38:33 +00:00
Sean Cross
1f9f041c35 x.ps1: remove the check for Python from Windows Store
When installing Python from the Windows Store, a copy of `python.exe` is
installed inder the Microsoft directory in the user's local AppData
directory. Currently, `x.ps1` checks for this file, because by default
running `python.exe` opens a link to the Microsoft Store rather than
running Python.

Once the user installs Python, however, this contains a valid
interpreter. Unfortuantely, `x.ps1` can't tell the difference between a
legitimate Python install and the stub.

Remove the check, as it makes it impossible to use the official version
from Microsoft once it has been installed.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-10-23 13:25:48 +08:00
bors
62fae2305e Auto merge of #117066 - calebcartwright:rustfmt-sync, r=calebcartwright
rustfmt subtree update

r? `@ghost`

Includes let chain formatting amongst a few other smaller changes and fixes
2023-10-23 02:48:09 +00:00
Caleb Cartwright
35400e8c16 bump rustfmt version 2023-10-22 20:34:12 -05:00
Caleb Cartwright
7650a7542c Merge commit '81fe905ca83cffe84322f27ca43950b617861ff7' into rustfmt-sync 2023-10-22 20:21:44 -05:00
Yacin Tmimi
81fe905ca8 chore: prep v1.7.0 release
bumping from v1.6.0 -> v1.7.0 since we added support for let-chains
2023-10-22 20:18:45 -05:00
Yacin Tmimi
ff3ce6b53c Fix typos and remove merge conflict artifacts from the changelog 2023-10-22 20:18:45 -05:00
Yacin Tmimi
75c7d1daff Add outstanding changelog entries for the next release 2023-10-22 20:18:45 -05:00
bors
111adde7ed Auto merge of #115324 - francorbacho:master, r=davidtwco
Suggest removing redundant arguments in format!()

Closes #105225. This is also a follow-up to #105635, which seems to have become stale.

r? `@estebank`
2023-10-23 00:51:35 +00:00
bors
913ceaee96 Auto merge of #117062 - Kobzol:update-rustc-perf, r=Mark-Simulacrum
Update rustc-perf version

Needed to unblock https://github.com/rust-lang/rust/pull/116033.

The commit first needs to be uploaded to our mirrors.

r? `@Mark-Simulacrum`
2023-10-22 21:57:27 +00:00
bors
54b0434cea Auto merge of #117000 - weihanglo:update-cargo, r=weihanglo
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
2023-10-22 20:02:32 +00:00
Caleb Cartwright
0bb2acf50f
Merge pull request #5944 from calebcartwright/subtree-sync-2023-10-22
sync subtree
2023-10-22 14:07:55 -05:00
Caleb Cartwright
c2515dfa41 tests: fix let chain tests 2023-10-22 13:30:25 -05:00
Caleb Cartwright
75d84974f4 deps: bump bytecount version 2023-10-22 13:15:46 -05:00
bors
6aeac60e5d Auto merge of #117007 - notriddle:notriddle/format-links-with-display, r=fmease
rustdoc: avoid allocating strings primitive link printing

This is aimed at hitting the allocator less in a function that gets called a lot.
2023-10-22 18:06:17 +00:00
Jakub Beránek
41dfebbd17 Update rustc-perf version 2023-10-22 20:04:20 +02:00
Caleb Cartwright
746bf48ec4 chore: bump toolchain and apply minor updates 2023-10-22 12:59:03 -05:00
Caleb Cartwright
f35f25287f Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-10-22 2023-10-22 12:45:06 -05:00
bors
3c92dcc6f3 Auto merge of #117018 - Kobzol:opt-dist-cargo-stage0, r=lqd
Use beta cargo in opt-dist

Using the new stage2 cargo caused issues when a backwards-incompatible change was made to cargo. This means that we won't be testing the LTO/1-CGU optimized cargo, but I don't think that's a big issue, as we primarily want to test the compiler.

Should fix [this](https://github.com/rust-lang/rust/pull/117000#issuecomment-1773639109) failure.
2023-10-22 16:10:03 +00:00
gvozdvmozgu
bb67e0f47b
fix broken link: update incremental compilation url 2023-10-22 07:20:36 -07:00
dirreke
5454797577 tidy docs 2023-10-22 21:47:40 +08:00
dirreke
dc00d03a11 add target csky-unknown-linux-gnuabiv2hf 2023-10-22 21:20:30 +08:00
Zalathar
6af9fef085 coverage: Emit the filenames section before encoding per-function mappings
Most coverage metadata is encoded into two sections in the final executable.
The `__llvm_covmap` section mostly just contains a list of filenames, while the
`__llvm_covfun` section contains encoded coverage maps for each instrumented
function.

The catch is that each per-function record also needs to contain a hash of the
filenames list that it refers to. Historically this was handled by assembling
most of the per-function data into a temporary list, then assembling the
filenames buffer, then using the filenames hash to emit the per-function data,
and then finally emitting the filenames table itself.

However, now that we build the filenames table up-front (via a separate
traversal of the per-function data), we can hash and emit that part first, and
then emit each of the per-function records immediately after building. This
removes the awkwardness of having to temporarily store nearly-complete
per-function records.
2023-10-22 23:17:15 +11:00
bors
9372999916 Auto merge of #116256 - apekros:issue-114912, r=cjgillot
Add test for rust-lang#114912

Closes #114912
2023-10-22 11:57:18 +00:00
Jakub Beránek
823d72abde Pass host triple when running tests in opt-dist 2023-10-22 12:58:35 +02:00
Jakub Beránek
a836fd65f9 Use beta cargo in opt-dist
Using the new cargo caused issues when a backwards-incompatible change was made to cargo.
2023-10-22 12:58:35 +02:00
Zalathar
de4cfbca2e coverage: Encode function mappings without re-sorting them
The main change here is that `VirtualFileMapping` now uses an internal hashmap
to de-duplicate incoming global file IDs. That removes the need for
`encode_mappings_for_function` to re-sort its mappings by filename in order to
de-duplicate them.

(We still de-duplicate runs of identical filenames to save work, but this is
not load-bearing for correctness, so a sort is not necessary.)
2023-10-22 20:37:39 +11:00
Zalathar
88159cafa7 coverage: Encapsulate local-to-global file mappings 2023-10-22 20:37:39 +11:00
Zalathar
e985ae5a45 coverage: Build the global file table ahead of time 2023-10-22 20:37:37 +11:00
Zalathar
86b55cccff coverage: Fetch expressions and mappings separately
The combined `get_expressions_and_counter_regions` method was an artifact of
having to prepare the expressions and mappings at the same time, to avoid
ownership/lifetime problems with temporary data used by both.

Now that we have an explicit transition from `FunctionCoverageCollector` to the
final `FunctionCoverage`, we can prepare any shared data during that step and
store it in the final struct.
2023-10-22 20:11:48 +11:00
Zalathar
371883a05a coverage: Split FunctionCoverage into distinct collector/finished phases
This gives us a clearly-defined place to run code after the instance's MIR has
been traversed by codegen, but before we emit its `__llvm_covfun` record.
2023-10-22 20:11:45 +11:00
bors
724ba7fe90 Auto merge of #117041 - matthiaskrgr:rollup-b18h0ln, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #116985 (Use gdb.ValuePrinter tag class)
 - #116989 (Skip test if Unix sockets are unsupported)
 - #117034 (Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint)
 - #117037 (rustdoc book doc example error)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-22 08:09:40 +00:00
bors
f35c36af19 Auto merge of #3135 - RalfJung:nonatomic-clock, r=RalfJung
avoid AtomicU64 when a Cell is enough
2023-10-22 07:20:06 +00:00
Matthias Krüger
77d8a73fa2
Rollup merge of #117037 - csditchfield:fix_doc_writing_result_example, r=notriddle
rustdoc book doc example error

closes #117036

This is the minimal change required to make the second what-to-include.md example valid.
Another more modern solution could be considered:
```
/// Example
/// ```rust
/// let fortytwo = "42".parse::<u32>()?;
/// println!("{} + 10 = {}", fortytwo, fortytwo+10);
/// #     Ok::<(), <u32 as std::str::FromStr>::Err>(())
/// ```
```
2023-10-22 09:15:43 +02:00
Matthias Krüger
4681eb6c94
Rollup merge of #117034 - Nadrieril:fix-117033, r=cjgillot
Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint

Oops

Fixes https://github.com/rust-lang/rust/issues/117033
2023-10-22 09:15:42 +02:00
Matthias Krüger
4d80740c1d
Rollup merge of #116989 - ChrisDenton:skip-unsupported, r=Mark-Simulacrum
Skip test if Unix sockets are unsupported

Fixes https://github.com/rust-lang/rust/pull/116683#issuecomment-1772314187

The test will be skipped if `AF_UNIX` is not supported. In that case [`WSASocketW` returns `WSAEAFNOSUPPORT`](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw#return-value).

It will never skip the test when run in CI but maybe this is me being too defensive since the error code is narrowly scoped to just the af family parameter being unsupported?

Also fixed a minor typo.

r? `@Mark-Simulacrum`
2023-10-22 09:15:42 +02:00
Matthias Krüger
56b9f0327f
Rollup merge of #116985 - tromey:rust-printers-14, r=Mark-Simulacrum
Use gdb.ValuePrinter tag class

GDB 14 has a "gdb.ValuePrinter" tag class that was introduced to let GDB evolve the pretty-printer API.  Users of this tag are required to hide any local attributes or methods.  This patch makes this change to the Rust pretty-printers.  At present this is just a cleanup, providing the basis for any future changes.
2023-10-22 09:15:41 +02:00
Ralf Jung
b53c34f7b8 avoid AtomicU64 when a Cell is enough 2023-10-22 08:43:57 +02:00
bors
f6be93fc61 Auto merge of #3133 - rust-lang:rustup-2023-10-22, r=RalfJung
Automatic Rustup
2023-10-22 06:42:10 +00:00
Ralf Jung
8cbac823d0 clippy 2023-10-22 08:40:37 +02:00