Commit Graph

269878 Commits

Author SHA1 Message Date
Jubilee
e31988cfc9
Rollup merge of #132209 - compiler-errors:modifiers, r=fmease
Fix validation when lowering `?` trait bounds

Pass the unlowered (`rustc_hir`) polarity to `lower_poly_trait_ref`.

This allows us to actually *validate* that generic args are actually valid on `?Trait` paths. This actually regressed in #113671 because that PR changed the behavior where we were inadvertently re-lowering paths as `BoundPolarity::Positive`, which was also coincidentally the only place we were enforcing the generics on `?Trait` paths were correct.
2024-10-31 17:50:40 -07:00
Jubilee
a43492b884
Rollup merge of #131168 - madsmtm:target-info-psx-os, r=davidtwco
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-31 17:50:40 -07:00
bors
24254efb43 Auto merge of #132206 - tgross35:update-builtins, r=wesleywiser
Update compiler-builtins to 0.1.136

This includes:

* The license change https://github.com/rust-lang/compiler-builtins/pull/717
* The `libm` submodule update, which also has a license change https://github.com/rust-lang/libm/pull/317
* Re-enabling `math` on i686 UEFI https://github.com/rust-lang/compiler-builtins/pull/715

Fixes: https://github.com/rust-lang/rust/issues/128533
2024-10-31 23:31:48 +00:00
Matthew Maurer
9caced7bad llvm: Match new LLVM 128-bit integer alignment on sparc
LLVM continues to align more 128-bit integers to 128-bits in the data
layout rather than relying on the high level language to do it. Update
SPARC target files to match and add a backcompat replacement for current
LLVMs.

