Commit graph

258918 commits

Author SHA1 Message Date
bors d371d17496 Auto merge of #126900 - matthiaskrgr:rollup-24ah97b, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #125241 (Add `rust_analyzer` as a predefined tool)
 - #126213 (Update docs for AtomicBool/U8/I8 with regard to alignment)
 - #126414 (Tier 2 std support must always be known)
 - #126882 (Special case when a code line only has multiline span starts)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-24 13:42:05 +00:00
bors 863179081e Auto merge of #12986 - Alexendoo:cache-lintcheck-bin, r=flip1995
Cache lintcheck binary in ci

Always trims ~40s off the `diff` job as it no longer needs to install the rust toolchain or compile lintcheck. Saves a further ~20s for the `base`/`head` jobs when the cache is warm

It now uses artifacts for restoring the JSON between jobs as per https://github.com/rust-lang/rust-clippy/pull/10398#discussion_r1642364392, cc `@flip1995`

The lintcheck changes are to make `./target/debug/lintcheck` work, running `cargo-clippy`/`clippy-driver` directly doesn't work without `LD_LIBRARY_PATH`/etc being set which is currently being done by `cargo run`. By merging the `--recursive` and normal cases to both go via regular `cargo check` we can have Cargo set up the environment for us

r? `@xFrednet`

changelog: none
2024-06-24 13:23:51 +00:00
Matthias Krüger 8ffb5f936a compiletest: make the crash test error message abit more informative 2024-06-24 15:18:50 +02:00
Vadim Petrochenkov 8c718e5524 ast: Standardize visiting order for attributes and node IDs 2024-06-24 16:08:51 +03:00
Vadim Petrochenkov 0195758c1a ast: Standardize visiting order for attributes and node IDs 2024-06-24 16:08:51 +03:00
Matthias Krüger a80ee9159b
Rollup merge of #126882 - estebank:multiline-order, r=WaffleLapkin
Special case when a code line only has multiline span starts

Minimize multline span overlap when there are multiple of them starting on the same line:

```
3 |       X0 Y0 Z0
  |  _____^  -  -
  | | _______|  |
  | || _________|
4 | |||   X1 Y1 Z1
5 | |||   X2 Y2 Z2
  | |||____^__-__- `Z` label
  | ||_____|__|
  | |______|  `Y` is a good letter too
  |        `X` is a good letter
```
2024-06-24 15:06:23 +02:00
Matthias Krüger 8bfde609e2
Rollup merge of #126414 - ChrisDenton:target-known, r=Nilstrieb
Tier 2 std support must always be known

We should never have a tier 2 target without knowing its support status so I think this line in the tier 2 section is a bit wrong:

> ? indicates the standard library support is unknown or a work-in-progress.

My first inclination was just to drop the "unknown or" part. However, after thinking about it some more, I think we should just use `✓` for this. The only affected targets are UEFI and frankly there are targets with worse std support that are marked with `✓` (e.g. wasm).

I think a `✓` should mean "this supports building with std (and is checked in CI for tier 2+)". The target errata can detail the current limitations or special requirements for doing so.
2024-06-24 15:06:22 +02:00
Matthias Krüger 94b9ea417d
Rollup merge of #126213 - zachs18:atomicbool-u8-i8-from-ptr-alignment, r=Nilstrieb
Update docs for AtomicBool/U8/I8 with regard to alignment

Fixes #126084.

Since `AtomicBool`/`AtomicU8`/`AtomicI8` are guaranteed to have size == 1, and Rust guarantees that `size % align == 0`, they also must have alignment equal to 1, so some current docs are contradictory/confusing when describing their alignment requirements.

Specifically:

* Fix `AtomicBool::from_ptr` claiming that `align_of::<AtomicBool>() > align_of::<bool>()` on some platforms. (same for `AtomicU8::from_ptr`/`AtomicI8::from_ptr`)
* Explicitly state that `AtomicU8`/`AtomicI8` have the same alignment as `u8`/`i8` (in addition to size and bit validity)
* (internal) Change the `if_not_8_bit` macro to be `if_8_bit` and to allow an "if-else"-like structure, instead of just "if"-like.

---

