Commit graph

32255 commits

Author SHA1 Message Date
bors
128a2c7d30 Auto merge of #132404 - makai410:suggest-swap-lhs-rhs, r=fee1-dead
Suggest swapping LHS and RHS when RHS impls `PartialEq<lhs_ty>`

Closes: #130495
r? `@fee1-dead`
2024-11-06 11:49:52 +00:00
Vincent Esche
e6461522bc Add direct_supertraits(…) HIR-level method to hir::Trait type 2024-11-06 10:02:13 +01:00
Vincent Esche
c1155213f3 Add pub fn direct_super_traits(db, trait_id) to hir_ty crate 2024-11-06 10:02:13 +01:00
Vincent Esche
5a9767b115 Refactor hir::Trait's existing items_with_supertraits(…) method based on new all_supertraits(…) method 2024-11-06 10:02:13 +01:00
Vincent Esche
89a002ef9b Add pub fn all_supertraits(…) HIR-level method to hir::Trait type 2024-11-06 10:02:13 +01:00
bors
b46fcc1188 Auto merge of #132500 - RalfJung:char-is-whitespace-const, r=jhpratt
make char::is_whitespace unstably const

I am adding this to the existing https://github.com/rust-lang/rust/issues/132241 feature gate, since `is_digit` and `is_whitespace` seem similar enough that one can group them together.
2024-11-06 04:07:32 +00:00
Giga Bowser
494bde3c13 Properly use final tabstop when adding missing match arms 2024-11-05 12:19:20 -05:00
bors
aed7df0dd4 Auto merge of #129884 - RalfJung:forbidden-target-features, r=workingjubilee
mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature

The context for this is https://github.com/rust-lang/rust/issues/116344: some target features change the way floats are passed between functions. Changing those target features is unsound as code compiled for the same target may now use different ABIs.

So this introduces a new concept of "forbidden" target features (on top of the existing "stable " and "unstable" categories), and makes it a hard error to (un)set such a target feature. For now, the x86 and ARM feature `soft-float` is on that list. We'll have to make some effort to collect more relevant features, and similar features from other targets, but that can happen after the basic infrastructure for this landed. (These features are being collected in https://github.com/rust-lang/rust/issues/131799.)

I've made this a warning for now to give people some time to speak up if this would break something.

MCP: https://github.com/rust-lang/compiler-team/issues/780
2024-11-05 16:25:45 +00:00
bors
6f4b73397a Auto merge of #132580 - compiler-errors:globs, r=Noratrieb
Remove unnecessary pub enum glob-imports from `rustc_middle::ty`

We used to have an idiom in the compiler where we'd prefix or suffix all the variants of an enum, for example `BoundRegionKind`, with something like `Br`, and then *glob-import* that enum variant directly.

`@noratrieb` brought this up, and I think that it's easier to read when we just use the normal style `EnumName::Variant`.

This PR is a bit large, but it's just naming.

The only somewhat opinionated change that this PR does is rename `BorrowKind::Imm` to `BorrowKind::Immutable` and same for the other variants. I think these enums are used sparingly enough that the extra length is fine.

r? `@noratrieb` or reassign
2024-11-05 08:30:56 +00:00
bors
3794307e21 Auto merge of #131341 - taiki-e:ppc-clobber-abi, r=bzEq,workingjubilee
Support clobber_abi and vector registers (clobber-only) in PowerPC inline assembly

This supports `clobber_abi` which is one of the requirements of stabilization mentioned in #93335.

