Commit Graph

268057 Commits

Author SHA1 Message Date
Mateusz Mikuła
9d2495db60 enable f16 and f128 on windows-gnullvm targets 2024-10-05 23:55:39 +02:00
onur-ozkan
4f50efd132 update "build/host" symlink comment
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-05 22:48:55 +03:00
bors
9096f4fafa Auto merge of #131302 - matthiaskrgr:rollup-56kbpzx, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #130555 ( Initial support for riscv32{e|em|emc}_unknown_none_elf)
 - #131280 (Handle `rustc_interface` cases of `rustc::potential_query_instability` lint)
 - #131281 (make Cell unstably const)
 - #131285 (clarify semantics of ConstantIndex MIR projection)
 - #131299 (fix typo in 'lang item with track_caller' message)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-05 19:32:38 +00:00
Yoh Deadfall
2223328d16 Android: Debug assertion after setting thread name 2024-10-05 21:29:40 +03:00
Matthias Krüger
6a85c32f55
Rollup merge of #131299 - RalfJung:lang-item-track-caller, r=compiler-errors
fix typo in 'lang item with track_caller' message

Revival of https://github.com/rust-lang/rust/pull/124912
2024-10-05 19:07:55 +02:00
Matthias Krüger
c45f902723
Rollup merge of #131285 - RalfJung:mir-projection-sem, r=cjgillot
clarify semantics of ConstantIndex MIR projection

This documents what Miri does:
c4ce8c114b/compiler/rustc_const_eval/src/interpret/projection.rs (L272-L275)

I am not sure what exactly the purpose of this `min_length` field is, TBH... but this seems like the most obvious meaning it could have?
2024-10-05 19:07:55 +02:00
Matthias Krüger
388c10b2ac
Rollup merge of #131281 - RalfJung:const-cell, r=Amanieu
make Cell unstably const

Now that we can do interior mutability in `const`, most of the Cell API can be `const fn`. :)  The main exception is `set`, because it drops the old value. So from const context one has to use `replace`, which delegates the responsibility for dropping to the caller.

Tracking issue: https://github.com/rust-lang/rust/issues/131283

`as_array_of_cells` is itself still unstable to I added the const-ness to the feature gate for that function and not to `const_cell`, Cc #88248.

r? libs-api
2024-10-05 19:07:54 +02:00
Matthias Krüger
2e80beb36c
Rollup merge of #131280 - ismailarilik:handle-potential-query-instability-lint-for-rustc-interface, r=cjgillot
Handle `rustc_interface` cases of `rustc::potential_query_instability` lint

This PR removes `#![allow(rustc::potential_query_instability)]` occurrences from [`compiler/rustc_interface/`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_interface/) <s>and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors</s> (was not necessary for this PR).

A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447

r? `@compiler-errors`
2024-10-05 19:07:54 +02:00
Matthias Krüger
8e31e98ff9
Rollup merge of #130555 - hegza:rv32e, r=workingjubilee
Initial support for riscv32{e|em|emc}_unknown_none_elf

We have a research prototype of an RV32EMC target and have been successfully running the e, em, emc programs on it. I'm hoping upstreaming this configuration would make the target maintenance slightly easier.

Configuration is based on the respective {i, im, imc} variants. As defined in RISC-V Unprivileged Spec. 20191213, the only change in RVE wrt. RVI is to reduce the number of integer registers to 16 (x0-x15), which also implies

- 2 callee saved registers instead of 12
- 32-bit / 4-byte stack alignment instead of 128 bits / 16 bytes

My initial presumption is that this will not impact how the target is defined for the compiler but only becomes relevant at the runtime level. I am willing to investigate, though.

EDIT: LLVM is now told about the presumed 32-bit stack alignment.

`@Disasm` `@romancardenas`
2024-10-05 19:07:53 +02:00
bors
2b21f90d5e Auto merge of #131221 - XrXr:bump-compiler-builtins, r=tgross35
Update compiler-builtins to 0.1.132