I opted to leave the "`ptr` must be aligned" wording in `from_ptr`'s docs and just clarify that it is always satsified, instead of just removing the wording entirely. If that is instead preferred I can do that.
2024-06-24 15:06:21 +02:00
Matthias Krüger 9d24ecc37b
Rollup merge of #125241 - Veykril:tool-rust-analyzer, r=davidtwco
Add `rust_analyzer` as a predefined tool

Given all the other rust-lang tools have it, I'd expect r-a to have it too. (we have a few ideas for using this https://github.com/rust-lang/rust-analyzer/issues/11556).
2024-06-24 15:06:21 +02:00
Pavel Grigorenko ba5ec1fc5c Suggest inline const blocks for array initialization 2024-06-24 15:30:24 +03:00
bors 06c072f158 Auto merge of #126788 - GuillaumeGomez:migrate-rustdoc-tests-syntax, r=fmease,oli-obk
Migrate rustdoc tests syntax to `//@` (for coherency)

Part of #125813.

cc `@jieyouxu`
r? `@fmease`

try-job: aarch64-apple
2024-06-24 11:29:33 +00:00
Zalathar 1852141219 coverage: Bless coverage attribute tests 2024-06-24 20:15:03 +10:00
Zalathar b7c057c9b2 coverage: Always error on #[coverage(..)] in unexpected places
This upgrades some warnings to errors, and also catches cases where the
attribute was silently ignored.
2024-06-24 20:15:03 +10:00
Zalathar a000fa8b54 coverage: Tighten validation of #[coverage(off)] and #[coverage(on)] 2024-06-24 20:15:01 +10:00
Zalathar b5dfeba0e1 coverage: Forbid multiple #[coverage(..)] attributes
It might make sense to allow this in the future, if we add values that aren't
mutually exclusive, but for now having multiple coverage attributes on one item
is useless.
2024-06-24 20:10:35 +10:00
Guillaume Gomez 6909feab8e Allow numbers in rustdoc tests commands 2024-06-24 11:10:18 +02:00
Guillaume Gomez 4e258bb4c3 Fix tidy issue for rustdoc tests commands 2024-06-24 11:10:18 +02:00
Guillaume Gomez 51fedf65ff Remove commands duplication between compiletest and tests/rustdoc 2024-06-24 11:10:17 +02:00
Guillaume Gomez 1b67035579 Update tests/rustdoc to new test syntax 2024-06-24 11:08:41 +02:00
Guillaume Gomez d3ec92e16e Move tests/rustdoc testsuite to //@ syntax 2024-06-24 11:08:41 +02:00
Trevor Gross 0314fe62bd Reword docs for f32 and f64
Better explain the reasoning for the `next_up`/`next_down` integer
implementation, as requested by Ralf.
2024-06-24 00:42:21 -05:00
Trevor Gross fce07a82c6 Extract repeated constants from f32 and f64 source
This will make it easier to keep `f16` and `f128` consistent as their
implementations get added.
2024-06-24 00:42:21 -05:00
bors 2c243d9570 Auto merge of #126891 - matthiaskrgr:rollup-p6dl1gk, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126177 (Add hard error and migration lint for unsafe attrs)
 - #126298 (Promote loongarch64-unknown-linux-musl to Tier 2 with host tools)
 - #126455 (For [E0308]: mismatched types, when expr is in an arm's body, not add semicolon ';' at the end of it.)
 - #126754 (Implement `use<>` formatting in rustfmt)
 - #126807 (std::unix::fs: copy simplification for apple.)
 - #126845 (Weekly `cargo update`)
 - #126849 (Fix 32-bit Arm reg classes by hierarchically sorting them)
 - #126854 (std::unix::os::home_dir: fallback's optimisation.)
 - #126888 (Remove stray println from rustfmt's `rewrite_static`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-24 05:06:31 +00:00
Matthias Krüger b94d2754b5
Rollup merge of #126888 - compiler-errors:oops-debug-printing, r=dtolnay
Remove stray println from rustfmt's `rewrite_static`

r? `@calebcartwright` `@ytmimi` -- though anyone should probably r+ this so it gets into nightly sooner than later, since it's obviously wrong.

This can just be fixed in-tree, since I don't think we want to wait until the next sync to fix this.