See llvm/llvm-project#106951 for details
2024-10-31 20:37:54 +00:00
beetrees
abb05c0fd5
Remove "" case from RISC-V llvm_abiname match statement 2024-10-31 19:17:07 +00:00
Tyler Mandry
5b9d2848cb Bump Fuchsia 2024-10-31 12:16:26 -07:00
Mads Marquart
40f4b216eb Document the difference between Clang's -darwin and -macosx targets 2024-10-31 18:20:57 +01:00
bors
a0d98ff0e5 Auto merge of #132356 - jieyouxu:unsound-simplify_aggregate_to_copy, 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-31 15:29:14 +00:00
Lukas Wirth
a5b5b466b0
Merge pull request #18453 from ChayimFriedman2/leading-or
Parse patterns with leading pipe properly in all places
2024-10-31 14:49:35 +00:00
lcnr
dc750665ae normalization folders, yeet ParamEnv::reveal 2024-10-31 14:55:53 +01:00
lcnr
2cde638ac0 stop using ParamEnv::reveal while handling MIR 2024-10-31 14:55:53 +01:00
Chayim Refael Friedman
f0bf75d647 Parse patterns with leading pipe properly in all places 2024-10-31 15:32:37 +02:00
bors
20c909ff9c Auto merge of #132401 - matthiaskrgr:rollup-599ieqr, r=matthiaskrgr
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-31 12:57:11 +00:00
Lukas Wirth
b25a3de4d1
Merge pull request #18447 from ChayimFriedman2/cleanup-tylowerctx
Avoid interior mutability in `TyLoweringContext`
2024-10-31 12:48:17 +00:00
bjorn3
3cc0ba8337 Remove support for compressed dylib metadata from rust-analyzer 2024-10-31 12:48:09 +00:00
bjorn3
87b9c092fb Remove support for decompressing dylib metadata
We haven't been compressing dylib metadata for a while now. Removing
decompression support will regress error messages about an incompatible
rustc version being used, but dylibs are pretty rare anyway.
2024-10-31 11:51:00 +00:00
lcnr
563c473e8d clippy: we've got a LateContext use it for TypingMode 2024-10-31 12:43:22 +01:00
lcnr
aab149b58c ConstCx stop using ParamEnv::reveal 2024-10-31 12:43:22 +01:00
Matthias Krüger
c9584b7a96
Rollup merge of #132396 - 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-31 12:35:57 +01:00
Matthias Krüger
bfc956e36f
Rollup merge of #132395 - Zalathar:coverage-cx-ice, r=jieyouxu
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-31 12:35:56 +01:00
Matthias Krüger
6b96a7944a
Rollup merge of #132354 - koute:master, r=workingjubilee
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-31 12:35:56 +01:00
Matthias Krüger
76b748ad19
Rollup merge of #132316 - MarcoIeni:ci-free-runners-windows, r=Mark-Simulacrum
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-31 12:35:55 +01:00
Matthias Krüger
2da55600bc
Rollup merge of #130693 - jieyouxu:minicore, r=bjorn3
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-31 12:35:55 +01:00
lcnr
84295b917d traits::project: yeet ParamEnv::reveal 2024-10-31 12:06:19 +01:00
MarcoIeni
3036f4f668
CI: use free runners for x86_64-gnu-tools and x86_64-rust-for-linux 2024-10-31 11:29:29 +01:00
Zalathar
8dddd1ae60 coverage: Avoid ICE when coverage_cx is unexpectedly unavailable 2024-10-31 21:25:43 +11:00
许杰友 Jieyou Xu (Joe)
adb6d4752f tests: use minicore in tests/ui/abi/compatibility.rs as an example 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
0bbe07e8ff tests/ui: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
a8b34f58cf tests/codegen: add minicore compiletest self-test 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
b115a22828 tests/assembly: add minicore compiletest self-test
Check that `minicore` cannot be used with `run-{pass,fail}` tests.
2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
59cb59d74d compiletest: stamp minicore.rs to rerun tests on changes 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
a737f75a04 compiletest: conditionally build and provide minicore as extern prelude when requested via //@ add-core-stubs directive
`//@ add-core-stubs` will imply `-Cpanic=abort`.
2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
95d01fcee9 compiletest: register --minicore-path flag and //@ add-core-stubs directive 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
74c0c48858 compiletest: localize compile_test_and_save_assembly to assembly test module 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
f9ca4201f8 bootstrap: pass minicore path when running compiletest step 2024-10-31 18:20:11 +08:00
许杰友 Jieyou Xu (Joe)
82c2e42894 minicore: add minimal minicore test auxiliary
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-31 18:20:11 +08:00
bors
9ccfedf186 Auto merge of #132301 - compiler-errors:adjust, r=lcnr
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-31 10:17:49 +00:00
Mara Bos
a433ea2518 Update tests. 2024-10-31 10:55:45 +01:00
Mara Bos
cb26fa07bb Improve the missing_abi lint. 2024-10-31 10:55:45 +01:00
MarcoIeni
183599fa99
CI: use free runners for 3 fast windows jobs 2024-10-31 10:38:42 +01:00
David Lattimore
00da974c5c Use protected symbols when building rustc_driver 2024-10-31 20:26:21 +11:00
Lukas Wirth
2a9b851c3e
Merge pull request #18448 from Veykril/push-zwuuoytnmnqz
Move `child_by_source` from `hir-def` to `hir`
2024-10-31 08:42:59 +00:00
Lukas Wirth
bc862b897d Move child_by_source from hir-def to hir 2024-10-31 09:28:08 +01:00
Lukas Wirth
7ca05b5432
Merge pull request #18437 from sam-mccall/publish_fixture
Publish test-fixture => ra_ap_test_fixture
2024-10-31 08:03:44 +00:00
Jan Bujak
c1db011ccb Add lp64e ABI to the spec tests match 2024-10-31 16:38:47 +09:00
Jan Bujak
44b720a2d4 Add a comment about lp64e still being unstable 2024-10-31 16:38:45 +09:00
bors
4d296eabe4 Auto merge of #132384 - matthiaskrgr:rollup-0ze5wc4, r=matthiaskrgr
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-31 06:22:57 +00:00
许杰友 Jieyou Xu (Joe)
cfb4c05d77 Add a mir-opt GVN test for #128299
Co-authored-by: DianQK <dianqk@dianqk.net>
2024-10-31 13:48:35 +08:00
许杰友 Jieyou Xu (Joe)
10b8ba4ecb Mark simplify_aggregate_to_copy mir-opt as unsound
Co-authored-by: DianQK <dianqk@dianqk.net>
2024-10-31 13:48:06 +08:00
Jubilee Young
8a0e64078e compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build
Completely abandon usage of rustc_target in these crates, as
they need no special knowledge of rustc's target tuples.
2024-10-30 22:38:49 -07:00