This commit updates compiler-builtins from 0.1.130 to 0.1.132.

PRs in the delta:
 - rust-lang/compiler-builtins#698
 - rust-lang/compiler-builtins#699
 - rust-lang/compiler-builtins#701
 - rust-lang/compiler-builtins#704
 - rust-lang/compiler-builtins#627
 - rust-lang/compiler-builtins#706
2024-10-05 17:07:21 +00:00
Ralf Jung
7d63efdb8c fix GVN trying to transmute pointers to integers 2024-10-05 17:55:23 +02:00
Ralf Jung
8faf3722ac fix typo in 'lang item with track_caller' message 2024-10-05 17:12:46 +02:00
bors
e561499e90 Auto merge of #131188 - Kobzol:remove-libstd-so-from-sysroot, r=onur-ozkan
Do not copy libstd dynamic library to sysroot

Since https://github.com/rust-lang/rust/pull/122362, rustc links statically to libstd.[so|dll]. Which means that the libstd.[so|dll] file no longer has to be in the rustc sysroot. However, we are currently still shipping this file, in every new release of Rust, for no reason, it's just wasted bytes.

This PR removes the dynamic library file from the built sysroot.

However, it is not yet performed on Windows, because stage0 incremental tests start failing there (see description of the issue [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Failing.20incr.20tests.20on.20Windows.20when.20std.2Edll.20is.20missing/near/474507064)).

This is an extended version of https://github.com/rust-lang/rust/pull/128986.
CC `@Zoxc`
2024-10-05 14:05:05 +00:00
DianQK
70260dbeca
Update to LLVM 19.1.1 2024-10-05 21:10:04 +08:00
Veera
ab8673501c Add a Lint for Pointer to Integer Transmutes in Consts 2024-10-05 12:48:02 +00:00
bors
f559d61888 Auto merge of #131288 - matthiaskrgr:rollup-h0t0v2h, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #130428 (Stabilize `const_slice_split_at_mut` and `const_slice_first_last_chunk`)
 - #131094 (std: replace `LazyBox` with `OnceBox`)
 - #131256 (move f16/f128 const fn under f16/f128 feature gate)
 - #131278 (remove outdated contribution direction)
 - #131286 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-05 11:28:48 +00:00
Matthias Krüger
72acacf60f
Rollup merge of #131286 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-10-05 13:15:59 +02:00
Matthias Krüger
1bd61bbeac
Rollup merge of #131278 - onur-ozkan:update-outdated-doc, r=Kobzol
remove outdated contribution direction
2024-10-05 13:15:59 +02:00
Matthias Krüger
cb5bb13ea9
Rollup merge of #131256 - RalfJung:f16-f128-const, r=ibraheemdev
move f16/f128 const fn under f16/f128 feature gate

The `*_const` features were added to work around https://github.com/rust-lang/rust/issues/129656, which should not be needed any more.
2024-10-05 13:15:58 +02:00
Matthias Krüger
92beb42f64
Rollup merge of #131094 - joboet:lazy_once_box, r=ibraheemdev
std: replace `LazyBox` with `OnceBox`

This PR replaces the `LazyBox` wrapper used to allocate the pthread primitives with `OnceBox`, which has a more familiar API mirroring that of `OnceLock`. This cleans up the code in preparation for larger changes like #128184 (from which this PR was split) and allows some neat optimizations, like avoid an acquire-load of the allocation pointer in `Mutex::unlock`, where the initialization of the allocation must have already been observed.

Additionally, I've gotten rid of the TEEOS `Condvar` code, it's just a duplicate of the pthread one anyway and I didn't want to repeat myself.
2024-10-05 13:15:57 +02:00
Matthias Krüger
386a0baecb
Rollup merge of #130428 - ink-feather-org:stabilize-const-split-at-mut, r=RalfJung
Stabilize `const_slice_split_at_mut` and `const_slice_first_last_chunk`

