| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
usize index message for vec
|
|
Improve raw Box conversions
This PR has two goals:
- Reduce use of `mem::transmute` in `Box` conversions
I understand that `mem::transmute`-ing non `#[repr(C)]` types is implementation-defined behavior. This may not matter within the reference implementation of Rust, but I believe it's important to remain consistent. For example, I noticed that `str::from_utf8_unchecked` went from using `mem::transmute` to using pointer casts.
- Make `Box` pointer conversions more straightforward regarding `Unique`
|
|
|
|
Modify Rc/Arc language around mutability
There are a few exceptions to the rule that Arc/Rc are immutable. Rather
than dig into the details, add "generally" to hint at this difference,
as it's kind of a distraction at this point in the docs.
Additionally, Arc's docs were slightly different here generally, so add
in both the existing language and the exception.
Fixes #44105
|
|
|
|
|
|
Provides a reasonable interface for Box::from_raw implementation.
Does not get around the requirement of mem::transmute for converting
back and forth between Unique and Box.
|
|
Same reasons as commit 904133e1e28b690e2bbd101b719509aa897539a0.
|
|
Seems to cause this error: "Cannot handle boxed::Box<[u8]> represented
as TyLayout".
|
|
Implement `and_modify` on `Entry`
## Motivation
`Entry`s are useful for allowing access to existing values in a map while also allowing default values to be inserted for absent keys. The existing API is similar to that of `Option`, where `or` and `or_with` can be used if the option variant is `None`.
The `Entry` API is, however, missing an equivalent of `Option`'s `and_then` method. If it were present it would be possible to modify an existing entry before calling `or_insert` without resorting to matching on the entry variant.
Tracking issue: https://github.com/rust-lang/rust/issues/44733.
|
|
|
|
There are a few exceptions to the rule that Arc/Rc are immutable. Rather
than dig into the details, add "generally" to hint at this difference,
as it's kind of a distraction at this point in the docs.
Additionally, Arc's docs were slightly different here generally, so add
in both the existing language and the exception.
Fixes #44105
|
|
address some FIXME whose associated issues were marked as closed
part of #44366
|
|
Remove mem::transmute used in Box<str> conversions
Given that https://github.com/rust-lang/rust/pull/44877 is failing, I decided to make a separate PR. This is done with the same motivation: to avoid `mem::transmute`-ing non `#[repr(C)]` types.
|
|
|
|
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays.
remove FIXME(#19649) now that stability markers render.
remove FIXME(#13642) now the benchmarks were moved.
remove FIXME(#6220) now that floating points can be formatted.
remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>`
remove reference to irelevent issues in FIXME(#1697, #2178...)
update FIXME(#5516) to point to getopts issue 7
update FIXME(#7771) to point to RFC 628
update FIXME(#19839) to point to issue 26925
|
|
Backport libs stabilizations to 1.21 beta
Includes the following stabilizations:
- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640
These have been backported in https://github.com/rust-lang/rust/pull/44823.
|
|
|
|
Initial support for `..=` syntax
#28237
This PR adds `..=` as a synonym for `...` in patterns and expressions.
Since `...` in expressions was never stable, we now issue a warning.
cc @durka
r? @aturon
|
|
Makes use of conversions via Unique.
|
|
This includes the following stabilizations:
- tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563
- iterator_for_each https://github.com/rust-lang/rust/pull/44567
- ord_max_min https://github.com/rust-lang/rust/pull/44593
- compiler_fences https://github.com/rust-lang/rust/pull/44595
- needs_drop https://github.com/rust-lang/rust/pull/44639
- vec_splice https://github.com/rust-lang/rust/pull/44640
|
|
You can otherwise end up in a situation where you don't actually resize
but still call into handle_cap_increase which then corrupts head/tail.
Closes #44800
|
|
Add ..= to the parser
Add ..= to libproc_macro
Add ..= to ICH
Highlight ..= in rustdoc
Update impl Debug for RangeInclusive to ..=
Replace `...` to `..=` in range docs
Make the dotdoteq warning point to the ...
Add warning for ... in expressions
Updated more tests to the ..= syntax
Updated even more tests to the ..= syntax
Updated the inclusive_range entry in unstable book
|
|
|
|
Add iterator method .rfold(init, function); the reverse of fold
rfold is the reverse version of fold.
Fold allows iterators to implement a different (non-resumable) internal
iteration when it is more efficient than the external iteration implemented
through the next method. (Common examples are VecDeque and .chain()).
Introduce rfold() so that the same customization is available for reverse
iteration. This is achieved by both adding the method, and by having the
Rev\<I> adaptor connect Rev::rfold → I::fold and Rev::fold → I::rfold.
On the surface, rfold(..) is just .rev().fold(..), but the special case
implementations allow a data structure specific fold to be used through for
example .iter().rev(); we thus have gains even for users never calling exactly
rfold themselves.
|
|
Optimize drain_filter
This PR cuts out two copies from each iteration of `drain_filter` by exchanging the swap operation for a copy_nonoverlapping function call instead. Since the data being swapped is not needed anymore we can just overwrite it instead.
|
|
|
|
|
|
Stabilized vec_splice and modified splice tracking issue
This stabilizes the vec_splice (Vec part of splice RFC)
Fixes #32310.
|
|
Implement `Arc`/`Rc` raw pointer conversions for `?Sized`
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
|
|
|
|
|
|
Implement <Rc<Any>>::downcast
* Implement `<Rc<Any>>::downcast::<T>`
* New unstable method. Works just like Box\<Any\>, but for Rc.
* Any has two cases for its methods: Any and Any + Send; Rc is never Send, so that case is skipped for Rc.
* Motivation for being a method with self is to match Box and there is no user-supplied type; the inner type is Any and downcast does not conflict with any method of Any.
* Arc was skipped because Any itself has no downcast for the case that makes most sense: Any + Send + Sync
|
|
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
|
|
|
|
Clarify return type of `String::from_utf16_lossy`.
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
Remove unneeded `loop`.
None
|
|
Fix example in transmute; add safety requirement to Vec::from_raw_parts
This fixes the second bullet point on #44281 and also removes some incorrect information.
|
|
Fix drain_filter doctest.
Fixes #44499.
Also change some of the hidden logic in the doctest as a regression test; two bugs in the original would now cause test failure.
|
|
Add an example of std::str::encode_utf16
Closes #44419
|
|
Add doc example to str::from_boxed_utf8_unchecked
Fixes #44463.
|
|
Added an example for `std::str::into_boxed_bytes()`
This solves issue #44423.
|
|
Add doc example to String::as_mut_str
Fixes #44429.
|
|
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
|
|
|
|
|
|
impl Hasher for {&mut Hasher, Box<Hasher>}
**Rationale:** The `Hash` trait has `fn hash<H: Hasher>(&self, state: &mut H)`, which can only accept a `Sized` hasher, even if the `Hasher` trait is object-safe. We cannot retroactively add the `?Sized` bound without breaking stability, thus implementing `Hasher` to a trait object reference is the next best solution.
**Warning:** These `impl` are insta-stable, and should need an FCP. I don't think a full RFC is necessary.
|