Fix https://github.com/rust-lang/rustfmt/issues/6210
Fix https://github.com/rust-lang/rust/issues/126887
2024-06-24 06:27:17 +02:00
Matthias Krüger 9892b3e9fe
Rollup merge of #126854 - devnexen:std_unix_os_fallback_upd, r=Mark-Simulacrum
std::unix::os::home_dir: fallback's optimisation.

we're using a guaranteed initialised field on success.
2024-06-24 06:27:16 +02:00
Matthias Krüger 3108dfaced
Rollup merge of #126849 - workingjubilee:correctly-classify-arm-low-dregs, r=Amanieu
Fix 32-bit Arm reg classes by hierarchically sorting them

We were rejecting legal `asm!` because we were asking for the "greatest" feature that includes a register class, instead of the "least" feature that includes a register class. This was only revealed on certain 32-bit Arm targets because not all have the same register limitations.

This is a somewhat hacky solution, but other solutions would require potentially rearchitecting how the internals of parsing or rejecting register classes work for all targets.

Fixes #126797

r​? ``@Amanieu``
2024-06-24 06:27:16 +02:00
Matthias Krüger dcace866f0
Rollup merge of #126845 - rust-lang:cargo_update, r=Mark-Simulacrum
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt
     Locking 9 packages to latest compatible versions
    Updating clap_complete v4.5.5 -> v4.5.6
    Updating displaydoc v0.2.4 -> v0.2.5
    Removing icu_collections v1.5.0
    Removing icu_normalizer v1.5.0
    Removing icu_normalizer_data v1.5.0
    Removing icu_properties v1.5.0
    Removing icu_properties_data v1.5.0
 Downgrading idna v1.0.0 -> v0.5.0 (latest: v1.0.1)
    Updating lazy_static v1.4.0 -> v1.5.0
    Updating miniz_oxide v0.7.3 -> v0.7.4
    Updating proc-macro2 v1.0.85 -> v1.0.86
    Updating syn v2.0.66 -> v2.0.67
      Adding unicode-bidi v0.3.15
    Updating url v2.5.1 -> v2.5.2
    Removing utf16_iter v1.0.5
    Removing utf8_iter v1.0.4
    Removing write16 v1.0.0
