1
Fork 0
Commit graph

273912 commits

Author SHA1 Message Date
Zalathar
d4005b6811 Rename tests/ui/coverage-attr/no-coverage.rs to allowed-positions.rs 2024-12-25 11:40:39 +11:00
bors
a92c3cf04d Auto merge of #134722 - ChrisDenton:trunc, r=Amanieu
Windows: Use FILE_ALLOCATION_INFO for truncation

We use `FILE_END_OF_FILE_INFO` here only because WINE does not support `FILE_ALLOCATION_INFO`. Instead of going with the one with broadest support, let's just use that as fallback only.
2024-12-24 22:00:05 +00:00
bors
409998c4e8 Auto merge of #134333 - daxpedda:stdarch-bump, r=daxpedda
Bump `stdarch`

This bumps `stdarch` to 684de0d6fe to get in https://github.com/rust-lang/stdarch/pull/1677 (tracked in https://github.com/rust-lang/rust/issues/133908).

From the [commit history](e5e00aab0a...684de0d6fe) I deduced that there shouldn't be any changes to Rust necessary.

From past PRs I'm assuming that bumping `stdarch` like this is fine, but please let me know if this is somehow inappropriate or requires something more to be done!

try-job: arm-android
try-job: armhf-gnu
2024-12-24 19:19:48 +00:00
daxpedda
374800b88d
Bump stdarch 2024-12-24 19:00:57 +01:00
bors
d53b0ff6b5 Auto merge of #134724 - onur-ozkan:type-improvements, r=jieyouxu
improve type mutation for certain structures

self-explanatory
2024-12-24 16:40:11 +00:00
onur-ozkan
6b2fd4f234 improve type mutation for certain structures
self-explanatory

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-12-24 13:42:46 +00:00
Chris Denton
ca56dc8537
Windows: Use FILE_ALLOCATION_INFO for truncation
But fallback to FILE_END_OF_FILE_INFO for WINE
2024-12-24 11:04:12 +00:00
bors
32c8a9f49d Auto merge of #134513 - fudancoder:master, r=jieyouxu
Fix some typos
2024-12-24 06:12:04 +00:00
fudancoder
e97be25aa9 Fix some typos
Signed-off-by: fudancoder <fudancoder@icloud.com.>
2024-12-24 11:35:38 +08:00
bors
d3e71fd2d3 Auto merge of #134716 - Zalathar:rollup-1h4q8cc, r=Zalathar
Rollup of 5 pull requests

Successful merges:

 - #134638 (Fix effect predicates from item bounds in old solver)
 - #134662 (Fix safety docs for `dyn Any + Send {+ Sync}`)
 - #134689 (core: fix const ptr::swap_nonoverlapping when there are pointers at odd offsets)
 - #134699 (Belay new reviews for workingjubilee)
 - #134701 (Correctly note item kind in `NonConstFunctionCall` error message)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-24 03:33:09 +00:00
Stuart Cook
772b95e755
Rollup merge of #134701 - compiler-errors:non-const-def-descr, r=Urgau,fmease
Correctly note item kind in `NonConstFunctionCall` error message

Don't just call everything a "`fn`". This is more consistent with the error message we give for conditionally-const items, which do note the item's def kind.

r? fmease, this is a prerequisite for making those `~const PartialEq` error messages better. Re-roll if you're busy or don't want to review this.
2024-12-24 14:05:24 +11:00
Stuart Cook
33311856e1
Rollup merge of #134699 - workingjubilee:jubilee-jubilee, r=lqd
Belay new reviews for workingjubilee

My queue is at-capacity, effectively.
2024-12-24 14:05:23 +11:00
Stuart Cook
bbd30b5476
Rollup merge of #134689 - RalfJung:ptr-swap-test, r=oli-obk
core: fix const ptr::swap_nonoverlapping when there are pointers at odd offsets

Ensure that the pointer gets swapped correctly even if it is not stored at an aligned offset. This rules out implementations that copy things in a `usize` loop -- so our implementation needs to be adjusted to avoid such a loop when running in const context.

Part of https://github.com/rust-lang/rust/issues/133668
2024-12-24 14:05:22 +11:00
Stuart Cook
0c93b279ea
Rollup merge of #134662 - ionicmc-rs:any-safety-docs, r=Amanieu
Fix safety docs for `dyn Any + Send {+ Sync}`

Fixes the `# Safety` docs for `dyn Any + Send`'s `downcast_{mut/ref}_unchecked` to show the direct instructions , where previously the would tell the user to find the docs on `dyn Any` themselves.

This also adds them for `downcast_{mut/ref}_unchecked` on `dyn Any + Send + Sync`
2024-12-24 14:05:22 +11:00
Stuart Cook
c2f44cd32c
Rollup merge of #134638 - compiler-errors:fx-item-bounds, r=lcnr
Fix effect predicates from item bounds in old solver