Stabilizes #101804 and the remainder of #111774.

FCP proposed in the tracking issue.

Requires #130403 (or it would need a rustc_allow_const_fn_unstable for it)

Stabilized const API:
```rust
// slice
impl [T] {
    pub const fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_unchecked(&mut self, mid: usize) -> (&mut [T], &mut [T]);
    pub const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut [T], &mut [T])>;

    pub const fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [T; N]>;
    pub const fn split_first_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
    pub const fn split_last_chunk_mut<const N: usize>(&mut self) -> Option<(&mut [T; N], &mut [T])>;
}
```

Closes #101804
Closes #111774

cc `@RalfJung`
2024-10-05 13:15:56 +02:00
Ralf Jung
f0ddc7b472 clarify semantics of ConstantIndex MIR projection 2024-10-05 12:19:14 +02:00
bors
3b418b1485 Auto merge of #3940 - rust-lang:refutable_slice, r=RalfJung
Prefer refutable slice patterns over len check + index op

Just something I noticed while reviewing other PRs

We do it for shim arguments almost everywhere, but when the size is not statically known, we didn't use the helpers as they rely on array ops. But we can avoid a len check followed by several index ops by just using a refutable slice pattern with `let else`.

The pattern is so common, it seems almost worth a dedicated macro
2024-10-05 09:39:25 +00:00
Henri Lunnikivi
6edd0b356f Add platform support doc for rv32e 2024-10-05 12:19:21 +03:00
Henri Lunnikivi
346afc7017 Add UI test to verify invalid loads are not generated 2024-10-05 12:19:20 +03:00
Henri Lunnikivi
fe658e1fe4 Add assembly tests to satisfy 'tidy' 2024-10-05 12:14:35 +03:00
Henri Lunnikivi
66b3d0b36a Work around the stage0 sanity check
Add rv32e-targets to 'stage0 missing targets'. This prevents the error
"no such target exists in the target list".
2024-10-05 12:14:35 +03:00
Henri Lunnikivi
f3037823de doc: platform-support.md: Document port 2024-10-05 12:14:35 +03:00
Henri Lunnikivi
04099b663c Update target fns to latest main 2024-10-05 12:14:35 +03:00
Henri Lunnikivi
7a0bac49c8 Add comment: data_layout 2024-10-05 12:14:35 +03:00
Henri Lunnikivi
b22b348e0d Add targets: riscv32{e|em|emc}
- Based on riscv32{i|im|imc}
- Set data_layout stack alignment: S32 (bits)
- Set llvm_abiname = ilp32e
2024-10-05 12:13:59 +03:00
Ralf Jung
98aa3d96e2 make Cell unstably const 2024-10-05 11:13:27 +02:00
bors
eb97047cc6 Auto merge of #3943 - RalfJung:pthread-mutex-reentrant, r=RalfJung
pthread mutex: better error in reentrant-locking-UB

Also test reentrant locking of PTHREAD_MUTEX_INITIALIZER
2024-10-05 08:49:15 +00:00
Ralf Jung
155380523c pthread mutex: better error in reentrant-locking-UB, also test PTHREAD_MUTEX_INITIALIZER 2024-10-05 10:46:14 +02:00
Ralf Jung
0cd0f7ceef move f16/f128 const fn under f16/f128 feature gate 2024-10-05 10:13:18 +02:00
onestacked
d0e6758677 Stabilize const_slice_split_at_mut and const_slice_first_last_chunk 2024-10-05 09:52:13 +02:00
ismailarilik
2feed62796 Handle rustc_interface cases of rustc::potential_query_instability lint 2024-10-05 10:01:27 +03:00
bors
5a4ee43c38 Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errors
Make opaque types regular HIR nodes

Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead.

I haven't gone through all the test changes yet, so there may be a few surprises.