note: pass `--verbose` to see 85 unchanged dependencies behind latest
```
2024-06-24 06:27:15 +02:00
Matthias Krüger 21850f5bd8
Rollup merge of #126807 - devnexen:copy_file_macos_simpl, r=Mark-Simulacrum
std::unix::fs: copy simplification for apple.

since we do support from macOs Sierra, we avoid the little runtime overhead with the fclonefileat symbol check.
2024-06-24 06:27:14 +02:00
Matthias Krüger b24e3df0df
Rollup merge of #126754 - compiler-errors:use-rustfmt, r=calebcartwright
Implement `use<>` formatting in rustfmt

This PR implements formatting for precise-capturing `use<>` syntax as proposed in https://github.com/rust-lang/rust/pull/126753.

The syntax is implemented as-if the `use<>` bound were a trait bound but with the `use` keyword as its path segment identifier.

I opted to develop this in the rust-lang/rust tree since I'm not certain when the next rustfmt subtree sync is going to be, and I'd rather not block landing nightly support for `use<>` on something I have no control over. If ``@rust-lang/rustfmt`` would rather I move this PR over to that repository, then I would at least like to know when the next rustfmt->rust subtree sync is going to be, since stabilizing `precise_capturing` without formatting will be disruptive.

This implementation is otherwise rather straightforward.

Tracking:

- https://github.com/rust-lang/rust/issues/123432
2024-06-24 06:27:14 +02:00
Matthias Krüger ad0531ae0d
Rollup merge of #126455 - surechen:fix_126222, r=estebank
For [E0308]: mismatched types, when expr is in an arm's body, not add semicolon ';' at the end of it.

For [E0308]: mismatched types, when expr is in an arm's body, and it is the end expr without a semicolon of the block, not add semicolon ';' at the end of it.

fixes #126222

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-24 06:27:13 +02:00
Matthias Krüger 7babf99ea9
Rollup merge of #126298 - heiher:loongarch64-musl-ci, r=Mark-Simulacrum
Promote loongarch64-unknown-linux-musl to Tier 2 with host tools

MCP: https://github.com/rust-lang/compiler-team/issues/753
Tracking issue: https://github.com/rust-lang/rust/issues/122592

try-job: dist-loongarch64-musl
2024-06-24 06:27:13 +02:00
Matthias Krüger 9a591ea1ce
Rollup merge of #126177 - carbotaniuman:unsafe_attr_errors, r=jieyouxu
Add hard error and migration lint for unsafe attrs

More implementation work for https://github.com/rust-lang/rust/issues/123757

This adds the migration lint for unsafe attributes, as well as making it a hard error in Rust 2024.
2024-06-24 06:27:12 +02:00
Esteban Küber a2298a6f19 Do not ICE when suggesting dereferencing closure arg
Account for `for` lifetimes when constructing closure to see if dereferencing the return value would be valid.

Fix #125634, fix #124563.
2024-06-24 03:39:54 +00:00
Michael Goulet 25446c25fc Remove stray println from rustfmt 2024-06-23 22:27:41 -04:00
David Tolnay 35ec4eb354 Rename the 2 unambiguous precedence levels to PREC_UNAMBIGUOUS 2024-06-23 18:31:47 -07:00
David Tolnay 273447cec7
Rename the 2 unambiguous precedence levels to PREC_UNAMBIGUOUS 2024-06-23 18:31:47 -07:00
David Tolnay 8cfd4b180b
Unify the precedence level for PREC_POSTFIX and PREC_PAREN 2024-06-23 18:29:51 -07:00
bors d49994b060 Auto merge of #126023 - amandasystems:you-dropped-this-again, r=nikomatsakis
Remove confusing `use_polonius` flag and do less cloning

The `use_polonius` flag is both redundant and confusing since every function it's propagated to also checks if `all_facts` is `Some`, the true test of whether to generate Polonius facts for Polonius or for external consumers. This PR makes that path clearer by simply doing away with the argument and handling the logic in precisely two places: where facts are populated (check for `Some`), and where `all_facts` are initialised. It also delays some statements until after that check to avoid the miniscule performance penalty of executing them when Polonius is disabled.

This also addresses `@lqd's` concern in #125652 by reducing the size of what is cloned out of Polonius facts to just the facts being added, as opposed to the entire vector of potential inputs, and added descriptive comments.

