Commit Graph

11142 Commits

Author SHA1 Message Date
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 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 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
carbotaniuman a23917cfd0 Add hard error and migration lint for unsafe attrs 2024-06-23 19:02:14 -05: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 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
bors aabbf84b45 Auto merge of #123088 - tgross35:f16-f128-pattern-analysis, r=Nadrieril
Replace `f16` and `f128` pattern matching stubs with real implementations

This section of code depends on `rustc_apfloat` rather than our internal types, so this is one potential ICE that we should be able to melt now.

r? `@Nadrieril`
2024-06-23 14:14:48 +00:00
Chris Denton b8a0030358
Add need-symlink directive to compiletest 2024-06-23 13:42:52 +00:00
bors c3d7fb3985 Auto merge of #124733 - workingjubilee:cant-beleaf-we-dont-have-this, r=saethlin
Support `-Cforce-frame-pointers=non-leaf`

Why don't we already support this...?

Suggested impl for https://github.com/rust-lang/compiler-team/issues/744
2024-06-23 11:12:11 +00:00
Trevor Gross 28ce7cd03e Change a fixed crash test to a standard test
Fixes <https://github.com/rust-lang/rust/issues/122587>
2024-06-23 04:28:42 -05:00
Trevor Gross 6fb6c19c96 Replace `f16` and `f128` pattern matching stubs with real implementations
This section of code depends on `rustc_apfloat` rather than our internal
types, so this is one potential ICE that we should be able to melt now.

This also fixes some missing range and match handling in `rustc_middle`.
2024-06-23 04:28:42 -05:00
Matthias Krüger 9459fc20d7
Rollup merge of #126843 - workingjubilee:allow-variadics-in-c-unwind, r=nnethercote
Allow "C-unwind" fn to have C variadics

Fixes #126836
2024-06-23 09:45:30 +02:00
Matthias Krüger 4a94e8089d
Rollup merge of #126720 - Rejyr:migrate-branch-protection-rmake, r=jieyouxu
Ignore `branch-protection-check-IBT` run-make test

