about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-10-31Rollup merge of #131168 - madsmtm:target-info-psx-os, r=davidtwcoJubilee-5/+8
Fix `target_os` for `mipsel-sony-psx` Previously set to `target_os = "none"` and `target_env = "psx"` in [the PR introducing the target](https://github.com/rust-lang/rust/pull/102689/), but although the Playstation 1 is _close_ to a bare metal target in some regards, it's still very much an operating system, so we should instead set `target_os = "psx"`. This also matches the `mipsel-sony-psp` target, which sets `target_os = "psp"`. CC target maintainer ``@ayrtonm.`` If there's any code out there that uses `cfg(target_env = "psx")`, they can use `cfg(any(target_os = "psx", target_env = "psx"))` until they bump their MSRV to a version where this is fully fixed.
2024-10-31Auto merge of #132356 - jieyouxu:unsound-simplify_aggregate_to_copy, ↵bors-43/+192
r=cjgillot,DianQK Mark `simplify_aggregate_to_copy` mir-opt as unsound Mark the `simplify_aggregate_to_copy` mir-opt added in #128299 as unsound as it seems to miscompile the MCVE reported in https://github.com/rust-lang/rust/issues/132353. The mir-opt can be re-enabled once this case is fixed. ```rs fn pop_min(mut score2head: Vec<Option<usize>>) -> Option<usize> { loop { if let Some(col) = score2head[0] { score2head[0] = None; return Some(col); } } } fn main() { let min = pop_min(vec![Some(1)]); println!("min: {:?}", min); // panic happens here on beta in release mode // but not in debug mode min.unwrap(); } ``` This MCVE is included as a `run-pass` ui regression test in the first commit. I built the ui test with a nightly manually, and can reproduce the behavioral difference with `-C opt-level=0` and `-C opt-level=1`. Locally, this ui test will fail unless it was run on a compiler built with the second commit marking the mir-opt as unsound thus disabling it by default. This PR **partially reverts** commit e7386b3, reversing changes made to 02b1be1. The mir-opt implementation is just marked as unsound but **not** reverted to make reland reviews easier. Test changes are **reverted if they were not pure additions**. Tests added by the original PR received `-Z unsound-mir-opts` compile-flags. cc `@DianQK` `@cjgillot` (PR author and reviewer of #128299)
2024-10-31Auto merge of #132401 - matthiaskrgr:rollup-599ieqr, r=matthiaskrgrbors-96/+283
Rollup of 5 pull requests Successful merges: - #130693 (Add `minicore` test auxiliary and support `//@ add-core-stubs` directive in ui/assembly/codegen tests) - #132316 (CI: use free runners for 3 fast windows jobs) - #132354 (Add `lp64e` RISC-V ABI) - #132395 (coverage: Avoid ICE when `coverage_cx` is unexpectedly unavailable) - #132396 (CI: use free runners for x86_64-gnu-tools and x86_64-rust-for-linux) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-31Rollup merge of #132396 - ↵Matthias Krüger-2/+2
MarcoIeni:ci-use-free-runners-for-x86_64-gnu-tools-and-x86_64-rust-for-linux, r=Kobzol CI: use free runners for x86_64-gnu-tools and x86_64-rust-for-linux try-job: x86_64-gnu-tools try-job: x86_64-rust-for-linux
2024-10-31Rollup merge of #132395 - Zalathar:coverage-cx-ice, r=jieyouxuMatthias Krüger-2/+12
coverage: Avoid ICE when `coverage_cx` is unexpectedly unavailable In #132124, `coverage_cx()` was changed to panic if the context was unavailable, under the assumption that it would always be available whenever coverage instrumentation is enabled. However, there have been reports of this change causing ICEs in `polars` CI. I don't yet understand why this is happening, but for now it seems wisest to revert that part of the change, restoring the two early returns that had been replaced with panics.
2024-10-31Rollup merge of #132354 - koute:master, r=workingjubileeMatthias Krüger-2/+4
Add `lp64e` RISC-V ABI This PR adds support for the `lp64e` RISC-V ABI, which is the 64-bit equivalent of the `ilp32e` ABI that is already supported. For reference, this ABI was originally added to LLVM in [this PR](https://reviews.llvm.org/D70401).
2024-10-31Rollup merge of #132316 - MarcoIeni:ci-free-runners-windows, r=Mark-SimulacrumMatthias Krüger-3/+3
CI: use free runners for 3 fast windows jobs try-job: dist-i686-msvc try-job: dist-i686-mingw try-job: dist-x86_64-mingw try-job: dist-x86_64-msvc-alt
2024-10-31Rollup merge of #130693 - jieyouxu:minicore, r=bjorn3Matthias Krüger-87/+262
Add `minicore` test auxiliary and support `//@ add-core-stubs` directive in ui/assembly/codegen tests Context: [Real cross-compiling tests instead of `#![no_core]` silliness #130375](https://github.com/rust-lang/rust/issues/130375) MCP: https://github.com/rust-lang/compiler-team/issues/786 Tracking issue: https://github.com/rust-lang/rust/issues/131485 This prototype PR is subject to further changes based on feedback. ### New `minicore` test auxiliary and `//@ add-core-stubs` compiletest directive This PR introduces a prototype implementation of a `minicore` auxiliary test helper that provides `core` stubs for `#![no_core]` ui/assembly/codegen tests that need to build but not run on both the host platform and the cross-compiled target platform. Key summary: - `tests/auxiliary/minicore.rs` contains stub definitions of `core` items intended for consumption by `check-pass`/`build-pass` tests that want the typical prelude items like `Copy` to be stubbed out under `#![no_core]` scenarios, so that the test can be built (not run) for cross-compiled target platforms. Such tests don't want nor need full `-Z build-std` (e.g. `tests/ui/abi/compatibility.rs`). - `minicore` is intended for `core` items **only**, not `std`- or `alloc`-exclusive items. If stubs for `alloc` or `std` are wanted, they should be provided by an additional directive and test auxiliary, and not be conflated with `minicore` or `core` stubs. This is because a wider range of tests can benefit from `core`-only stubs. ### Implementation - The `minicore` auxiliary is a single source file `tests/auxiliary/minicore.rs`. - The path to `minicore` is made avaiable from bootstrap to compiletest via the `--minicore-path` compiletest flag. - `minicore` is then built on-demand via the `//@ add-core-stubs` compiletest directive, for each test revision for the given target platform (this distinction is important for when host platform != target platform in cross-compilation scenario). - `minicore` is then made available to the test as an [extern prelude]. [extern prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude ### Example usage ```rs // tests/ui/abi/my-abi-test.rs //@ check-pass //@ add-core-stubs //@ compile-flags: --target i686-unknown-linux-gnu //@ needs-llvm-components: x86 #![feature(no_core, lang_items)] #![no_std] #![no_core] #![allow(unused, internal_features)] extern crate minicore; use minicore::*; #[lang = "clone"] pub trait Clone: Sized { // `Sized` is provided by `minicore` fn clone(&self) -> Self; } ``` ### Implementation steps - [x] 1. Add an initial `minicore` test auxiliary. - [x] 2. Build `minicore` in bootstrap. - [x] 3. Setup a `--minicore-path` compiletest cli flag and pass `minicore` build artifact path from bootstrap to compiletest. - [x] 4. Assert `add-core-stubs` is mutually incompatible with tests that require to be `run`, as the stubs are only good for tests that only need to be built (i.e. no `run-{pass,fail}`). - [x] 5. Add some self-tests to sanity check the behavior. - [x] 6. Ensure that `tests/auxiliary/minicore.rs` is input stamped, i.e. modifying `tests/auxiliary/minicore.rs` should invalidate test cache and force the test to be rerun. ### Known limitations - The current `minicore` is very minimal, because this PR is intended to focus on supporting the test infrastructure first. Further stubs could be added in follow-up PRs and/or on a as-needed basis. try-job: aarch64-apple try-job: armhf-gnu try-job: x86_64-msvc try-job: test-various try-job: dist-various-1
2024-10-31CI: use free runners for x86_64-gnu-tools and x86_64-rust-for-linuxMarcoIeni-2/+2
2024-10-31coverage: Avoid ICE when `coverage_cx` is unexpectedly unavailableZalathar-2/+12
2024-10-31tests: use minicore in `tests/ui/abi/compatibility.rs` as an example许杰友 Jieyou Xu (Joe)-74/+28
2024-10-31tests/ui: add `minicore` compiletest self-test许杰友 Jieyou Xu (Joe)-0/+20
2024-10-31tests/codegen: add `minicore` compiletest self-test许杰友 Jieyou Xu (Joe)-0/+20
2024-10-31tests/assembly: add `minicore` compiletest self-test许杰友 Jieyou Xu (Joe)-0/+5
Check that `minicore` cannot be used with `run-{pass,fail}` tests.
2024-10-31compiletest: stamp `minicore.rs` to rerun tests on changes许杰友 Jieyou Xu (Joe)-0/+6
2024-10-31compiletest: conditionally build and provide `minicore` as extern prelude ↵许杰友 Jieyou Xu (Joe)-2/+48
when requested via `//@ add-core-stubs` directive `//@ add-core-stubs` will imply `-Cpanic=abort`.
2024-10-31compiletest: register `--minicore-path` flag and `//@ add-core-stubs` directive许杰友 Jieyou Xu (Joe)-1/+41
2024-10-31compiletest: localize `compile_test_and_save_assembly` to assembly test module许杰友 Jieyou Xu (Joe)-29/+31
2024-10-31bootstrap: pass minicore path when running compiletest step许杰友 Jieyou Xu (Joe)-0/+5
2024-10-31minicore: add minimal minicore test auxiliary许杰友 Jieyou Xu (Joe)-0/+77
The initial `minicore` is intentionally super minimal and contains an incomplete subset of `core` items, and explicitly not items from `alloc` or `std`-only items.
2024-10-31Auto merge of #132301 - compiler-errors:adjust, r=lcnrbors-64/+65
Remove region from adjustments It's not necessary to store this region, because it's only used in THIR and MemCat/ExprUse, both of which already basically only deal with erased regions anyways.
2024-10-31CI: use free runners for 3 fast windows jobsMarcoIeni-3/+3
2024-10-31Add `lp64e` ABI to the spec tests matchJan Bujak-1/+2
2024-10-31Add a comment about `lp64e` still being unstableJan Bujak-0/+1
2024-10-31Auto merge of #132384 - matthiaskrgr:rollup-0ze5wc4, r=matthiaskrgrbors-511/+355
Rollup of 4 pull requests Successful merges: - #132347 (Remove `ValueAnalysis` and `ValueAnalysisWrapper`.) - #132365 (pass `RUSTC_HOST_FLAGS` at once without the for loop) - #132366 (Do not enforce `~const` constness effects in typeck if `rustc_do_not_const_check`) - #132376 (Annotate `input` reference tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-31Add a mir-opt GVN test for #128299许杰友 Jieyou Xu (Joe)-0/+104
Co-authored-by: DianQK <dianqk@dianqk.net>
2024-10-31Mark `simplify_aggregate_to_copy` mir-opt as unsound许杰友 Jieyou Xu (Joe)-43/+63
Co-authored-by: DianQK <dianqk@dianqk.net>
2024-10-31Add a regression test for #132353许杰友 Jieyou Xu (Joe)-0/+25
To catch at least one pattern that was miscompiled. The test is a minimization of the MCVE reported in <https://github.com/rust-lang/rust/issues/132353>.
2024-10-31Rollup merge of #132376 - ehuss:reference-input, r=traviscrossMatthias Krüger-33/+55
Annotate `input` reference tests This adds test annotations for rules in the [input chapter](https://doc.rust-lang.org/nightly/reference/input-format.html) of the reference.
2024-10-31Rollup merge of #132366 - compiler-errors:do-not-const-check, r=fee1-deadMatthias Krüger-1/+18
Do not enforce `~const` constness effects in typeck if `rustc_do_not_const_check` Fixes a slight inconsistency between HIR and MIR enforcement of `~const` :D r? `@rust-lang/project-const-traits`
2024-10-31Rollup merge of #132365 - onur-ozkan:less-rustc-overhead, r=KobzolMatthias Krüger-3/+1
pass `RUSTC_HOST_FLAGS` at once without the for loop For obvious reasons...
2024-10-31Rollup merge of #132347 - nnethercote:rm-ValueAnalysisWrapper, r=cjgillotMatthias Krüger-474/+281
Remove `ValueAnalysis` and `ValueAnalysisWrapper`. They represent a lot of abstraction and indirection, but they're only used for `ConstAnalysis`, and apparently won't be used for any other analyses in the future. This commit inlines and removes them, which makes `ConstAnalysis` easier to read and understand. r? `@cjgillot`
2024-10-31Auto merge of #131186 - compiler-errors:precise-capturing-borrowck, r=estebankbors-45/+807
Try to point out when edition 2024 lifetime capture rules cause borrowck issues Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes. This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to `.span_warn` just so it would show up in a different color. Thoughts? Fixes #130545 Opening as a draft first since it's stacked on #131183. r? `@ghost`
2024-10-31Reduce some visibilities.Nicholas Nethercote-3/+3
2024-10-31Remove `ValueAnalysis` and `ValueAnalysisWrapper`.Nicholas Nethercote-471/+278
They represent a lot of abstraction and indirection, but they're only used for `ConstAnalysis`, and apparently won't be used for any other analyses in the future. This commit inlines and removes them, which makes `ConstAnalysis` easier to read and understand.
2024-10-31Try to point out when edition 2024 lifetime capture rules cause borrowck issuesMichael Goulet-2/+754
2024-10-31Encode cross-crate opaque type originMichael Goulet-43/+53
2024-10-31Auto merge of #132377 - matthiaskrgr:rollup-3p1c6hs, r=matthiaskrgrbors-116/+27
Rollup of 3 pull requests Successful merges: - #132368 (Remove `do_not_const_check` from `Iterator` methods) - #132373 (Make sure `type_param_predicates` resolves correctly for RPITIT) - #132374 (Remove dead code stemming from the old effects desugaring) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-31Rollup merge of #132374 - fmease:rm-dead-eff-code, r=compiler-errorsMatthias Krüger-40/+4
Remove dead code stemming from the old effects desugaring r? project-const-traits
2024-10-31Rollup merge of #132373 - compiler-errors:rpitit-bound, r=fmeaseMatthias Krüger-0/+23
Make sure `type_param_predicates` resolves correctly for RPITIT After #132194, we end up lowering the item bounds for an RPITIT in an `ItemCtxt` whose def id is the *synthetic GAT*, not the opaque type from the HIR. This means that when we're resolving a shorthand projection like `T::Assoc`, we call the `type_param_predicates` function with the `item_def_id` of the *GAT* and not the opaque. That function operates on the HIR, and is not designed to work with the `Node::Synthetic` that gets fed for items synthesized by the compiler... This PR reuses the trick we use elsewhere in lowering, where we intercept whether an item comes from RPITIT lowering, and forwards the query off to the correct item. Fixes #132372
2024-10-31Rollup merge of #132368 - compiler-errors:do-not-iterator, r=tgross35Matthias Krüger-76/+0
Remove `do_not_const_check` from `Iterator` methods This attribute is not yet used, but keeping them around seems unnecessarily risky. I don't believe we should be constifying the `Iterator` trait until we've fully thought out how const closures are gonna work and have transitively consified all of its (implementation) dependencies. cc `@rust-lang/project-const-traits` r? libs
2024-10-30Annotate `input` reference testsEric Huss-33/+55
2024-10-30Remove dead code stemming from the old effects desugaringLeón Orell Valerian Liehr-40/+4
2024-10-30Make sure type_param_predicates resolves correctly for RPITITMichael Goulet-0/+23
2024-10-30Auto merge of #132371 - workingjubilee:rollup-aqd86tm, r=workingjubileebors-1506/+1580
Rollup of 5 pull requests Successful merges: - #129383 (Remap impl-trait lifetimes on HIR instead of AST lowering) - #132210 (rustdoc: make doctest span tweak a 2024 edition change) - #132246 (Rename `rustc_abi::Abi` to `BackendRepr`) - #132267 (force-recompile library changes on download-rustc="if-unchanged") - #132344 (Merge `HostPolarity` and `BoundConstness`) Failed merges: - #132347 (Remove `ValueAnalysis` and `ValueAnalysisWrapper`.) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-31pass `RUSTC_HOST_FLAGS` at once without the for looponur-ozkan-3/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-30Rollup merge of #132344 - compiler-errors:same-thing, r=lcnrJubilee-81/+66
Merge `HostPolarity` and `BoundConstness` They're basically the same thing, and I think `BoundConstness` is easier to use. r? fee1-dead or reassign
2024-10-30Rollup merge of #132267 - onur-ozkan:rustc-if-unchanged-force-library, r=KobzolJubilee-20/+27
force-recompile library changes on download-rustc="if-unchanged" This makes the download-rustc="if-unchanged" option more functional and useful for library developers. Implements the second item from [this tracking issue](https://github.com/rust-lang/rust/issues/131744).
2024-10-30Rollup merge of #132246 - workingjubilee:campaign-on-irform, r=compiler-errorsJubilee-646/+876
Rename `rustc_abi::Abi` to `BackendRepr` Remove the confabulation of `rustc_abi::Abi` with what "ABI" actually means by renaming it to `BackendRepr`, and rename `Abi::Aggregate` to `BackendRepr::Memory`. The type never actually represented how things are passed, as that has to have `PassMode` considered, at minimum, but rather it just is how we represented some things to the backend. This conflation arose because LLVM, the primary backend at the time, would lower certain IR forms using certain ABIs. Even that only somewhat was true, as it broke down when one ventured significantly afield of what is described by the System V AMD64 ABI either by using different architectures, ABI-modifying IR annotations, the same architecture **with different ISA extensions enabled**, or other... unexpected delights. Unfortunately both names are still somewhat of a misnomer right now, as people have written code for years based on this misunderstanding. Still, their original names are even moreso, and for better or worse, this backend code hasn't received as much maintenance as the rest of the compiler, lately. Actually arriving at a correct end-state will simply require us to disentangle a lot of code in order to fix, much of it pointlessly repeated in several places. Thus this is not an "actual fix", just a way to deflect further misunderstandings.
2024-10-30Rollup merge of #132210 - notriddle:notriddle/doctest-span-hack, ↵Jubilee-13/+99
r=GuillaumeGomez rustdoc: make doctest span tweak a 2024 edition change Fixes #132203 This is a compatibility hack, because I think the new behavior is better. When an A `include_str!` B, and B `include_str!` C, the path to C should be resolved relative to B, not A. That's how `include!` itself works, so that's how `include_str!` with should work.