*Reviewer note*: the comments in `add_extra_drop_facts` should be inspected by a reviewer, in particular the one on [L#259](https://github.com/rust-lang/rust/compare/master...amandasystems:you-dropped-this-again?expand=1#diff-aa727290e6670264df2face84f012897878e11a70e9c8b156543cfcd9619bac3R259) in this PR, which should be trivial for someone with the right background knowledge to address.

I also included some lints I found on the way there that I couldn't help myself from addressing.
2024-06-24 00:24:51 +00:00
carbotaniuman a23917cfd0 Add hard error and migration lint for unsafe attrs 2024-06-23 19:02:14 -05:00
Nicholas Nethercote aa30dd444b Fix a typo in a comment. 2024-06-24 09:44:19 +10:00
Esteban Küber 284437d434 Special case when a code line only has multiline span starts
```
3 |       X0 Y0 Z0
  |  _____^  -  -
  | | _______|  |
  | || _________|
4 | |||   X1 Y1 Z1
5 | |||   X2 Y2 Z2
  | |||____^__-__- `Z` label
  | ||_____|__|
  | |______|  `Y` is a good letter too
  |        `X` is a good letter
```
2024-06-23 22:00:52 +00:00
bors bcf94dec5b Auto merge of #126878 - matthiaskrgr:rollup-oufemqp, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126230 (tidy: skip submodules if not present for non-CI environments)
 - #126612 (Update outdated README in build-manifest.)
 - #126616 (less bootstrap warnings)
 - #126663 (remove `GIT_DIR` handling in pre-push hook)
 - #126830 (make unsized_fn_params an internal feature)
 - #126833 (don't ICE when encountering an extern type field during validation)
 - #126837 (delegation: Do not crash on qpaths without a trait)
 - #126851 (Rework pattern and expression nonterminal kinds.)
 - #126862 (Add needs-symlink directive to compiletest)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-23 21:23:55 +00:00
Matthias Krüger e4f102d174
Rollup merge of #126862 - ChrisDenton:needs-symlink, r=jieyouxu
Add needs-symlink directive to compiletest

This is an alternative to #126846 that allows running symlink tests on Windows in CI but will ignore them locally if symlinks aren't available. A future improvement would be to check that the `needs-symlink` directive is used in rmake files that call `create_symlink` but this is just a quick PR to unblock Windows users who want to run tests locally without enabling symlinks.
2024-06-23 22:39:02 +02:00
Matthias Krüger 0149bc47d8
Rollup merge of #126851 - nnethercote:NtExprKind-NtPatKind, r=compiler-errors
Rework pattern and expression nonterminal kinds.

Some tweaks to `NonterminalKind` that will assist with #124141. Details in the individual commits.

r? compiler-errors
cc ```@eholk```
2024-06-23 22:39:01 +02:00
Matthias Krüger 2c0311dbbe
Rollup merge of #126837 - petrochenkov:delegfix, r=compiler-errors
delegation: Do not crash on qpaths without a trait

Fixes https://github.com/rust-lang/rust/issues/126742
2024-06-23 22:39:01 +02:00
Matthias Krüger a9959bd1ab
Rollup merge of #126833 - RalfJung:extern-type-field-ice, r=compiler-errors
don't ICE when encountering an extern type field during validation

"extern type" is a pain that keeps on giving...

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

r? ```@oli-obk```
2024-06-23 22:39:00 +02:00
Matthias Krüger 0a7adafe4f
Rollup merge of #126830 - RalfJung:unsized-fn-params, r=compiler-errors
make unsized_fn_params an internal feature

As suggested [here](https://github.com/rust-lang/rust/pull/123894#issuecomment-2054043053).
r? `@compiler-errors`

Fixes https://github.com/rust-lang/rust/issues/123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
2024-06-23 22:39:00 +02:00
Matthias Krüger 6736641146
Rollup merge of #126663 - onur-ozkan:gitdir-thing, r=Mark-Simulacrum
remove `GIT_DIR` handling in pre-push hook

This is already handled from bootstrap: a1ca449981/src/bootstrap/src/utils/helpers.rs (L504-L506)
2024-06-23 22:38:59 +02:00
Matthias Krüger 4a3863e7e3
Rollup merge of #126616 - onur-ozkan:less-warnings, r=Mark-Simulacrum
less bootstrap warnings

This is how the build logs looks like currently:

```sh
$ x build
Building bootstrap
   Compiling bootstrap v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/bootstrap)
    Finished `dev` profile [unoptimized] target(s) in 3.43s
WARNING: no codegen-backends config matched the requested path to build a codegen backend. HELP: add backend to codegen-backends in config.toml.
WARNING: creating symbolic link `/home/nimda/devspace/.other/rustc-builds/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/rustc-src/rust` to `/home/nimda/devspace/onur-ozkan/rust` failed with File exists (os
error 17)
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
WARNING: creating symbolic link `/home/nimda/devspace/.other/rustc-builds/build/x86_64-unknown-linux-gnu/ci-rustc-sysroot/lib/rustlib/rustc-src/rust` to `/home/nimda/devspace/onur-ozkan/rust` failed with File e
xists (os error 17)
Building tool rustdoc (stage1 -> stage2, x86_64-unknown-linux-gnu)
   Compiling rustdoc v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/librustdoc)
   Compiling rustdoc-tool v0.0.0 (/home/nimda/devspace/onur-ozkan/rust/src/tools/rustdoc)
    Finished `release` profile [optimized + debuginfo] target(s) in 13.57s
Build completed successfully in 0:00:17
```

This PR removes artifact linking warnings and only shows the codegen-backend warning if explicitly called or during Dist or Install steps.
2024-06-23 22:38:59 +02:00
Matthias Krüger 0eff9fb05a
Rollup merge of #126612 - ehuss:build-manifest-readme, r=Mark-Simulacrum
Update outdated README in build-manifest.

I believe this was changed a while ago in https://github.com/rust-lang/promote-release/pull/14.
2024-06-23 22:38:58 +02:00