The old Makefile implementation (#110304) had an improper comparison which caused the test to never run. However, both the updated Makefile implementation and the rmake implementation fail (missing `.note.gnu.property`). This could be a bug in the original implementation or test flakiness.

Edit: Manually recreating the test case shows that `.note.gnu.property` does not appear in nightly.
```rust
// main.rs
fn main() {
    println!("hello world");
}
```
```sh
$ rustc +nightly -V
rustc 1.81.0-nightly (c1b336cb6 2024-06-21)
$ rustc +stable -V
rustc 1.79.0 (129f3b996 2024-06-10)
```
```sh
$ rustc +nightly -Zcf-protection=branch -Clink-args=-nostartfiles -Csave-temps "-L$PWD" main.rs -o main
$ llvm-readobj --elf-output-style=GNU -nW main
Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000008       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: bcae34e6431b2a37
```
Compiling without the other flags still does not show `.note.gnu.property`.
```sh
$ rustc +nightly main.rs -o main
$ llvm-readobj --elf-output-style=GNU -nW main
Displaying notes found in: .note.ABI-tag
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 4.4.0

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000008       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: d60d5f108b63bf3a
```
Compiling on stable shows `.note.gnu.property`.
```sh
$ rustc +stable main.rs -o main
$ llvm-readobj --elf-output-style=GNU -nW main
Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_PROPERTY_TYPE_0 (property note)
    Properties:    x86 ISA needed: x86-64-baseline

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 4a494eb578123314e6ff1caf1c8877e27004664f

Displaying notes found in: .note.ABI-tag
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 4.4.0
```

Part of #121876.

r? `@jieyouxu`
2024-06-23 09:45:27 +02:00
Jubilee Young c72a6ad8f2 test: ignore force-frame-pointers test on some targets
all of these currently force stronger frame pointers, and
currently the CLI does not override the target
2024-06-23 00:40:43 -07:00
Jubilee Young f301d087d4 test: for frame-pointer=non-leaf codegen opts 2024-06-23 00:36:33 -07:00
Jubilee Young 43a6b018a2 compiler: Mention C-unwind in C-variadic error 2024-06-22 23:30:31 -07:00
Jubilee Young 0d8f734172 compiler: Fix arm32 asm issues by hierarchically sorting reg classes 2024-06-22 21:39:58 -07:00
bors d4cc01c2f2 Auto merge of #126715 - Rejyr:migrate-readelf-rmake, r=jieyouxu
Migrate `relro-levels`, `static-pie` to `rmake`

Part of #121876.

r? `@jieyouxu`

try-job: aarch64-gnu
try-job: arm-android
try-job: armhf-gnu
try-job: dist-i586-gnu-i586-i686-musl
try-job: dist-various-1
try-job: test-various
2024-06-23 03:43:25 +00:00
surechen e8b5ba1111 For [E0308]: mismatched types, when expr is in an arm's body, not add semicolon ';' at the end of it.
fixes #126222
2024-06-23 10:19:02 +08:00
Jerry Wang 75a9379c0f
(wip) Migrate `branch-protection-check-IBT` to `rmake` 2024-06-22 20:18:02 -04:00
Jerry Wang a19077d0f3
Enable cross compilation on `run-make/relro-levels` 2024-06-22 19:44:51 -04:00
Jubilee Young 26dccadb47 Allow "C-unwind" fn to have C variadics 2024-06-22 15:14:14 -07:00
bors 3cb521a434 Auto merge of #126761 - GuillaumeGomez:unsafe_extern_blocks, r=spastorino
rustdoc: Add support for `missing_unsafe_on_extern` feature

Follow-up of https://github.com/rust-lang/rust/pull/124482.

Not sure if the `safe` keyword is supposed to be displayed or not though? For now I didn't add it in the generated doc, only `unsafe` as usual.

cc `@spastorino`
r? `@fmease`
2024-06-22 20:59:00 +00:00
Jerry Wang c69770d730
Migrate `static-pie` scripts to `rmake` 2024-06-22 14:15:23 -04:00
Jerry Wang f90d4e4371
Migrate `static-pie` to `rmake` 2024-06-22 14:15:22 -04:00
Jerry Wang e16f492e42
Migrate `relro-levels` to `rmake` 2024-06-22 14:15:22 -04:00
Matthias Krüger dc9a08f535
Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errors
Remove use of const traits (and `feature(effects)`) from stdlib

The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands.

Also, make `effects` an incomplete feature.

cc `@rust-lang/project-const-traits`
r? `@compiler-errors`
2024-06-22 19:33:56 +02:00
Vadim Petrochenkov 0a265957dd delegation: Do not crash on qpaths without a trait 2024-06-22 19:57:19 +03:00
Ralf Jung 763e3131cc don't ICE when encountering an extern type field during validation 2024-06-22 17:39:01 +02:00
Deadbeef 81da6a6d40 Make `effects` an incomplete feature 2024-06-22 14:11:11 +00:00
Guillaume Gomez d265538016
Rollup merge of #126823 - GuillaumeGomez:migrate-run-make-inline-always-many-cgu, r=Kobzol
Migrate `run-make/inline-always-many-cgu` to `rmake.rs`

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

r? `@jieyouxu`
2024-06-22 12:57:21 +02:00
Guillaume Gomez 399c5cabdd
Rollup merge of #126723 - estebank:dot-dot-dot, r=Nadrieril
Fix `...` in multline code-skips in suggestions

When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was inconsistent with what we do in every other case *and* off-center.
2024-06-22 12:57:19 +02:00
Guillaume Gomez 3ed2cd74b5
Rollup merge of #126686 - fmease:dump-preds-n-item-bounds, r=compiler-errors
Add `#[rustc_dump_{predicates,item_bounds}]`

Conflicts with #126668.

As discussed
r? compiler-errors CC ``@fee1-dead``
2024-06-22 12:57:19 +02:00
Guillaume Gomez 07e8b3ac01
Rollup merge of #126555 - beetrees:f16-inline-asm-arm, r=Amanieu
Add `f16` inline ASM support for 32-bit ARM

Adds `f16` inline ASM support for 32-bit ARM. SIMD vector types are taken from [here](https://developer.arm.com/architectures/instruction-sets/intrinsics/#f:`@navigationhierarchiesreturnbasetype=[float]&f:@navigationhierarchieselementbitsize=[16]&f:@navigationhierarchiesarchitectures=[A32]).`

Relevant issue: #125398
Tracking issue: #116909

`@rustbot` label +F-f16_and_f128
2024-06-22 12:57:18 +02:00
Guillaume Gomez e7dfd4a913 Migrate `run-make/inline-always-many-cgu` to `rmake.rs` 2024-06-22 12:35:58 +02:00
León Orell Valerian Liehr 38bd7a0fcb
Add `#[rustc_dump_{predicates,item_bounds}]` 2024-06-22 06:34:09 +02:00
Jubilee 1916b3d57f
Rollup merge of #126811 - compiler-errors:tidy-ftl, r=estebank
Add a tidy rule to check that fluent messages and attrs don't end in `.`

This adds a new dependency on `fluent-parse` to `tidy` -- we already rely on it in rustc so I feel like it's not that big of a deal.

This PR also adjusts many error messages that currently end in `.`; not all of them since I added an `ALLOWLIST`, excluded `rustc_codegen_*` ftl files, and `.teach_note` attributes.

r? ``@estebank`` ``@oli-obk``
2024-06-21 21:02:29 -07:00
Jubilee 539090e5cd
Rollup merge of #126809 - estebank:wording-tweak, r=oli-obk
Remove stray `.` from error message
2024-06-21 21:02:28 -07:00
Jubilee 1f9793f1aa
Rollup merge of #126722 - adwinwhite:ptr_fn_abi, r=celinval
Add method to get `FnAbi` of function pointer

Provide a StableMIR API to query `FnAbi` of a function pointer.

Fixes [rust-lang/project-stable-mir#63](https://github.com/rust-lang/project-stable-mir/issues/63)
2024-06-21 21:02:27 -07:00
Jubilee 84b0922565
Rollup merge of #126712 - Oneirical:bootest-constestllation, r=jieyouxu
Migrate `relocation-model`, `error-writing-dependencies` and `crate-name-priority` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs MSVC try-job due to #28026, almost guaranteed to fail, but let's see anyways.

try-job: aarch64-gnu
`/* try-job: x86_64-msvc */`
try-job: x86_64-apple-1
try-job: armhf-gnu
try-job: test-various
2024-06-21 21:02:26 -07:00
Jubilee e7956cd994
Rollup merge of #126530 - beetrees:f16-inline-asm-riscv, r=Amanieu
Add `f16` inline ASM support for RISC-V

This PR adds `f16` inline ASM support for RISC-V. A `FIXME` is left for `f128` support as LLVM does not support the required `Q` (Quad-Precision Floating-Point) extension yet.

Relevant issue: #125398
Tracking issue: #116909

`@rustbot` label +F-f16_and_f128
2024-06-21 21:02:26 -07:00
Michael Goulet ffd72b1700 Fix remaining cases 2024-06-21 19:00:18 -04:00
Esteban Küber 5d5892e966 Remove stray `.` from error message 2024-06-21 21:13:10 +00:00
beetrees 771e44ebd3
Add `f16` inline ASM support for RISC-V 2024-06-21 18:48:20 +01:00
beetrees 753fb070bb
Add `f16` inline ASM support for 32-bit ARM 2024-06-21 18:26:42 +01:00
Santiago Pastorino 22831ed117
Do not allow safe usafe on static and fn items 2024-06-21 09:12:13 -03:00
Deadbeef a6a83d3d4e bless tests 2024-06-21 11:57:24 +00:00
bors d40f30e1df Auto merge of #126781 - matthiaskrgr:rollup-5u4pens, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #126125 (Improve conflict marker recovery)
 - #126481 (Add `powerpc-unknown-openbsd` maintenance status)
 - #126613 (Print the tested value in int_log tests)
 - #126617 (Expand `avx512_target_feature` to include VEX variants)
 - #126700 (Make edition dependent `:expr` macro fragment act like the edition-dependent `:pat` fragment does)
 - #126707 (Pass target to inaccessible-temp-dir rmake test)
 - #126767 (`StaticForeignItem` and `StaticItem` are the same)
 - #126774 (Fix another assertion failure for some Expect diagnostics.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-21 09:22:09 +00:00
bors e32ea4822b Auto merge of #126541 - scottmcm:more-ptr-metadata-gvn, r=cjgillot
More ptr metadata gvn

There's basically 3 parts to this PR.

1. Allow references as arguments to `UnOp::PtrMetadata`

This is a MIR semantics addition, so
r? mir

Rather than just raw pointers, also allow references to be passed to `PtrMetadata`.  That means the length of a slice can be just `PtrMetadata(_1)` instead of also needing a ref-to-pointer statement (`_2 = &raw *_1` + `PtrMetadata(_2)`).

AFAIK there should be no provenance or tagging implications of looking at the *metadata* of a pointer, and the code in the backends actually already supported it (other than a debug assert, given that they don't care about ptr vs reference, really), so we might as well allow it.

2. Simplify the argument to `PtrMetadata` in GVN

Because the specific kind of pointer-like thing isn't that important, GVN can simplify all those details away.  Things like `*const`-to-`*mut` casts and `&mut`-to-`&` reborrows are irrelevant, and skipping them lets it see more interesting things.

cc `@cjgillot`

Notably, unsizing casts for arrays.  GVN supported that for `Len`, and now it sees it for `PtrMetadata` as well, allowing `PtrMetadata(pointer)` to become a constant if that pointer came from an array-to-slice unsizing, even through a bunch of other possible steps.

3. Replace `NormalizeArrayLen` with GVN

The `NormalizeArrayLen` pass hasn't been running even in optimized builds for well over a year, and it turns out that GVN -- which *is* on in optimized builds -- can do everything it was trying to do.

So the code for the pass is deleted, but the tests are kept, just changed to the different pass.

As part of this, `LowerSliceLen` was changed to emit `PtrMetadata(_1)` instead of `Len(*_1)`, a small step on the road to eventually eliminating `Rvalue::Len`.
2024-06-21 07:12:50 +00:00