r? lcnr
2024-12-24 14:05:21 +11:00
bors
f3343420c8 Auto merge of #134625 - compiler-errors:unsafe-binders-ty, r=oli-obk
Begin to implement type system layer of unsafe binders

Mostly TODOs, but there's a lot of match arms that are basically just noops so I wanted to split these out before I put up the MIR lowering/projection part of this logic.

r? oli-obk

Tracking:

- https://github.com/rust-lang/rust/issues/130516
2024-12-24 00:51:51 +00:00
Michael Goulet
92f93f6d11 Note def descr in NonConstFunctionCall 2024-12-23 22:15:32 +00:00
bors
65fe42a5f4 Auto merge of #134493 - compiler-errors:drops-elaborated, r=oli-obk
Always run `tail_expr_drop_order` lint in promoted MIR query

Rather than running the lint at the beginning of `mir_drops_elaborated_and_const_checked`, run it at the end of `mir_promoted`.  This should ensure that the lint gets picked up when running `cargo fix`, which runs with `--emit metadata` and therefore doesn't actually query `mir_drops_elaborated_and_const_checked`.

We could probably push this down into `mir_built` too? but I don't really see a good reason to do so.

https://github.com/rust-lang/rust/issues/132861#issuecomment-2539960199

cc `@ehuss`
2024-12-23 22:14:38 +00:00
Michael Goulet
b893221517 Always run tail_expr_drop_order lint on promoted MIR 2024-12-23 20:25:41 +00:00
bors
bdc6b3de48 Auto merge of #134405 - rmehri01:x-completions, r=onur-ozkan
Generate shell completions for x as well

It would be nice to be have shell completions for both `./x` and `x` (installed with `cargo install --path src/tools/x`) instead of just `x.py`. This pr generates the corresponding completions for each shell in a similar way to `x.py` but under `x.<shell>` instead.
2024-12-23 19:31:58 +00:00
Jubilee Young
98cc5a77bd Belay new reviews for workingjubilee
My queue is at-capacity, effectively.
2024-12-23 11:22:43 -08:00
bors
addbd001ec Auto merge of #134687 - matthiaskrgr:rollup-m32tkax, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #134363 (Use `#[derive(Default)]` instead of manual `impl` when possible)
 - #134517 (Add tests for coverage attribute on trait functions)
 - #134528 (opt-dist: propagate channel info to bootstrap)
 - #134669 (Document the `--dev` flag for `src/ci/docker/run.sh`)
 - #134680 (Clean up a few rmake tests  )

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-23 16:40:02 +00:00
Ralf Jung
af1c8da172 core: fix const ptr::swap_nonoverlapping when there are pointers at odd offsets in the type 2024-12-23 16:24:45 +01:00
Matthias Krüger
a16fc10f23
Rollup merge of #134680 - lqd:run-make-cleanup, r=jieyouxu
Clean up a few rmake tests

Now I'm aware it's a bit late to start participating in the Advent of Tests, but here are a few cleanups in the rmake tests to put under the 🎄 anyways. A handful of unused imports, some warnings, and a couple typos.

r? `@jieyouxu` 🎅
2024-12-23 14:44:22 +01:00
Matthias Krüger
a62f245fb7
Rollup merge of #134669 - clubby789:dev-ci-mode, r=jieyouxu
Document the `--dev` flag for `src/ci/docker/run.sh`

This flag is very helpful for debugging CI issues locally, but it's not documented anywhere and I wasn't aware of it until `@jieyouxu` pointed it out. Add a note to the CI Docker readme to make this more discoverable
2024-12-23 14:44:21 +01:00
Matthias Krüger
cfb7a56676
Rollup merge of #134528 - jieyouxu:fix-rustc-bootstrap-test, r=Kobzol
opt-dist: propagate channel info to bootstrap

Fixes #133503.

