| Age | Commit message (Collapse) | Author | Lines |
|
reformat method chain according to ubsan Rustic Style Guide
https://ubsan.github.io/style/
|
|
I may have gone a bit overboard on this one. Numbers are fun.
tone down the error message
|
|
Carrier trait (third attempt)
This adds a `Carrier` trait to operate with `?`. The only public implementation is for `Result`, so effectively the trait does not exist, however, it ensures future compatibility for the `?` operator. This is not intended to be used, nor is it intended to be a long-term solution.
Although this exact PR has not been through Crater, I do not expect it to be a breaking change based on putting numerous similar PRs though Crater in the past.
cc:
* [? tracking issue](https://github.com/rust-lang/rust/issues/31436)
* [previous PR](https://github.com/rust-lang/rust/pull/35056)
* [RFC issue](https://github.com/rust-lang/rfcs/issues/1718) for discussion of long-term Carrier trait solutions.
r? @nikomatsakis
|
|
r? @steveklabnik
|
|
|
|
r? @steveklabnik
|
|
r? @steveklabnik
|
|
Feedback on PR #35701 seems to be positive, so this does the same thing for `RangeTo` and `RangeToInclusive`.
|
|
|
|
replace `Neg` example with something more evocative of negation
|
|
replace `Not` example with something more evocative
|
|
replace `AddAssign` example with something more evocative of addition
This is analogous to PR #35709 for the `Add` trait.
|
|
demonstrate `RHS != Self` use cases for `Mul` and `Div`
Vector-scalar multipication is a good usecase for this. Thanks #rust!
|
|
note that calling drop() explicitly is a compiler error
Part of #29365
|
|
replace `Add` example with something more evocative of addition
Currently most of the operator traits use trivial implementation
examples that only perform side effects. Honestly, that might not be too
bad for the sake of documentation; but anyway, here's a proposal to move
a slightly modified version of the module-level point-addition example
into the `Add` documentation, since it's more evocative of addition
semantics.
Part of #29365
|
|
explicitly show how iterating over `..` fails
I've also removed the `main()` wrapper, which I believe is extraneous.
LMK if that's incorrect.
|
|
std: Stabilize APIs for the 1.12 release
Stabilized
* `Cell::as_ptr`
* `RefCell::as_ptr`
* `IpAddr::is_{unspecified,loopback,multicast}`
* `Ipv6Addr::octets`
* `LinkedList::contains`
* `VecDeque::contains`
* `ExitStatusExt::from_raw` - both on Unix and Windows
* `Receiver::recv_timeout`
* `RecvTimeoutError`
* `BinaryHeap::peek_mut`
* `PeekMut`
* `iter::Product`
* `iter::Sum`
* `OccupiedEntry::remove_entry`
* `VacantEntry::into_key`
Deprecated
* `Cell::as_unsafe_cell`
* `RefCell::as_unsafe_cell`
* `OccupiedEntry::remove_pair`
Closes #27708
cc #27709
Closes #32313
Closes #32630
Closes #32713
Closes #34029
Closes #34392
Closes #34285
Closes #34529
|
|
|
|
Stabilized
* `Cell::as_ptr`
* `RefCell::as_ptr`
* `IpAddr::is_{unspecified,loopback,multicast}`
* `Ipv6Addr::octets`
* `LinkedList::contains`
* `VecDeque::contains`
* `ExitStatusExt::from_raw` - both on Unix and Windows
* `Receiver::recv_timeout`
* `RecvTimeoutError`
* `BinaryHeap::peek_mut`
* `PeekMut`
* `iter::Product`
* `iter::Sum`
* `OccupiedEntry::remove_entry`
* `VacantEntry::into_key`
Deprecated
* `Cell::as_unsafe_cell`
* `RefCell::as_unsafe_cell`
* `OccupiedEntry::remove_pair`
Closes #27708
cc #27709
Closes #32313
Closes #32630
Closes #32713
Closes #34029
Closes #34392
Closes #34285
Closes #34529
|
|
|
|
|
|
Implement RFC 1649
cc #35603 rust-lang/rfcs#1649
r? @alexcrichton
|
|
The dummy impl should ensure the same type checking behaviour as having other (real) Carrier impls.
|
|
This is analogous to PR #35709 for the `Add` trait.
|
|
Part of #29365
explain that std::mem::drop in prelude will invoke Drop
change "prelude" -> "the prelude"; change links to reference-style
move link references to links' section
|
|
|
|
Vector-scalar multipication is a good usecase for this. Thanks #rust!
|
|
This trait can be used to avoid the overhead of a fuse wrapper when an iterator
is already well-behaved.
Conforming to: RFC 1581
Closes: #35602
|
|
Allows use with `Option` and custom `Result`-like types.
|
|
Currently most of the operator traits use trivial implementation
examples that only perform side effects. Honestly, that might not be too
bad for the sake of documentation; but anyway, here's a proposal to move
a slightly modified version of the module-level point-addition example
into the `Add` documentation, since it's more evocative of addition
semantics.
Part of #29365
wrap identifiers in backticks
minor rephrasing
fix module-level documentation to be more truthful
This branch changes the example for `Add` to no longer be a "minimum implementation that prints something to the screen".
|
|
r=GuillaumeGomez
accumulate into vector and assert, instead of printing
I'm only making this change in one place so that people can express
their preferences for this stylistic change. If/when this change is
approved I'll go ahead and translate the rest of the `std::ops`
examples.
|
|
expound on limitations of Rust's trait-based operator overloading
Part of #29330
|
|
Improve `No stdlib` and related Documentation
This renames all lang item function names to the ones used in `libstd` and `libpanic_unwind`. It also explains the `eh_unwind_resume` lang item in the `libcore` documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the `No stdlib` documentation.
|
|
|
|
`AsRef` is designed for conversions that are "cheap" (as per
the API docs). It is the case that retrieving the underlying
data of `std::slice::Iter` is cheap. In my opinion, there's no
ambiguity about what slice data will be returned, otherwise,
I would be more cautious about implementing `AsRef`.
|
|
Saying that "[for-loop iteration] fails because .. has no IntoIterator
impl" is more direct than saying "...no Iterator impl" because for loops
sugar into IntoIterator invocations. It just happens that the other
Range* operators implement Iterator and rely on the fact that
`IntoIterator` is implemented for `T: Iterator`.
|
|
Implement the `!` type
This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
|
|
I've also removed the `main()` wrapper, which I believe is extraneous.
LMK if that's incorrect.
|
|
|
|
I'm only making this change in one place so that people can express
their preferences for this stylistic change. If/when this change is
approved I'll go ahead and translate the rest of the `std::ops`
examples.
|
|
Part of #29330
|
|
|
|
fix small typos in std::convert documentation
Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".
Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.
|
|
Use an existing constant name as an example.
By reading atomics documentation I tried to use `INIT_ATOMIC_BOOL`, which I couldn't find. Turns out it was renamed to `ATOMIC_BOOL_INIT`.
|
|
Implement From for Cell, RefCell and UnsafeCell
Considering that `From` is implemented for `Box`, `Rc` and `Arc`, it seems [reasonable](https://internals.rust-lang.org/t/implementing-from-t-for-other-std-types/3744) to implement it for `Cell`, `RefCell` and `UnsafeCell`.
|
|
|
|
Split Ty::is_empty method into is_never and is_uninhabited
|
|
Mainly, remove mk_empty() method and replace with tcx.types.empty
|
|
Adds the `bang_type` feature gate. `!` in a non-return-type position now
relies on that feature.
|
|
|