| Age | Commit message (Collapse) | Author | Lines |
|
fix typo in 'lang item with track_caller' message
Revival of https://github.com/rust-lang/rust/pull/124912
|
|
clarify semantics of ConstantIndex MIR projection
This documents what Miri does:
https://github.com/rust-lang/rust/blob/c4ce8c114b06840c3521a189ee44958b713fb33a/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?
|
|
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
|
|
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`
|
|
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`
|
|
|
|
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`
|
|
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
|
|
Miri subtree update
r? `@ghost`
|
|
remove outdated contribution direction
|
|
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.
|
|
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.
|
|
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`
|
|
|
|
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
|
|
|
|
|
|
|
|
Add rv32e-targets to 'stage0 missing targets'. This prevents the error
"no such target exists in the target list".
|
|
|
|
|
|
|
|
- Based on riscv32{i|im|imc}
- Set data_layout stack alignment: S32 (bits)
- Set llvm_abiname = ilp32e
|
|
|
|
pthread mutex: better error in reentrant-locking-UB
Also test reentrant locking of PTHREAD_MUTEX_INITIALIZER
|
|
PTHREAD_MUTEX_INITIALIZER
|
|
|
|
|
|
|
|
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
|
|
Signed-off-by: onur-ozkan <work@onurozkan.dev>
|
|
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
|
|
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.
|
|
Stabilize `BufRead::skip_until`
FCP completed https://github.com/rust-lang/rust/issues/111735#issuecomment-2393893069
Closes #111735
|
|
r=GuillaumeGomez
rustdoc: cleaner errors on disambiguator/namespace mismatches
Resolves https://github.com/rust-lang/rust/pull/131224#pullrequestreview-2348407077
r? `@jyn514`
|
|
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
|
|
update `Literal`'s intro
Just something missd when adding c_str to it.
|
|
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`
|
|
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
|
|
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.
|
|
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.
|
|
Update cargo
17 commits in 80d82ca22abbee5fb7b51fa1abeb1ae34e99e88a..ad074abe3a18ce8444c06f962ceecfd056acfc73
2024-09-27 17:56:01 +0000 to 2024-10-04 18:18:15 +0000
- test: Remove the last of our custom json assertions (rust-lang/cargo#14576)
- docs(ref): Expand on MSRV (rust-lang/cargo#14636)
- docs: Minor re-grouping of pages (rust-lang/cargo#14620)
- docs(ref): Highleft whats left for msrv-policy (rust-lang/cargo#14638)
- Fix `cargo:version_number` - has only one `:` (rust-lang/cargo#14637)
- docs: Declare support level for each crate in our Charter / docs (rust-lang/cargo#14600)
- chore(deps): update tar to 0.4.42 (rust-lang/cargo#14632)
- docs(charter): Declare new Intentional Artifacts as 'small' changes (rust-lang/cargo#14599)
- fix: Remove implicit feature removal (rust-lang/cargo#14630)
- docs(config): make `--config <PATH>` more prominent (rust-lang/cargo#14631)
- chore(deps): update rust crate unicode-width to 0.2.0 (rust-lang/cargo#14624)
- chore(deps): update embarkstudios/cargo-deny-action action to v2 (rust-lang/cargo#14628)
- docs(ref): Clean up language for `package.rust-version` (rust-lang/cargo#14619)
- docs: clarify `target.'cfg(...)'` doesnt respect cfg from build script (rust-lang/cargo#14312)
- test: relax compiler panic assertions (rust-lang/cargo#14618)
- refactor(compiler): zero-copy deserialization when possible (rust-lang/cargo#14608)
- test: add support for features in the sat resolver (rust-lang/cargo#14583)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|