This basically does a similar thing I did in https://github.com/rust-lang/rust/pull/130630 to implement `clobber_abi` for s390x, but for powerpc/powerpc64/powerpc64le.
- This also supports vector registers (as `vreg`) as clobber-only, which need to support clobbering of them to implement `clobber_abi`.
- `vreg` should be able to accept `#[repr(simd)]` types as input/output if the unstable `altivec` target feature is enabled, but `core::arch::{powerpc,powerpc64}` vector types, `#[repr(simd)]`, and `core::simd` are all unstable, so the fact that this is currently a clobber-only should not be considered a blocker of clobber_abi implementation or stabilization. So I have not implemented it in this PR.
  - See https://github.com/rust-lang/rust/pull/131551 (which is based on this PR) for a PR to implement this.
  - (I'm not sticking to whether that PR should be a separate PR or part of this PR, so I can merge that PR into this PR if needed.)

Refs:
- PPC32 SysV: Section "Function Calling Sequence" in [System V Application Binary Interface PowerPC Processor Supplement](https://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf)
- PPC64 ELFv1: Section 3.2 "Function Calling Sequence" in [64-bit PowerPC ELF Application Binary Interface Supplement](https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-CALL)
- PPC64 ELFv2: Section 2.2 "Function Calling Sequence" in [64-Bit ELF V2 ABI Specification](https://openpowerfoundation.org/specifications/64bitelfabi/)
- AIX: [Register usage and conventions](https://www.ibm.com/docs/en/aix/7.3?topic=overview-register-usage-conventions), [Special registers in the PowerPC®](https://www.ibm.com/docs/en/aix/7.3?topic=overview-special-registers-in-powerpc), [AIX vector programming](https://www.ibm.com/docs/en/aix/7.3?topic=concepts-aix-vector-programming)
- Register definition in LLVM: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/PowerPC/PPCRegisterInfo.td#L189

If I understand the above four ABI documentations correctly, except for the PPC32 SysV's VR (Vector Registers) and 32-bit AIX (currently not supported by rustc)'s r13, there does not appear to be important differences in terms of implementing `clobber_abi`:
- The above four ABIs are consistent about FPR (0-13: volatile, 14-31: nonvolatile), CR (0-1,5-7: volatile, 2-4: nonvolatile), XER (volatile), and CTR (volatile).
- As for GPR, only the registers we are treating as reserved are slightly different
  - r0, r3-r12 are volatile
  - r1(sp, reserved), r14-31 are nonvolatile
  - r2(reserved) is TOC pointer in PPC64 ELF/AIX, system-reserved register in PPC32 SysV (AFAIK used as thread pointer in Linux/BSDs)
  - r13(reserved for non-32-bit-AIX) is thread pointer in PPC64 ELF, small data area pointer register in PPC32 SysV, "reserved under 64-bit environment; not restored across system calls[^r13]" in AIX)
- As for FPSCR, volatile in PPC64 ELFv1/AIX, some fields are volatile only in certain situations (rest are volatile) in PPC32 SysV/PPC64 ELFv2.
- As for VR (Vector Registers), it is not mentioned in PPC32 SysV, v0-v19 are volatile in both in PPC64 ELF/AIX, v20-v31 are nonvolatile in PPC64 ELF, reserved or nonvolatile depending on the ABI ([vec-extabi vs vec-default in LLVM](https://reviews.llvm.org/D89684), we are [using vec-extabi](https://github.com/rust-lang/rust/pull/131341#discussion_r1797693299)) in AIX:
  > When the default Vector enabled mode is used, these registers are reserved and must not be used.
  > In the extended ABI vector enabled mode, these registers are nonvolatile and their values are preserved across function calls

  I left [FIXME comment about PPC32 SysV](https://github.com/rust-lang/rust/pull/131341#discussion_r1790496095) and added ABI check for AIX.
- As for VRSAVE, it is not mentioned in PPC32 SysV, nonvolatile in PPC64 ELFv1, reserved in PPC64 ELFv2/AIX
- As for VSCR, it is not mentioned in PPC32 SysV/PPC64 ELFv1, some fields are volatile only in certain situations (rest are volatile) in PPC64 ELFv2, volatile in AIX

We are currently treating r1-r2, r13 (non-32-bit-AIX), r29-r31, LR, CTR, and VRSAVE as reserved.
We are currently not processing anything about FPSCR and VSCR, but I feel those are things that should be processed by `preserves_flags` rather than `clobber_abi` if we need to do something about them. (However, PPCRegisterInfo.td in LLVM does not seem to define anything about them.)

Replaces #111335 and #124279

cc `@ecnelises` `@bzEq` `@lu-zero`

r? `@Amanieu`

`@rustbot` label +O-PowerPC +A-inline-assembly

[^r13]: callee-saved, according to [LLVM](6a6af0246b/llvm/lib/Target/PowerPC/PPCCallingConv.td (L322)) and [GCC](a9173a50e7/gcc/config/rs6000/rs6000.h (L859)).
2024-11-05 03:13:47 +00:00
bors
9fc948c851 Auto merge of #132594 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-11-04 20:20:16 +00:00
Laurențiu Nicola
b51f9bc736
Merge pull request #18478 from lnicola/triagebot-transfer
minor: Enable triagebot `transfer` feature
2024-11-04 19:51:08 +00:00
Laurențiu Nicola
0cdb5429a2 Enable triagebot transfer feature 2024-11-04 21:35:10 +02:00
Laurențiu Nicola
143bba5be2
Merge pull request #18477 from lnicola/rm-ap-text-edit
minor: Don't try to auto-publish text-edit
2024-11-04 13:37:01 +00:00
Laurențiu Nicola
a2a9a048b6 Don't try to auto-publish text-edit 2024-11-04 15:23:05 +02:00
Lukas Wirth
1d65cd466f
Merge pull request #18475 from Veykril/push-zkvkpxttozup
Support new #[rustc_intrinsic] attribute and fallback bodies
2024-11-04 12:48:00 +00:00
Lukas Wirth
36d68c5d0f Support new #[rustc_intrinsic] attribute and fallback bodies 2024-11-04 13:33:55 +01:00
Lukas Wirth
9ad98df61d
Merge pull request #18473 from Veykril/push-xnlzukoqttvz
Render extern blocks in `file_structure`
2024-11-04 11:34:35 +00:00
Lukas Wirth
3ceaf1fb68 Render extern blocks in file_structure 2024-11-04 12:21:05 +01:00
Laurențiu Nicola
a341d598dc
Merge pull request #18472 from lnicola/reinterpret-function-casing
minor: Fix feature name casing
2024-11-04 08:39:50 +00:00
Laurențiu Nicola
881ef8bf13 Fix feature name casing 2024-11-04 10:27:32 +02:00
bors
041af8ed86 Auto merge of #123723 - madsmtm:apple-std-os, r=dtolnay
Make `std::os::darwin` public

I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public.

Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication.

Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Since you reviewed https://github.com/rust-lang/rust/pull/121419
r? davidtwco

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

`@rustbot` label O-tvos O-watchos O-visionos
2024-11-03 22:25:11 +00:00
Lukas Wirth
e44691a604
Merge pull request #18470 from Veykril/push-rxmtkvpulotn
Allow interpreting consts and statics with interpret function command
2024-11-03 14:49:27 +00:00
Lukas Wirth
78f3112626 Allow interpreting consts and statics with interpret function command 2024-11-03 15:35:45 +01:00
Lukas Wirth
20ab9708b4
Merge pull request #18469 from Veykril/push-zwnywqmvtuts
feat: Show `static` values on hover
2024-11-03 13:00:32 +00:00
bors
74f8885d54 Auto merge of #132419 - durin42:llvm-20-type-test-thing, r=cuviper
PassWrapper: adapt for llvm/llvm-project@b01e2a8b56

A boolean turned into an enum. None matches the old behavior of false, so we pass that.

`@rustbot` label: +llvm-main
2024-11-03 08:08:00 +00:00
Laurențiu Nicola
f17a5bbfd0
Merge pull request #18463 from benluiwj/fix/proc-macro-server-msg-improvement
Improve error message for too new proc-macro server
2024-11-02 13:58:33 +00:00
benluiwj
1c71a50e01 Improve error message for too new proc-macro server 2024-11-02 21:46:05 +08:00
Lukas Wirth
94c35f6138 Allow static initializers to be const evaluated 2024-11-02 12:43:11 +01:00
bors
39dc1dc721 Auto merge of #132352 - DianQK:llvm/19.1.3, r=nikic
Update LLVM to 19.1.3

Closes #131031.

r? nikic
2024-11-02 04:59:26 +00:00
Giga Bowser
92b2b3d26b Use snippet placeholders for generated match arms 2024-11-01 12:35:01 -04:00
bors
7746666f41 Auto merge of #132196 - compiler-errors:probe_ty_param_bounds, r=petrochenkov
Some where clause lowering simplifications

Rename `PredicateFilter::SelfThatDefines` to `PredicateFilter::SelfTraitThatDefines` to make it clear that it's only concerned with converting *traits*, and make it do a bit less work when converting bounds.

Also, make the predicate filter matching in `probe_ty_param_bounds_in_generics` explicit, and simply the args it receives a bit.
2024-11-01 15:40:13 +00:00
Laurențiu Nicola
d1fbfc676b
Merge pull request #18457 from lnicola/sync-from-rust
minor: Sync from downstream
2024-11-01 12:26:18 +00:00
Laurențiu Nicola
b385bf2e53 Format code 2024-11-01 14:12:18 +02:00
Laurențiu Nicola
724f161cc9 Bump rustc crates 2024-11-01 13:38:35 +02:00
Laurențiu Nicola
fabe447c7d Merge from rust-lang/rust 2024-11-01 13:14:25 +02:00
Laurențiu Nicola
63b149c8d1 Preparing for merge from rust-lang/rust 2024-11-01 13:14:16 +02:00
bors
fba37a0537 Auto merge of #132402 - bjorn3:remove_snap_decompression, r=jieyouxu,Veykril
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.

Fixes https://github.com/rust-lang/rust-analyzer/issues/18451
2024-11-01 08:01:24 +00:00
bors
a45eb339a0 Auto merge of #131634 - davidlattimore:lld-protected, r=Kobzol
Use protected visibility when building rustc with LLD

https://github.com/rust-lang/compiler-team/issues/782

I wasn't sure about having two commits in a PR, but I figured, at least initially it might make sense to discuss these commits together. Happy to squash, or move the second commit to a separate PR.

I contemplated trying to enable protected visibility for more cases when LLD will be used other than just `-Zlinker-features=+lld`, but that would be more a complex change that probably still wouldn't cover all cases when LLD is used, so went with the simplest option of just checking if the linker-feature is enabled.

r? lqd
2024-11-01 05:25:27 +00:00
bors
e88a64e1c4 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
Lukas Wirth
0ba893e1a0
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
Chayim Refael Friedman
210ead8454 Parse patterns with leading pipe properly in all places 2024-10-31 15:32:37 +02:00
Lukas Wirth
86a850d49e
Merge pull request #18447 from ChayimFriedman2/cleanup-tylowerctx
Avoid interior mutability in `TyLoweringContext`
2024-10-31 12:48:17 +00:00
bjorn3
ad858841e7 Remove support for compressed dylib metadata from rust-analyzer 2024-10-31 12:48:09 +00:00
bors
82de3b4fab 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
Lukas Wirth
1aac2c637b
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
70348faf2b Move child_by_source from hir-def to hir 2024-10-31 09:28:08 +01:00
Lukas Wirth
fb8ca32d06
Merge pull request #18437 from sam-mccall/publish_fixture
Publish test-fixture => ra_ap_test_fixture
2024-10-31 08:03:44 +00:00
bors
7c005ad57a Auto merge of #132377 - matthiaskrgr:rollup-3p1c6hs, r=matthiaskrgr
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-31 00:46:22 +00:00
bors
5dc348265f Auto merge of #132371 - workingjubilee:rollup-aqd86tm, r=workingjubilee
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-30 22:07:49 +00:00