Commit graph

256790 commits

Author SHA1 Message Date
Matthias Krüger ccbd6c29b4
Rollup merge of #126089 - wutchzone:option_take_if, r=scottmcm
Stabilize Option::take_if

Closes #98934

ed: FCP complete in https://github.com/rust-lang/rust/issues/98934#issuecomment-2104627082
2024-06-07 20:14:31 +02:00
Matthias Krüger 2e82d7f569
Rollup merge of #126077 - oli-obk:revert_is_mir_available, r=BoxyUwU
Revert "Use the HIR instead of mir_keys for determining whether something will have a MIR body."

This reverts commit e5cba17b84.

turns out SMIR still needs it (https://github.com/model-checking/kani/issues/3218). I'll create a full plan and MCP for what I intended this to be a part of. Maybe my plan is nonsense anyway.
2024-06-07 20:14:31 +02:00
Matthias Krüger 4aceaaa7f3
Rollup merge of #126052 - nnethercote:rustc_parse-more-cleanups, r=spastorino
More `rustc_parse` cleanups

Following on from #125815.

r? `@spastorino`
2024-06-07 20:14:30 +02:00
Matthias Krüger bc793291b5
Rollup merge of #126047 - cuviper:installer-try_for_each, r=albertlarsan68
Simplify the rayon calls in the installer

Rayon's `try_for_each` makes the `CombinedEncoder` a lot simpler.
2024-06-07 20:14:30 +02:00
Matthias Krüger 3689adf5a4
Rollup merge of #126030 - ChrisDenton:update-wingen-readme, r=Mark-Simulacrum
Update `./x fmt` command in library/std/src/sys/pal/windows/c/README.md

`./x fmt` no longer accepts paths so the command in the readme won't work.
2024-06-07 20:14:29 +02:00
Matthias Krüger 65fcba61e4
Rollup merge of #125781 - onur-ozkan:improve-tool-builder, r=albertlarsan68
prefer `compile::stream_cargo` for building tools

Previously, we were running bare commands for `ToolBuild` step and were unable to utilize some of the flags which  are already handled by `compile::stream_cargo`.

This change makes `ToolBuild` to use `compile::stream_cargo`, allowing us to benefit from the flags supported by the bootstrap cargo.

Resolves #125666
2024-06-07 20:14:29 +02:00
Matthias Krüger 13314df21b
Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix
Detect pub structs never constructed and unused associated constants

<!--
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>
-->

Lints never constructed public structs.

If we don't provide public methods to construct public structs with private fields, and don't construct them in the local crate. They would be never constructed. So that we can detect such public structs.

---
Update:

Also lints unused associated constants in traits.
2024-06-07 20:14:28 +02:00
Matthias Krüger 6e534c73c3
Rollup merge of #124214 - carbotaniuman:parse_unsafe_attrs, r=michaelwoerister
Parse unsafe attributes

Initial parse implementation for #123757

This is the initial work to parse unsafe attributes, which is represented as an extra `unsafety` field in `MetaItem` and `AttrItem`. There's two areas in the code where it appears that parsing is done manually and not using the parser stuff, and I'm not sure how I'm supposed to thread the change there.
2024-06-07 20:14:28 +02:00
Matthias Krüger 0acb5b8513
Rollup merge of #124012 - slanterns:as_slice_stabilize, r=BurntSushi
Stabilize `binary_heap_as_slice`

This PR stabilizes `binary_heap_as_slice`:

```rust
// std::collections::BinaryHeap

impl BinaryHeap<T> {
    pub fn as_slice(&self) -> &[T]
}
```

<br>

Tracking issue: https://github.com/rust-lang/rust/issues/83659.
Implementation PR: https://github.com/rust-lang/rust/pull/82331.

FCPs already completed in the tracking issue.

Closes https://github.com/rust-lang/rust/issues/83659.

r? libs-api
2024-06-07 20:14:27 +02:00
bors e3c3ce62d7 Auto merge of #126110 - workingjubilee:backtrace-0.3.73, r=workingjubilee
Update backtrace to 0.3.73

Fixes #126109

r? `@ghost`
2024-06-07 14:44:46 +00:00
Oli Scherer 9461852363 Add regression test 2024-06-07 13:22:44 +00:00
bors 1be24d70ce Auto merge of #125918 - oli-obk:const_block_ice, r=compiler-errors
Revert: create const block bodies in typeck via query feeding

as per the discussion in https://github.com/rust-lang/rust/pull/125806#discussion_r1622563948

It was a mistake to try to shoehorn const blocks and some specific anon consts into the same box and feed them during typeck. It turned out not simplifying anything (my hope was that we could feed `type_of` to start avoiding the huge HIR matcher, but that didn't work out), but instead making a few things more fragile.

reverts the const-block-specific parts of https://github.com/rust-lang/rust/pull/124650

`@bors` rollup=never had a small perf impact previously

fixes https://github.com/rust-lang/rust/issues/125846

r? `@compiler-errors`
2024-06-07 09:08:59 +00:00
Oli Scherer 321d69d195 Fix codegen test 2024-06-07 08:50:18 +00:00
Oli Scherer bbcd8794d0 Add regression test 2024-06-07 08:33:58 +00:00
Oli Scherer cbee17d502 Revert "Create const block DefIds in typeck instead of ast lowering"
This reverts commit ddc5f9b6c1.
2024-06-07 08:33:58 +00:00
Oli Scherer 92c54db22f Revert "Cache whether a body has inline consts"
This reverts commit eae5031ecb.
2024-06-07 08:33:58 +00:00
bors 468310ea0c Auto merge of #126108 - workingjubilee:rollup-g7m92b6, r=workingjubilee
Rollup of 7 pull requests

Successful merges:

 - #125606 (Size optimize int formatting)
 - #125724 (Uplift `Relate`/`TypeRelation` into `rustc_next_trait_solver`)
 - #126040 (Don't warn on fields in the `unreachable_pub` lint )
 - #126098 (Remove `same-lib-two-locations-no-panic` run-make test)
 - #126099 (Crate loader cleanups)
 - #126101 (Revert "Disallow ambiguous attributes on expressions" on nightly)
 - #126103 (Improve Docs for `hir::Impl` and `hir::ImplItem`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-07 06:49:55 +00:00
Jubilee Young 49c2a1dda9 Update backtrace to 0.3.73 2024-06-06 22:50:45 -07:00
Jubilee 9436304871
Rollup merge of #126103 - veera-sivarajan:improve-docs-hir-impl, r=fmease
Improve Docs for `hir::Impl` and `hir::ImplItem`

Based on https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20Difference.20between.20.60hir.3A.3AImplItem.60.20and.20.60hir.3A.3AImpl.60.3F/near/442650915

r​? fmease
2024-06-06 21:10:11 -07:00
Jubilee b1ab8d59f4
Rollup merge of #126101 - lqd:revert-124099, r=wesleywiser
Revert "Disallow ambiguous attributes on expressions" on nightly

As discussed in [today's t-compiler meeting](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-06-06/near/443079505), this reverts PR #124099 to fix P-critical beta regressions #125199.

r? ``@wesleywiser``

Opening as draft so that ``@wesleywiser`` and ``@apiraino,`` you can tell me whether you wanted:
1. a `beta-accepted` revert of #124099 on nightly (this PR)? That will need to be backported to beta (even though #126093 may be the last of those)
2. a revert of #124099 on beta?
3. all of the above?

I also opened #126102, another draft PR to revert #124099 on beta, should you choose options 2 or 3.
2024-06-06 21:10:11 -07:00
Jubilee 4c771d3117
Rollup merge of #126099 - Nilstrieb:crate-loader-cleanups, r=jieyouxu
Crate loader cleanups

Minor cleanups I found while trying to understand how all of this works
2024-06-06 21:10:10 -07:00
Jubilee 2acb24c462
Rollup merge of #126098 - Kobzol:remove-same-lib-runmake-test, r=jieyouxu
Remove `same-lib-two-locations-no-panic` run-make test

This test doesn't really make any sense anymore, it became broken a long time ago.

r? ``@jieyouxu``
2024-06-06 21:10:10 -07:00
Jubilee 6a42df7517
Rollup merge of #126040 - Urgau:unreachable_pub-fields-less, r=petrochenkov
Don't warn on fields in the `unreachable_pub` lint

This PR restrict the `unreachable_pub` lint by not linting on `pub` fields of `pub(restricted)` structs and unions. This is done because that can quickly clutter the code for an uncertain value, in particular since the "real" visibility is defined by the parent (the struct it-self).

This is meant to address one of the last concern of the `unreachable_pub` lint.

r? ``@petrochenkov``
2024-06-06 21:10:10 -07:00
Jubilee 75aa9d1219
Rollup merge of #125724 - compiler-errors:uplift-relate, r=lcnr
Uplift `Relate`/`TypeRelation` into `rustc_next_trait_solver`

For use in the new solver. This doesn't yet uplift `ObligationEmittingRelation`.

r? lcnr
2024-06-06 21:10:09 -07:00
Jubilee c6cdd457eb
Rollup merge of #125606 - diondokter:opt-size-int-fmt, r=cuviper
Size optimize int formatting

Let's use the new feature flag!

This uses a simpler algorithm to format integers.
It is slower, but also smaller.
It also saves having to import the 200 byte rodata lookup table.

In a test of mine this saves ~300 bytes total of a cortex-m binary that does integer formatting.
For a 16KB device, that's almost 2%.

Note though that for opt-level 3 the text size actually grows by 116 bytes.
Still a win in total. I'm not sure why the generated code is bigger than the more fancy algo. Maybe the smaller algo lends itself more to inlining and duplicating?
2024-06-06 21:10:08 -07:00
bors b74702fbb2 Auto merge of #125928 - michaelwoerister:fix-cgu-hashstable, r=oli-obk
Stabilize order of MonoItems in CGUs and disallow query_instability lint for rustc_monomorphize

The HashStable impl for `CodegenUnit` was incorrect as described in [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). This PR removes any indeterminism from the way codegen units are built. The changes are pretty straightforward.

Part of https://github.com/rust-lang/rust/issues/84447 and [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).
2024-06-07 04:02:59 +00:00
carbotaniuman f9104f0dfb Handle safe case 2024-06-06 20:54:51 -05:00
carbotaniuman f83cdbd2e0 Fix ordering 2024-06-06 20:42:20 -05:00
carbotaniuman 453093b791 Remove extraneous attribute 2024-06-06 20:36:23 -05:00
carbotaniuman 1cc4e8c733 Add unsafe to ffi_pure and ffi_const 2024-06-06 20:27:25 -05:00
carbotaniuman 15f8ffe371 Fix formatting 2024-06-06 20:27:25 -05:00
carbotaniuman 8aa2553b50 Change comment to FIXME 2024-06-06 20:27:25 -05:00
carbotaniuman 87be1bae73 Fix build 2024-06-06 20:27:25 -05:00
carbotaniuman b82c524996 Add double unsafe test 2024-06-06 20:27:25 -05:00
carbotaniuman 68719e0bda Fix doc comment 2024-06-06 20:27:24 -05:00
carbotaniuman 230b58febf Error on unsafe on non-unsafe attribute 2024-06-06 20:26:28 -05:00
carbotaniuman 48851d9adb Add tests 2024-06-06 20:26:28 -05:00
carbotaniuman 6ec492fdde Reorder unsafe macro cases 2024-06-06 20:26:28 -05:00
carbotaniuman c4de986afa Disallow unsafe in derive 2024-06-06 20:26:27 -05:00
carbotaniuman 67f5dd1ef1 Parse unsafe attributes 2024-06-06 20:26:27 -05:00
Veera cddf291a25 Improve Docs for hir::Impl and hir::ImplItem 2024-06-06 21:00:16 -04:00
bors 76e7a0849c Auto merge of #126104 - workingjubilee:rollup-t1ac2ld, r=workingjubilee
Rollup of 12 pull requests

Successful merges:

 - #125220 (Repair several `riscv64gc-unknown-linux-gnu` codegen tests)
 - #126033 (CI: fix publishing of toolstate history)
 - #126034 (Clarify our tier 1 Windows Server support)
 - #126035 (Some minor query system cleanups)
 - #126051 (Clarify an `x fmt` error.)
 - #126059 (Raise `DEFAULT_MIN_STACK_SIZE` to at least 64KiB)
 - #126064 (Migrate `run-make/manual-crate-name` to `rmake.rs`)
 - #126072 (compiletest: Allow multiple `//@ run-flags:` headers)
 - #126073 (Port `tests/run-make-fulldeps/obtain-borrowck` to ui-fulldeps)
 - #126081 (Do not use relative paths to Rust source root in run-make tests)
 - #126086 (use windows compatible executable name for libcxx-version)
 - #126096 ([RFC-2011] Allow `core_intrinsics` when activated)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-06 22:27:56 +00:00
Jubilee efd8959ab1
Rollup merge of #126096 - c410-f3r:tests-tests-tests, r=jhpratt
[RFC-2011] Allow `core_intrinsics` when activated

Fix #120612
2024-06-06 14:46:25 -07:00
Jubilee 7e81738d5c
Rollup merge of #126086 - onur-ozkan:use-exe, r=petrochenkov
use windows compatible executable name for libcxx-version

Resolves #https://github.com/rust-lang/rust/pull/125411#discussion_r1629915724
2024-06-06 14:46:25 -07:00
Jubilee af229f5e00
Rollup merge of #126081 - Kobzol:run-make-relative-paths, r=jieyouxu
Do not use relative paths to Rust source root in run-make tests

Pre-requisite for https://github.com/rust-lang/rust/issues/126080.

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

r? `@jieyouxu`
2024-06-06 14:46:24 -07:00
Jubilee 30bb51fd06
Rollup merge of #126073 - Zalathar:fulldeps-borrowck, r=jieyouxu
Port `tests/run-make-fulldeps/obtain-borrowck` to ui-fulldeps

Thanks to `{{sysroot-base}}` from #126008, this was also pretty straightforward to port over.
2024-06-06 14:46:24 -07:00
Jubilee f4016e2bf5
Rollup merge of #126072 - Zalathar:run-flags, r=jieyouxu
compiletest: Allow multiple `//@ run-flags:` headers

While working on some tests, I was annoyed to find that multiple `// `@run-flags:`` headers do not combine with each other (as `//@ compile-flags:` headers do), and instead all but one are silently discarded.

This makes it impossible to split long flag lists into multiple lines.

Fortunately it's easy to just recycle the existing logic from the other command-line-flags headers.
2024-06-06 14:46:23 -07:00
Jubilee 2c1e71bac5
Rollup merge of #126064 - GuillaumeGomez:migrate-run-make-manual-crate-name, r=jieyouxu
Migrate `run-make/manual-crate-name` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-06-06 14:46:23 -07:00
Jubilee 68c57de26e
Rollup merge of #126059 - workingjubilee:stack-nothing-higher, r=ChrisDenton
Raise `DEFAULT_MIN_STACK_SIZE` to at least 64KiB

Prevent copy-paste errors from producing new starved-for-resources threaded platforms by raising `DEFAULT_MIN_STACK_SIZE` from 4096 bytes to at least 64KiB.

Two platforms "affected" by this have no actual threads:
- UEFI
- "unsupported"

Platforms that this actually affects:
- wasm32-wasi with "atomics" enabled
- wasm32-wasi-p1-threads

Two exceptions:
- SGX: a "secure code execution" platform, stays at 4096B
- TEEOS: also a "secure code execution" platform, stays at 8192B

I believe either of these may have sufficiently "interesting" semantics around threads, or significant external library support. Either would mean making any choices here for them is suspect.

Fixes #126027 which is a bug report about `DEFAULT_MIN_STACK_SIZE` being too low on wasi.
2024-06-06 14:46:22 -07:00
Jubilee f739fefc76
Rollup merge of #126051 - nnethercote:clarify-x-fmt-error, r=Nilstrieb
Clarify an `x fmt` error.

For anyone who was using paths with `x fmt` previously, make the error message a bit clearer.

r? ```@GuillaumeGomez```
2024-06-06 14:46:22 -07:00