Previously, `tests/ui/bootstrap/rustc_bootstap.rs` [sic] failed during [beta bump](https://github.com/rust-lang/rust/pull/133447#issuecomment-2501298794) in opt-dist tests. This is because:

- `opt-dist` tried to run `./x test` against beta-channel dist `rustc` through `bootstrap`.
- The dist build produced during the beta bump produces a `rustc` which correctly thinks that it is a beta compiler based on `src/ci/channel` info.
- `opt-dist` tries to run `./x test` on the beta `rustc` from the dist build, but without specifying channel through a synthetic `config.toml`, so `bootstrap` tells `compiletest` that we're on the `nightly` channel (by default).
- Now there's a channel mismatch: `compiletest` believes the `rustc` under test is a *nightly* rustc, but the `rustc` under test actually considers itself a *beta* rustc. This means that `//@ only-nightly` will be satisfied yet the test will fail as the *beta* rustc is not a *nightly* rustc.

This PR:

- Fixes the test failure during beta bump (i.e. #133503) by having `opt-dist` faithfully report the channel of the dist `rustc` being tested (i.e. "beta" in a beta bump PR). This will properly make the test be ignored during beta bump as the `rustc` under test is not a *nightly* rustc.
- Fixes the test name `rustc_bootstap.rs` -> `rustc_bootstrap.rs`. No more stapping.
- Slightly adjusts the doc comment in the test to make it more clear.

I ran a try-job against the beta branch (explicitly running the opt-dist tests by modifying the job definition) with these changes in #134131, and it appears that the try-job was [successful](https://github.com/rust-lang/rust/pull/134131#issuecomment-2555492215). The two commits in this PR are cherry-picked from #134131, with the test commit slightly modified (to also adjust the test comments).

r? `@Kobzol` (or compiler or bootstrap or infra I guess?)
2024-12-23 14:44:21 +01:00
Matthias Krüger
369be1855d
Rollup merge of #134517 - ehuss:coverage-trait-test, r=Zalathar
Add tests for coverage attribute on trait functions

This adds tests for the coverage attribute on trait functions. cc https://github.com/rust-lang/rust/issues/84605#issuecomment-2552420962
2024-12-23 14:44:20 +01:00
Matthias Krüger
95c33e303b
Rollup merge of #134363 - estebank:derive-default, r=SparrowLii
Use `#[derive(Default)]` instead of manual `impl` when possible

While working on #134175 I noticed a few manual `Default` `impl`s that could be `derive`d instead. These likely predate the existence of the `#[default]` attribute for `enum`s.
2024-12-23 14:44:20 +01:00
Eric Huss
5d9f17f58c Add test for coverage on a body-less trait function 2024-12-24 00:09:39 +11:00
Eric Huss
0efa90f246 Add a test for coverage attr on trait function 2024-12-24 00:09:38 +11:00
bors
904d8f6b39 Auto merge of #134681 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-12-23 12:18:14 +00:00
Laurențiu Nicola
8dbdcc03eb
Merge pull request #18746 from lnicola/sync-from-rust
minor: Sync from downstream
2024-12-23 10:12:23 +00:00
Rémy Rakic
6f19bd08b0 fix a few typos in rmake tests' comments 2024-12-23 09:40:38 +00:00
Rémy Rakic
9ca5df692b remove unnecessary mut from dump-ice-to-disk rmake test 2024-12-23 09:40:38 +00:00
Rémy Rakic
1d77a2c677 clean up remove-dir-all-race rmake test
- removes unused variables
- fixes a few typos
2024-12-23 09:40:38 +00:00
Rémy Rakic
d6a9ad6190 remove unused imports from rmake tests 2024-12-23 09:40:25 +00:00
bors
85c39893a7 Auto merge of #134677 - tgross35:rollup-ozoeyop, r=tgross35
Rollup of 4 pull requests

Successful merges:

 - #129220 (Add platform docs for FreeBSD.)
 - #134659 (test-infra: improve compiletest and run-make-support symlink handling)
 - #134668 (Make sure we don't lose default struct value when formatting struct)
 - #134672 (Revert stabilization of the `#[coverage(..)]` attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-23 09:36:29 +00:00
clubby789
d124ec68b3 Link to dev guide on Docker testing 2024-12-23 09:35:14 +00:00
Laurențiu Nicola
0180d2d16f Bump rustc crates 2024-12-23 11:33:26 +02:00
Laurențiu Nicola
9420a0b11a Merge from rust-lang/rust 2024-12-23 11:27:07 +02:00
Laurențiu Nicola
214134902f Preparing for merge from rust-lang/rust 2024-12-23 11:26:54 +02:00
Trevor Gross
8fc4ba2ac1
Rollup merge of #134672 - Zalathar:revert-coverage-attr, r=wesleywiser
Revert stabilization of the `#[coverage(..)]` attribute

Due to a process mixup, the PR to stabilize the `#[coverage(..)]` attribute (#130766) was merged while there are still outstanding concerns. The default action in that situation is to revert, and the feature is not sufficiently urgent or uncontroversial to justify special treatment, so this PR reverts that stabilization.

---

- A key point that came up in offline discussions is that unlike most user-facing features, this one never had a proper RFC, so parts of the normal stabilization process that implicitly rely on an RFC break down in this case.
- As the implementor and de-facto owner of the feature in its current form, I would like to think that I made good choices in designing and implementing it, but I don't feel comfortable proceeding to stabilization without further scrutiny.
- There hasn't been a clear opportunity for T-compiler to weigh in or express concerns prior to stabilization.
- The stabilization PR cites a T-lang FCP that occurred in the tracking issue, but due to the messy design and implementation history (and lack of a clear RFC), it's unclear what that FCP approval actually represents in this case.
  - At the very least, we should not proceed without a clear statement from T-lang or the relevant members about the team's stance on this feature, especially in light of the other concerns listed here.
- The existing user-facing documentation doesn't clearly reflect which parts of the feature are stable commitments, and which parts are subject to change. And there doesn't appear to be a clear consensus anywhere about where that line is actually drawn, or whether the chosen boundary is acceptable to the relevant teams and individuals.
  - For example, the [stabilization report comment](https://github.com/rust-lang/rust/issues/84605#issuecomment-2166514660) mentions that some aspects are subject to change, but that text isn't consistent with my earlier comments, and there doesn't appear to have been any explicit discussion or approval process.
  - [The current reference text](4dfaa4f/src/attributes/coverage-instrumentation.md) doesn't mention this distinction at all, and instead simply describes the current implementation behaviour.
- When the implementation was changed to its current form, the associated user-facing error messages were not updated, so they still refer to the attribute only being allowed on functions and closures.
  - On its own, this might have been reasonable to fix-forward in the absence of other concerns, but the fact that it never came up earlier highlights the breakdown in process that has occurred here.

---

Apologies to everyone who was excited for this stabilization to land, but unfortunately it simply isn't ready yet.
2024-12-23 02:07:32 -05:00
Trevor Gross
c9c90dc4b5
Rollup merge of #134668 - compiler-errors:default-struct-value-fmt, r=ytmimi
Make sure we don't lose default struct value when formatting struct

The reason why https://github.com/rust-lang/rustfmt/issues/6424 broke when https://github.com/rust-lang/rust/pull/129514 landed is because the parser now *successfully* parses default struct values. That means that where we used to fail in `rewrite_macro_inner`:

e108481f74/src/tools/rustfmt/src/macros.rs (L263-L267)

... we now succeed, and we now proceed to format the inner struct as a macro arg. Since formatting was never implemented for default struct values, this means that we’ll always rewrite the struct to exclude the default value.

This PR makes it so that we simply don’t rewrite struct fields if they have a default value.

r? `@ytmimi`
2024-12-23 02:07:32 -05:00
Trevor Gross
fde85a8e5f
Rollup merge of #134659 - jieyouxu:recursive-remove, r=ChrisDenton
test-infra: improve compiletest and run-make-support symlink handling

I was trying to implement #134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).

Key changes:

- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
    - I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
    - I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
    - In this sense, it's a reland of #129302 with proper test coverage.
    - It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.

Fixes #126334.
2024-12-23 02:07:31 -05:00
Trevor Gross
3acf9c93a4
Rollup merge of #129220 - asomers:target-maintainer, r=tgross35
Add platform docs for FreeBSD.
2024-12-23 02:07:31 -05:00
bors
66bb586952 Auto merge of #134608 - DianQK:disable-93775, r=jieyouxu
Add `ignore-rustc-debug-assertions` to `tests/ui/associated-consts/issue-93775.rs`

Closes #132111. Closes #133432.

I think this test case is flaky because the recursive calls happen to hit the upper limit of the call stack.

IMO, this may not be an issue, as it's reasonable for overly complex code to require additional build configurations (such as increasing the call stack size).

After set `rust.debug-assertions` is true, the test case requires a larger call stack, so disable it on `rust.debug-assertions=true`.

r? jieyouxu

try-job: x86_64-msvc
try-job: i686-msvc
2024-12-23 06:55:31 +00:00
bors
0eca4dd320 Auto merge of #134465 - lcnr:type-verifier, r=compiler-errors
cleanup `TypeVerifier`

We should merge it with the `TypeChecker` as we no longer bail in cases where it encounters an error since #111863.

It's quite inconsistent whether a check lives in the verifier or the `TypeChecker`, so this feels like a quite impactful cleanup. I expect that for this we may want to change the `TypeChecker` to also be a MIR visitor 🤔 this is non-trivial so I didn't fully do it in this PR.

Best reviewed commit by commit.

r? `@compiler-errors` feel free to reassign however
2024-12-23 04:15:41 +00:00
Esteban Küber
1f82b45b6a Use #[derive(Default)] instead of manually implementing it 2024-12-23 03:01:29 +00:00
Zalathar
87c2f9a5be Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser"
This reverts commit 1d35638dc3, reversing
changes made to f23a80a4c2.
2024-12-23 12:30:37 +11:00
bors
908af5ba4a Auto merge of #134666 - matthiaskrgr:rollup-whe0chp, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #130289 (docs: Permissions.readonly() also ignores root user special permissions)
 - #134583 (docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code)
 - #134611 (Align `{i686,x86_64}-win7-windows-msvc` to their parent targets)
 - #134629 (compiletest: Allow using a specific debugger when running debuginfo tests)
 - #134642 (Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.)
 - #134660 (Fix spacing of markdown code block fences in compiler rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-23 01:18:40 +00:00