Many thanks to `@camelid` for the first draft.
Fixes https://github.com/rust-lang/rust/issues/129023

Fixes #129099
Fixes #125843
Fixes #119716
Fixes #121422
2024-10-05 06:19:35 +00:00
onur-ozkan
05f7b092a4 remove outdated contribution direction
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-10-05 08:07:26 +03:00
bors
d30c3924a4 Auto merge of #131275 - workingjubilee:rollup-4yxqio3, r=workingjubilee
Rollup of 9 pull requests

Successful merges:

 - #129517 (Compute array length from type for unconditional panic lint. )
 - #130367 (Check elaborated projections from dyn don't mention unconstrained late bound lifetimes)
 - #130403 (Stabilize `const_slice_from_raw_parts_mut`)
 - #130633 (Add support for reborrowing pinned method receivers)
 - #131105 (update `Literal`'s intro)
 - #131194 (Fix needless_lifetimes in stable_mir)
 - #131260 (rustdoc: cleaner errors on disambiguator/namespace mismatches)
 - #131267 (Stabilize `BufRead::skip_until`)
 - #131273 (Account for `impl Trait {` when `impl Trait for Type {` was intended)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-05 03:41:42 +00:00
est31
00ed47b849 Make deprecated_cfg_attr_crate_type_name a hard error 2024-10-05 04:29:46 +02:00
Jubilee
08689af7b4
Rollup merge of #131273 - estebank:issue-131051, r=compiler-errors
Account for `impl Trait {` when `impl Trait for Type {` was intended

On editions where bare traits are never allowed, detect if the user has written `impl Trait` with no type, silence any dyn-compatibility errors, and provide a structured suggestion for the potentially missing type:

```
error[E0782]: trait objects must include the `dyn` keyword
  --> $DIR/missing-for-type-in-impl.rs:8:6
   |
LL | impl Foo<i64> {
   |      ^^^^^^^^
   |
help: add `dyn` keyword before this trait
   |
LL | impl dyn Foo<i64> {
   |      +++
help: you might have intended to implement this trait for a given type
   |
LL | impl Foo<i64> for /* Type */ {
   |               ++++++++++++++
```

CC #131051.
2024-10-04 19:19:27 -07:00
Jubilee
3078b23bbf
Rollup merge of #131267 - okaneco:bufread_skip_until, r=tgross35
Stabilize `BufRead::skip_until`

FCP completed https://github.com/rust-lang/rust/issues/111735#issuecomment-2393893069

Closes #111735
2024-10-04 19:19:26 -07:00
Jubilee
f66aa600d9
Rollup merge of #131260 - notriddle:notriddle/disambiguator-error, r=GuillaumeGomez
rustdoc: cleaner errors on disambiguator/namespace mismatches

Resolves https://github.com/rust-lang/rust/pull/131224#pullrequestreview-2348407077

r? `@jyn514`
2024-10-04 19:19:25 -07:00
Jubilee
bc2f732870
Rollup merge of #131194 - practicalrs:fix_needless_lifetimes, r=celinval
Fix needless_lifetimes in stable_mir

Hi,

This PR fixes the following clippy warning in stable_mir

```
warning: the following explicit lifetimes could be elided: 'a
  --> compiler/stable_mir/src/mir/visit.rs:79:30
   |
79 |     fn visit_projection_elem<'a>(
   |                              ^^
80 |         &mut self,
81 |         place_ref: PlaceRef<'a>,
   |                             ^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
   |
79 ~     fn visit_projection_elem(
80 |         &mut self,
81 ~         place_ref: PlaceRef<'_>,
   |
```

Best regards,
Michal
2024-10-04 19:19:25 -07:00
Jubilee
5bad4e9cae
Rollup merge of #131105 - slanterns:literal_c_str, r=petrochenkov
update `Literal`'s intro

