Commit Graph

557 Commits

Author SHA1 Message Date
bors 3166210d68 Auto merge of #118279 - bjorn3:sync_cg_clif-2023-11-25, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlights this time are implementing a bunch of new vendor intrinsics and fixing some existing ones. And fixing polymorphization for coroutines.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-11-25 13:08:29 +00:00
bjorn3 aa51a27f8e Merge commit '710c67909d034e1c663174a016ca82b95c2d6c12' into sync_cg_clif-2023-11-25 2023-11-25 10:05:52 +00:00
David Tolnay 8cc7073d64
Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)` 2023-11-24 09:14:09 -08:00
bjorn3 b7bc8d5cb7 Fix fn_sig_for_fn_abi and the coroutine transform for generators
There were three issues previously:
* The self argument was pinned, despite Iterator::next taking an
  unpinned mutable reference.
* A resume argument was passed, despite Iterator::next not having one.
* The return value was CoroutineState<Item, ()> rather than Option<Item>

While these things just so happened to work with the LLVM backend,
cg_clif does much stricter checks when trying to assign a value to a
place. In addition it can't handle the mismatch between the amount of
arguments specified by the FnAbi and the FnSig.
2023-11-23 20:17:19 +00:00
bjorn3 4db95ce3cb Merge commit 'def04540a4e2541b995195c752c751295606a388' into sync_cg_clif-2023-11-16 2023-11-16 21:15:07 +00:00
Mark Rousskov 9e8edb6659 Add check-cfg to cranelift 2023-11-15 21:45:48 -05:00
bjorn3 d186b49460 Merge commit 'c84d1871dc4456539b7b578830268ab3539915d0' into sync_cg_clif-2023-11-10 2023-11-10 11:30:51 +00:00
Nicholas Nethercote 5c462a32bd Remove support for compiler plugins.
They've been deprecated for four years.

This commit includes the following changes.
- It eliminates the `rustc_plugin_impl` crate.
- It changes the language used for lints in
  `compiler/rustc_driver_impl/src/lib.rs` and
  `compiler/rustc_lint/src/context.rs`. External lints are now called
  "loaded" lints, rather than "plugins" to avoid confusion with the old
  plugins. This only has a tiny effect on the output of `-W help`.
- E0457 and E0498 are no longer used.
- E0463 is narrowed, now only relating to unfound crates, not plugins.
- The `plugin` feature was moved from "active" to "removed".
- It removes the entire plugins chapter from the unstable book.
- It removes quite a few tests, mostly all of those in
  `tests/ui-fulldeps/plugin/`.

Closes #29597.
2023-11-04 08:50:46 +11:00
George Bateman e936416a8d
Support enum variants in offset_of! 2023-10-31 23:25:54 +00:00
Guillaume Gomez 73100d8e93
Rollup merge of #117317 - RalfJung:track-caller, r=oli-obk
share some track_caller logic between interpret and codegen

Also move the code that implements the track_caller intrinsics out of the core interpreter engine -- it's just a helper creating a const-allocation, doesn't need to be part of the interpreter core.
2023-10-30 17:33:16 +01:00
bjorn3 a9b21bb727 Merge commit 'dde58803fd6cbb270c7a437f36a8a3a29fbef679' into sync_cg_clif-2023-10-29 2023-10-29 20:30:50 +00:00
bors 6a66ca215b Auto merge of #81746 - bjorn3:cg_clif_rustup_component, r=Mark-Simulacrum
Distribute cg_clif as rustup component on the nightly channel

This makes it possible to use cg_clif using:

```bash
$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly
$ RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build
```

cc https://github.com/rust-lang/compiler-team/issues/405.
r? `@Mark-Simulacrum`
2023-10-28 15:16:27 +00:00
Ralf Jung 04fa124feb share the track_caller handling within a mir::Body 2023-10-28 16:16:15 +02:00
Ralf Jung 351d532a27 interpret: call caller_location logic the same way codegen does, and share some code 2023-10-28 15:40:03 +02:00
bors 3089c315b1 Auto merge of #116609 - eduardosm:bump-stdarch, r=workingjubilee
Bump stdarch submodule and remove special handling for LLVM intrinsics that are no longer needed

Bumps stdarch to pull https://github.com/rust-lang/stdarch/pull/1477, which reimplemented some functions with portable SIMD intrinsics instead of arch specific LLVM intrinsics.

Handling of those LLVM intrinsics is removed from cranelift codegen and miri.

cc `@RalfJung` `@bjorn3`
2023-10-28 11:26:34 +00:00
bjorn3 d89582c8e5 Update target-lexicon to 0.12.12
This adds support for loongarch and a bunch of other targets
2023-10-27 11:56:39 +00:00
bjorn3 344752ab53 Update Cranelift to 0.101.2 and disable host-arch feature of cranelift-codegen
This ensures that cg_clif can be built for targets that aren't natively
supported by Cranelift. It will not be possible to compile for the host
in this case, but cross-compilation will still be possible.

We won't distribute cg_clif as rustup component for any targets that
aren't natively supported by Cranelift, but will still build it if
codegen-backends lists "cranelift".
2023-10-27 11:56:39 +00:00
bjorn3 484bc7fc88 Merge commit '93a5433f17ab5ed48cc88f1e69b0713b16183373' into sync_cg_clif-2023-10-24 2023-10-24 12:22:23 +00:00
bjorn3 e07f47b6c5 Merge commit 'c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa' into sync_cg_clif-2023-10-21 2023-10-21 19:54:51 +00:00
Oli Scherer e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer 60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Urgau eccc9e6628 [RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopes 2023-10-17 10:11:30 +02:00
Michael Howell 2ff2624722 docs: add Rust logo to more compiler crates
c6e6ecb1af added it to some of the
compiler's crates, but avoided adding it to all of them to reduce
bit-rot. This commit adds to more.
2023-10-16 15:38:08 -07:00
Eduardo Sánchez Muñoz b57a157092 Remove from cranelift codegen LLVM intrinsics that are no longer needed 2023-10-12 11:20:00 +02:00
bjorn3 f0b5820fa5 Fix review comments 2023-10-09 18:39:43 +00:00
bjorn3 e9fa2ca6ad Remove cgu_reuse_tracker from Session
This removes a bit of global mutable state
2023-10-09 18:39:41 +00:00
bjorn3 6b9ee90c2c Reuse determine_cgu_reuse from cg_ssa in cg_clif 2023-10-09 18:38:50 +00:00
bjorn3 169055f2ff Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into sync_cg_clif-2023-10-09 2023-10-09 08:52:46 +00:00
bors e08de86036 Auto merge of #116487 - tamird:avoid-unwrap-absolute, r=bjorn3
compiler: env/path handling fixes

Please see individual commits. r? `@bjorn3` cf. #116426
2023-10-08 05:24:16 +00:00
Jubilee 6d1c3a40cb
Rollup merge of #116277 - RalfJung:post-mono, r=oli-obk
dont call mir.post_mono_checks in codegen

It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-06 16:37:46 -07:00
Tamir Duberstein 7654d4b398
compiler: always use var_os("RUST_BACKTRACE")
There are 3 instances of var(...) and 3 instances of var_os(...); the
latter avoids an appearance of unhandled error, so use it everywhere.
2023-10-06 08:53:23 -04:00
Jubilee ea3454eabb
Rollup merge of #116223 - catandcoder:master, r=cjgillot
Fix misuses of a vs an

Fixes the misuse of "a" vs "an", according to English grammatical
expectations and using https://www.a-or-an.com/
2023-10-05 00:56:29 -07:00
cui fliter f44d116e1f Fix misuses of a vs an
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-04 08:01:11 +08:00
bors eb0f3ed59c Auto merge of #115025 - ouz-a:ouz_testing, r=lcnr
Make subtyping explicit in MIR

This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205

Addresses https://github.com/rust-lang/rust/issues/112651

r? `@lcnr`
2023-10-03 10:02:52 +00:00
ouz-a 5d753abb30 have better explanation for `relate_types` 2023-10-02 23:39:45 +03:00
ouz-a 6f0c5ee2d4 change is_subtype to relate_types 2023-10-02 23:39:45 +03:00
ouz-a cd7f471931 Add docs, remove code, change subtyper code 2023-10-02 23:39:44 +03:00
ouz-a 3148e6a993 subtyping_projections 2023-10-02 23:37:49 +03:00
bors 781ebbec8a Auto merge of #115898 - onur-ozkan:config-change-tracking, r=Mark-Simulacrum
bootstrap major change detection implementation

The use of `changelog-seen` and `bootstrap/CHANGELOG.md` has not been functional in any way for many years. We often do major/breaking changes but never update the changelog file or the `changelog-seen`. This is an alternative method for tracking major or breaking changes and informing developers when such changes occur.

Example output when bootstrap detects a major change:
![image](https://github.com/rust-lang/rust/assets/39852038/ee802dfa-a02b-488b-a433-f853ce079b8a)
2023-10-02 07:41:52 +00:00
onur-ozkan 957de61594 implement major change tracking for the bootstrap configuration
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-01 16:54:52 +03:00
Ralf Jung acb7c21507 dont call mir.post_mono_checks in codegen 2023-09-30 07:38:08 +02:00
bors 9136560d32 Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubilee
Prototype using const generic for simd_shuffle IDX array

cc https://github.com/rust-lang/rust/issues/85229

r? `@workingjubilee` on the design

TLDR: there is now a `fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;` intrinsic that allows replacing

```rust
simd_shuffle(a, b, const { stuff })
```

with

```rust
simd_shuffle_generic::<_, _, {&stuff}>(a, b)
```

which makes the compiler implementations much simpler, if we manage to at some point eliminate `simd_shuffle`.

There are some issues with this today though (can't do math without bubbling it up in the generic arguments). With this change, we can start porting the simple cases and get better data on the others.
2023-09-30 04:05:26 +00:00
Oli Scherer 2d4201f7c6 Skip reinterning if nothing changed 2023-09-28 16:13:38 +00:00
Oli Scherer 6ea2db7c2d Strip `OpaqueCast` during `RevealAll`. 2023-09-28 16:13:38 +00:00
lcnr 3c52a3e280 subst -> instantiate 2023-09-26 09:37:55 +02:00
Guillaume Gomez 208f6ed95c
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const

Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`.

Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all.

However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish...

``@oli-obk`` any ideas?
2023-09-21 13:25:39 +02:00
Ralf Jung c94410c145 rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
Ralf Jung ea22adbabd adjust constValue::Slice to work for arbitrary slice types 2023-09-19 20:17:43 +02:00
Ralf Jung 5a0a1ff0cd move ConstValue into mir
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
bors cebb9cfd4f Auto merge of #115748 - RalfJung:post-mono, r=oli-obk
move required_consts check to general post-mono-check function

This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants.

Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized.

I didn't expect this to change diagnostics, but it's just cycle errors that change.

r? `@oli-obk`
2023-09-18 19:41:21 +00:00