Commit Graph

2278 Commits

Author SHA1 Message Date
Oli Scherer
8e264ab07a s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Urgau
2f461b74ff [RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopes 2023-10-17 10:11:30 +02:00
Michael Howell
8c3eda36df 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
bjorn3
3c0d3f2bf1 Fix review comments 2023-10-09 18:39:43 +00:00
bjorn3
e006e2c9c6 Remove cgu_reuse_tracker from Session
This removes a bit of global mutable state
2023-10-09 18:39:41 +00:00
bjorn3
ed2f5baba6 Reuse determine_cgu_reuse from cg_ssa in cg_clif 2023-10-09 18:38:50 +00:00
bjorn3
5d85a24442 Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into sync_cg_clif-2023-10-09 2023-10-09 08:52:46 +00:00
bors
fea943debf 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
c9f6ac45d9 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
2753052adf 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
ed900871cf 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
f61b14dfc2 Fix misuses of a vs an
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-04 08:01:11 +08:00
bors
673f447353 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
27f88ee273 have better explanation for relate_types 2023-10-02 23:39:45 +03:00
ouz-a
646d8d9822 change is_subtype to relate_types 2023-10-02 23:39:45 +03:00
ouz-a
8c3406f8bc Add docs, remove code, change subtyper code 2023-10-02 23:39:44 +03:00
ouz-a
4e9e0aae33 subtyping_projections 2023-10-02 23:37:49 +03:00
bors
f04620a508 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
2860a89cb1 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
ffa2d3ab63 dont call mir.post_mono_checks in codegen 2023-09-30 07:38:08 +02:00
bors
81d219a27d 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
809cd20618 Skip reinterning if nothing changed 2023-09-28 16:13:38 +00:00
Oli Scherer
17d7821a2a Strip OpaqueCast during RevealAll. 2023-09-28 16:13:38 +00:00
lcnr
159293cdbf subst -> instantiate 2023-09-26 09:37:55 +02:00
Guillaume Gomez
1351de36ee 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
0e02cab8ba rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const 2023-09-21 08:12:30 +02:00
Ralf Jung
dd48b5e393 adjust constValue::Slice to work for arbitrary slice types 2023-09-19 20:17:43 +02:00
Ralf Jung
247d38d174 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
46b55ae176 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
Oli Scherer
6fd5dc8860 Prototype using const generic for simd_shuffle IDX array 2023-09-18 15:10:28 +00:00
Ralf Jung
f9f8bffaec fix gcc, cranelift build 2023-09-15 10:43:44 +02:00
Ralf Jung
89f0d18bc8 clarify PassMode::Indirect as well 2023-09-15 10:43:44 +02:00
Ralf Jung
b7cc765b60 don't point at const usage site for resolution-time errors
also share the code that emits the actual error
2023-09-14 22:34:05 +02:00
Ralf Jung
3113fef3a3 move required_consts check to general post-mono-check function 2023-09-14 22:30:42 +02:00
Ralf Jung
90d894e122 make it more clear which functions create fresh AllocId 2023-09-14 07:27:31 +02:00
Ralf Jung
a5b81faef0 cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect 2023-09-14 07:27:30 +02:00
Ralf Jung
d1ea6997e8 use AllocId instead of Allocation in ConstValue::ByRef 2023-09-14 07:26:24 +02:00
Matthias Krüger
1956fb84f3 Rollup merge of #115798 - RalfJung:non_1zst_field, r=wesleywiser
add helper method for finding the one non-1-ZST field
2023-09-13 18:37:42 +02:00
Matthias Krüger
9475cdb02d Rollup merge of #115736 - Zoxc:time-cleanup, r=wesleywiser
Remove `verbose_generic_activity_with_arg`

This removes `verbose_generic_activity_with_arg` and changes users to `generic_activity_with_arg`. This keeps the output of `-Z time` readable while these repeated events are still available with the self profiling mechanism.
2023-09-13 18:37:41 +02:00
Ralf Jung
8e6f68be39 make the eval() functions on our const types return the resulting value 2023-09-13 07:29:34 +02:00
Ralf Jung
72fb4b8f31 add helper method for finding the one non-1-ZST field 2023-09-12 20:52:05 +02:00
John Kåre Alsaker
4f6e9fd8d3 Remove verbose_generic_activity_with_arg 2023-09-10 17:47:16 +02:00
bors
c41e7794cd Auto merge of #115418 - Zoxc:freeze-source, r=oli-obk
Use `Freeze` for `SourceFile`

This uses the `Freeze` type in `SourceFile` to let accessing `external_src` and `lines` be lock-free.

Behavior of `add_external_src` is changed to set `ExternalSourceKind::AbsentErr` on a hash mismatch which matches the documentation. `ExternalSourceKind::Unneeded` was removed as it's unused.

Based on https://github.com/rust-lang/rust/pull/115401.
2023-09-08 17:20:23 +00:00
John Kåre Alsaker
4ecfd30a86 Use Freeze for SourceFile.lines 2023-09-07 13:05:05 +02:00
bors
6285086ead Auto merge of #115616 - bjorn3:sync_cg_clif-2023-09-06, r=bjorn3
Sync rustc_codegen_cranelift

Not much changed this time. Mostly doing this sync to make it easier to run the entire test suite on the in-tree version.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2023-09-07 03:56:43 +00:00
bors
d4f12a5ed3 Auto merge of #115580 - eduardosm:stdarch-intrinsics, r=davidtwco,bjorn3
Update stdarch submodule and remove special handling in cranelift codegen for some AVX and SSE2 LLVM intrinsics

https://github.com/rust-lang/stdarch/pull/1463 reimplemented some x86 intrinsics to avoid using some x86-specific LLVM intrinsics:

* Store unaligned (`_mm*_storeu_*`) use `<*mut _>::write_unaligned` instead of `llvm.x86.*.storeu.*`.
* Shift by immediate (`_mm*_s{ll,rl,ra}i_epi*`) use `if` (srl, sll) or `min` (sra) to simulate the behaviour when the RHS is out of range. RHS is constant, so the `if`/`min` will be optimized away.

This PR updates the stdarch submodule to pull these changes and removes special handling for those LLVM intrinsics from cranelift codegen. I left gcc codegen untouched because there are some autogenerated lists.
2023-09-06 22:26:37 +00:00
bjorn3
f2211c5242 Merge commit 'dda103b1e33c4902deca8bccf614991ada781fa6' into sync_cg_clif-2023-09-06 2023-09-06 18:51:03 +00:00
Eduardo Sánchez Muñoz
4cd5177015 Remove special handling in codegen for some AVX and SSE2 shift by immediate intrinsics
Those were removed from stdarch in https://github.com/rust-lang/stdarch/pull/1463 (`simd_shl` and `simd_shr` are used instead)
2023-09-05 20:17:01 +02:00
Eduardo Sánchez Muñoz
9f562f290d Remove special handling in codegen for some SSE2 "storeu" intrinsics
Those were removed from stdarch in https://github.com/rust-lang/stdarch/pull/1463 (`<*mut _>::write_unaligned` is used instead)
2023-09-05 20:06:50 +02:00
Camille GILLOT
61a0b77e17 Use relative positions inside a SourceFile. 2023-09-03 12:56:10 +00:00