Just something missd when adding c_str to it.
2024-10-04 19:19:24 -07:00
Jubilee
68de7d11a9
Rollup merge of #130633 - eholk:pin-reborrow-self, r=compiler-errors
Add support for reborrowing pinned method receivers

This builds on #130526 to add pinned reborrowing for method receivers. This enables the folllowing examples to work:

```rust
#![feature(pin_ergonomics)]
#![allow(incomplete_features)]

use std::pin::Pin;

pub struct Foo;

impl Foo {
    fn foo(self: Pin<&mut Self>) {
    }

    fn baz(self: Pin<&Self>) {
    }
}

pub fn bar(x: Pin<&mut Foo>) {
    x.foo();
    x.foo();

    x.baz(); // Pin<&mut Foo> is downgraded to Pin<&Foo>
}

pub fn baaz(x: Pin<&Foo>) {
    x.baz();
    x.baz();
}
```

This PR includes the original one, which is currently in the commit queue, but the only code changes are in the latest commit (d3c53aaa5c6fcb1018c58d229bc5d92202fa6880).

#130494

r? `@compiler-errors`
2024-10-04 19:19:24 -07:00
Jubilee
49c6d78117
Rollup merge of #130403 - eduardosm:stabilize-const_slice_from_raw_parts_mut, r=workingjubilee
Stabilize `const_slice_from_raw_parts_mut`

Stabilizes https://github.com/rust-lang/rust/issues/67456, since https://github.com/rust-lang/rust/issues/57349 has been stabilized.

Stabilized const API:
```rust
// core::ptr
pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T];

// core::slice
pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T];

// core::ptr::NonNull
pub const fn slice_from_raw_parts(data: NonNull<T>, len: usize) -> Self
```

Closes https://github.com/rust-lang/rust/issues/67456.

r? libs-api
2024-10-04 19:19:23 -07:00
Jubilee
9510c7366d
Rollup merge of #130367 - compiler-errors:super-unconstrained, r=spastorino
Check elaborated projections from dyn don't mention unconstrained late bound lifetimes

Check that the projections that are *not* explicitly written but which we deduce from elaborating the principal of a `dyn` *also* do not reference unconstrained late-bound lifetimes, just like the ones that the user writes by hand.

That is to say, given:

```
trait Foo<T>: Bar<Assoc = T> {}

trait Bar {
    type Assoc;
}
```

The type `dyn for<'a> Foo<&'a T>` (basically) elaborates to `dyn for<'a> Foo<&'a T> + for<'a> Bar<Assoc = &'a T>`[^1]. However, the `Bar` projection predicate is not well-formed, since `'a` must show up in the trait's arguments to be referenced in the term of a projection. We must error in this situation[^well], or else `dyn for<'a> Foo<&'a T>` is unsound.

We already detect this for user-written projections during HIR->rustc_middle conversion, so this largely replicates that logic using the helper functions that were already conveniently defined.

---

I'm cratering this first to see the fallout; if it's minimal or zero, then let's land it as-is. If not, the way that this is implemented is very conducive to an FCW.

---

Fixes #130347

[^1]: We don't actually elaborate it like that in rustc; we only keep the principal trait ref `Foo<&'a T>` and the projection part of `Bar<Assoc = ...>`, but it's useful to be a bit verbose here for the purpose of explaining the issue.
[^well]: Well, we could also make `dyn for<'a> Foo<&'a T>` *not* implement `for<'a> Bar<Assoc = &'a T>`, but this is inconsistent with the case where the user writes `Assoc = ...` in the type itself, and it overly complicates the implementation of trait objects' built-in impls.
2024-10-04 19:19:22 -07:00
Jubilee
f09e5a785b
Rollup merge of #129517 - cjgillot:known-panic-array, r=pnkfelix
Compute array length from type for unconditional panic lint.

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

The cases that involve slicing are harder, so https://github.com/rust-lang/rust/issues/38035 remains open.
2024-10-04 19:19:22 -07:00