| Age | Commit message (Collapse) | Author | Lines |
|
r=Mark-Simulacrum
Support `#[rustc_align_static]` inside `thread_local!`
Tracking issue: rust-lang/rust#146177
```rust
thread_local! {
#[rustc_align_static(64)]
static SO_ALIGNED: u64 = const { 0 };
}
```
This increases the amount of recursion the macro performs (once per attribute in addition to the previous once per item), making it easier to hit the recursion limit. I’ve added workarounds to limit the impact in the case of long doc comments, but this still needs a crater run just in case.
r? libs
``@rustbot`` label A-attributes A-macros A-thread-locals F-static_align T-libs
|
|
|
|
Much of the compiler calls functions on Align projected from AbiAlign.
AbiAlign impls Deref to its inner Align, so we can simplify these away.
Also, it will minimize disruption when AbiAlign is removed.
For now, preserve usages that might resolve to PartialOrd or PartialEq,
as those have odd inference.
|
|
Allow `&raw [mut | const]` for union field in safe code
fixes rust-lang/rust#141264
r? ``@Veykril``
Unresolved questions:
- [x] Any edge cases?
- [x] How this works with rust-analyzer (because all I've did is prevent compiler from emitting error in `&raw` context) (rust-lang/rust-analyzer#19867)
- [x] Should we allow `addr_of!` and `addr_of_mut!` as well? In current version they both (`&raw` and `addr_of!`) are allowed (They are the same)
- [x] Is chain of union fields is a safe? (Yes)
|
|
|
|
|
|
Rollup of 8 pull requests
Successful merges:
- rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI)
- rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature)
- rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`)
- rust-lang/rust#142401 (Add proper name mangling for pattern types)
- rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`)
- rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes)
- rust-lang/rust#146924 (Add doc for `NonZero*` const creation)
- rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`
The implementation of the `Vec::extract_if` iterator violates the safety contract adverized by `slice::from_raw_parts` by always constructing a mutable slice for the entire length of the vector even though that span of memory can contain holes from items already drained. The safety contract of `slice::from_raw_parts` requires that all elements must be properly
initialized.
As an example we can look at the following code:
```rust
let mut v = vec![Box::new(0u64), Box::new(1u64)];
for item in v.extract_if(.., |x| **x == 0) {
drop(item);
}
```
In the second iteration a `&mut [Box<u64>]` slice of length 2 will be constructed. The first slot of the slice contains the bitpattern of an already deallocated box, which is invalid.
This fixes the issue by only creating references to valid items and using pointer manipulation for the rest. I have also taken the liberty to remove the big `unsafe` blocks in place of targetted ones with a SAFETY comment. The approach closely mirrors the implementation of `Vec::retain_mut`.
**Note to reviewers:** The diff is easier to follow with whitespace hidden.
|
|
unstably constify float mul_add methods
Tracking issue: rust-lang/rust#146724
r? `@tgross35`
|
|
Co-authored-by: Ralf Jung <post@ralfj.de>
|
|
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: f6092f224d2b1774b31033f12d0bee626943b02f
Filtered ref: f843cd4f29bdcd8d474dbb9e5e4365eb7f263ec6
This merge was created using https://github.com/rust-lang/josh-sync.
|
|
This updates the rust-version file to f6092f224d2b1774b31033f12d0bee626943b02f.
|
|
|
|
Mark float intrinsics with no preconditions as safe
Note: for ease of reviewing, the list of safe intrinsics is sorted in the first commit, and then safe intrinsics are added in the second commit.
All *recently added* float intrinsics have been correctly marked as safe to call due to the fact that they have no preconditions. This adds the remaining float intrinsics which are safe to call to the safe intrinsic list, and removes the unsafe blocks around their calls.
---
Side note: this may want a try run before being added to the queue, since I'm not sure if there's any tier-2 code that uses these intrinsics that might not be tested on the usual PR flow. We've already uncovered a few places in subtrees that do this, and it's worth double-checking before clogging up the queue.
|
|
|
|
|
|
TB: update terminology to match paper & MiniRust
|
|
|
|
|
|
The implementation of the `Vec::extract_if` iterator violates the safety
contract adverized by `slice::from_raw_parts` by always constructing a
mutable slice for the entire length of the vector even though that span
of memory can contain holes from items already drained. The safety
contract of `slice::from_raw_parts` requires that all elements must be
properly initialized.
As an example we can look at the following code:
```rust
let mut v = vec![Box::new(0u64), Box::new(1u64)];
for item in v.extract_if(.., |x| **x == 0) {
drop(item);
}
```
In the second iteration a `&mut [Box<u64>]` slice of length 2 will be
constructed. The first slot of the slice contains the bitpattern of an
already deallocated box, which is invalid.
This fixes the issue by only creating references to valid items and
using pointer manipulation for the rest. I have also taken the liberty
to remove the big `unsafe` blocks in place of targetted ones with a
SAFETY comment. The approach closely mirrors the implementation of
`Vec::retain_mut`.
Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
|
|
|
|
|
|
|
|
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: ec38671075266e9cee0348701da2e133379e7c6c
Filtered ref: ed8e25574abf50600d9d2fd61eda90708ccce6c2
Upstream diff: https://github.com/rust-lang/rust/compare/3f1552a273e43e15f6ed240d00e1efdd6a53e65e...ec38671075266e9cee0348701da2e133379e7c6c
This merge was created using https://github.com/rust-lang/josh-sync.
|
|
This updates the rust-version file to ec38671075266e9cee0348701da2e133379e7c6c.
|
|
|
|
|
|
implement sqrt for f16 and f128
|
|
|
|
|
|
Add GenMC estimation mode.
|
|
|
|
|
|
support `readdir` on FreeBSD
|
|
|
|
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: 3f1552a273e43e15f6ed240d00e1efdd6a53e65e
Filtered ref: fbfa7b30a3ad5abd6a5db7e3ef15adc8da1ecc37
Upstream diff: https://github.com/rust-lang/rust/compare/9d82de19dfae60e55c291f5f28e28cfc2c1b9630...3f1552a273e43e15f6ed240d00e1efdd6a53e65e
This merge was created using https://github.com/rust-lang/josh-sync.
|
|
This updates the rust-version file to 3f1552a273e43e15f6ed240d00e1efdd6a53e65e.
|
|
|
|
interpret: fix overlapping aggregate initialization
This fixes the problem pointed out by ````@saethlin```` in https://github.com/rust-lang/rust/issues/146383#issuecomment-3273224645.
Also clarify when exactly current de-facto MIR semantics allow overlap of the LHS and RHS in an assignment.
|
|
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: a015919e54c60b1b2bec7a98dec478cfc4a48f4e
Filtered ref: 1867c5844dba22ac4d77d1ceb7d1624c14139c16
Upstream diff: https://github.com/rust-lang/rust/compare/4ba1cf9ade4c8e2fa10676a50ee34594eb161837...a015919e54c60b1b2bec7a98dec478cfc4a48f4e
This merge was created using https://github.com/rust-lang/josh-sync.
|
|
This updates the rust-version file to a015919e54c60b1b2bec7a98dec478cfc4a48f4e.
|
|
Stabilize BTree{Map,Set}::extract_if
Tracking issue: rust-lang/rust#70530
FCP completed: https://github.com/rust-lang/rust/issues/70530#issuecomment-3191454465
Closes: rust-lang/rust#70530
|
|
Pull recent changes from https://github.com/rust-lang/rust via Josh.
Upstream ref: 4ba1cf9ade4c8e2fa10676a50ee34594eb161837
Filtered ref: 84b64d836ed478c54972a1d2639e60fa5f3ce26f
Upstream diff: https://github.com/rust-lang/rust/compare/2a9bacf6187685931d52346a0ecff2e52bdc91cc...4ba1cf9ade4c8e2fa10676a50ee34594eb161837
This merge was created using https://github.com/rust-lang/josh-sync.
|
|
This updates the rust-version file to 4ba1cf9ade4c8e2fa10676a50ee34594eb161837.
|
|
Add compare_exchange support for GenMC mode
|
|
- Handling Compare-Exchange operations.
- Limitation: Compare-Exchange currently ignores possibility of spurious failures.
- Limitation: Compare-Exchange failure memory ordering is ignored.
- Upgrade compare-exchange success ordering to avoid reporting non-existent bugs.
- Add warnings for GenMC mode for unsupported features.
- Add a lot of tests, including translation of GenMC litmus tests and Loom tests.
- Cleanup
|
|
|
|
|
|
|
|
thread parking: fix docs and examples
Fixes https://github.com/rust-lang/rust/issues/145816
r? ```@joboet```
Cc ```@m-ou-se``` ```@Amanieu```
|