| Age | Commit message (Collapse) | Author | Lines |
|
The default implementation of .repr() will call conveniently call
transmute_copy which should be appropriate for all implementors, but is
memory unsafe if used wrong.
Fixes #22260
You need to use `unsafe impl` to implement the Repr trait now.
[breaking-change]
|
|
This overhauls the very meager docs that currently exist to clarify
various understandable confusions that I've noticed, e.g. people look in
`std::raw` for the "real" types of slices like `&[T]`, or think that
`Slice<T>` refers to `[T]` (fixes #22214).
This patch takes the liberty of offering some "style" guidance around
`raw::Slice`, since there's more restricted ways to duplicate all
functionality connected to it: `std::slice::from_raw_parts{,_mut}` for
construction and `.as_{,mut_}ptr` & `.len` for deconstruction.
It also deprecates the `std::raw::Closure` type which is now useless for
non-type-erased closures, and replaced by `TraitObject` for `&Fn`, `&mut
FnMut` etc, so I guess it should be called a:
[breaking-change]
|
|
|
|
This brings it in line with its namesake in `std::io`.
[breaking-change]
|
|
Fixes #22047
Range<u64> and Range<i64> may be longer than usize::MAX on 32-bit
platforms, and thus they cannot fulfill the protocol for
ExactSizeIterator. We don't want a nonobvious platform dependency in
basic iterator traits, so the trait impl is removed.
The logic of this change assumes that usize is at least 32-bit.
This is technically a breaking change; note that Range<usize> and
Range<isize> are always ExactSizeIterators.
[breaking-change]
|
|
|
|
|
|
|
|
Fixes #22064.
|
|
|
|
|
|
In `std::f32` and `std::f64`:
- `MIN_VALUE` → `MIN`
- `MAX_VALUE` → `MAX`
- `MIN_POS_VALUE` → `MIN_POSITIVE`
This matches the corresponding integer constants.
[breaking-change]
|
|
The `Arguments::new_v1_formatted` function was accidentally left out when this
module was stabilized.
|
|
|
|
- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator
|
|
- DoubleEndedIterator
- ExactSizeIterator
- RandomAccessIterator
|
|
It doesn't have to be a literal memory allocation (ala malloc), e.g. it
can be in static memory, so saying "allocated" is mildly misleading.
Thanks to @mahkoh for pointing it out.
r? @steveklabnik
|
|
There are a number of holes that the stability lint did not previously cover,
including:
* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)
These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:
* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local::imp::Key` type is now stable (it was already supposed to
be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
make bounds with these traits stable. Note that manual implementations of
these traits are still gated by default, this stability only allows bounds
such as `F: FnOnce()`.
Closes #8962
Closes #16360
Closes #20327
|
|
There are a number of holes that the stability lint did not previously cover,
including:
* Types
* Bounds on type parameters on functions and impls
* Where clauses
* Imports
* Patterns (structs and enums)
These holes have all been fixed by overriding the `visit_path` function on the
AST visitor instead of a few specialized cases. This change also necessitated a
few stability changes:
* The `collections::fmt` module is now stable (it was already supposed to be).
* The `thread_local::imp::Key` type is now stable (it was already supposed to
be).
* The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable.
These are required via the `panic!` macro.
* The `std::old_io::stdio::{println, println_args}` functions are now stable.
These are required by the `print!` and `println!` macros.
* The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to
make bounds with these traits stable. Note that manual implementations of
these traits are still gated by default, this stability only allows bounds
such as `F: FnOnce()`.
Additionally, the compiler now has special logic to ignore its own generated
`__test` module for the `--test` harness in terms of stability.
Closes #8962
Closes #16360
Closes #20327
[breaking-change]
|
|
Port `core::ptr::Unique` to have `PhantomData`. Add `PhantomData` to
`TypedArena` and `Vec` as well.
As a drive-by, switch `ptr::Unique` from a tuple-struct to a struct
with fields.
|
|
It doesn't have to be a literal memory allocation (ala malloc), e.g. it
can be in static memory, so saying "allocated" is mildly misleading.
|
|
This is to allow for use cases like sending a raw pointer slice across thread boundaries.
|
|
Fixes #22032
|
|
Fixes #22085
/cc @tomjakubowski
|
|
* Remove type parameters from `IteratorExt::cloned`
* Rename `IntoIterator::Iter` to `IntoIterator::IntoIter`
* Mark `IntoIterator::into_iter` as stable (but not the trait, only the method).
|
|
Replace links to `../index.html` with `index.html` as they are linking to the `std` module and not `std::cell` as intended.
See for example [RefCell documentation](http://doc.rust-lang.org/std/cell/struct.RefCell.html).
|
|
Rename several remaining `Show`s to Debug, `String`s to Display (mostly in comments and docs).
Update reference.md:
- derive() no longer supports Zero trait
- derive() now supports Copy trait
|
|
When self.start > self.end, these iterators simply return None,
so we adjust the size_hint to just return zero in this case.
Certain optimizations can be implemented in and outside libstd if we
know we can trust the size_hint for all inputs to for example
Range<usize>.
This corrects the ExactSizeIterator implementations, which IMO were
unsound and incorrect previously, since they allowed a range like (2..1)
to return a size_hint of -1us in when debug assertions are turned off.
|
|
like sending a raw pointer slice across thread boundaries.
|
|
Fixes #22085
|
|
Fixes #22032
|
|
Right now it is not possible to write a `for` loop without opting-in to the
`core` feature due to the way they're expanding (calling
`::std::iter::IntoIterator::into_iter`). There are some planned tweaks to the
`IntoIterator` trait (adding an `Item` associated type) which will cause
implementations of `IntoIterator` to break, but the *usage* of the trait is
currently stable.
This commit marks the method `into_iter` as stable as the name will not be
changing, nor the fact that it takes no arguments and returns one type (which is
determiend by the `Self` type). This means that usage of `for` loops is now
stable but manual implementations of the `IntoIterator` trait will continue to
be unstable.
|
|
This is in preparation for stabilization of the `IntoIterator` trait. All
implementations and references to `Iter` need to be renamed to `IntoIter`.
[breaking-change]
|
|
With associated types an where clauses none of the type parameters are
necessary.
[breaking-change]
|
|
Replace links to `../index.html` with `index.html` as they are
linking to the `std` module and not `std::cell` as intended.
|
|
Update reference.md:
- derive() no longer supports Zero trait
- derive() now supports Copy trait
|
|
When self.start > self.end, these iterators simply return None,
so we adjust the size_hint to just return zero in this case.
Certain optimizations can be implemented in and outside libstd if we
know we can trust the size_hint for all inputs to for example
Range<usize>.
This corrects the ExactSizeIterator implementations, which IMO were
unsound and incorrect previously, since they allowed a range like (2..1)
to return a size_hint of -1us in when debug assertions are turned off.
|
|
Fixes #21833.
[breaking-change]
|
|
Fixes #16803.
Fixes #14342.
Fixes half of #21827 -- slice syntax is still broken.
|
|
Should fix #20147
This is my second PR in the history of ever (I botched my first one #21828). Any tips would be appreciated!
|
|
closes #21630
|
|
|
|
Fixes #21491
r? @kmcallister @Gankro
|
|
New functions, `slice::from_raw_parts` and `slice::from_raw_parts_mut`,
are added to implement the lifetime convention as agreed in rust-lang/rfcs#556.
The functions `slice::from_raw_buf` and `slice::from_raw_mut_buf` are
left deprecated for the time being.
Holding back on changing the signature of `std::ffi::c_str_to_bytes` as consensus in rust-lang/rfcs#592 is building to replace it with a composition of other functions.
Contribution to #21923.
|
|
This was particularly helpful in the time just after OIBIT's
implementation to make sure things that were supposed to be Copy
continued to be, but it's now creates a lot of noise for types that
intentionally don't want to be Copy.
r? @alexcrichton
|
|
The spelling corrections were made in both documentation comments and
regular comments.
|
|
Part of #21923
|
|
|
|
|
|
Fixes #21491
|