about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-02-14Make std::raw::Repr an unsafe traitUlrik Sverdrup-3/+3
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]
2015-02-14Dramatically expand the docs of std::raw.Huon Wilson-5/+108
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]
2015-02-13add an associated `Item` type to `IntoIterator`Jorge Aparicio-0/+73
2015-02-14Rename `fmt::Writer` to `fmt::Write`Chris Wong-10/+10
This brings it in line with its namesake in `std::io`. [breaking-change]
2015-02-13Remove ExactSizeIterator from 64-bit ranges.Ulrik Sverdrup-2/+2
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]
2015-02-13Audit integer type usage in `core::option`Niko Matsakis-28/+28
2015-02-13Audit integer type usage in `core::ptr`Niko Matsakis-20/+20
2015-02-13Add link to module-level Option documentation.Steve Klabnik-1/+1
2015-02-13Refer to LLVM rather than GCC wiki for atomic orderingsSteve Klabnik-2/+2
Fixes #22064.
2015-02-13Improve core::cmp docsSteve Klabnik-66/+206
2015-02-13Rename the "unsafe" lang item to "unsafe_cell"Chris Wong-1/+2
2015-02-13Remove `_VALUE` from the float extremes constants.Huon Wilson-11/+37
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]
2015-02-12std: Add missing stability for core::fmtAlex Crichton-0/+1
The `Arguments::new_v1_formatted` function was accidentally left out when this module was stabilized.
2015-02-11More test fixes and rebase conflictsAlex Crichton-1/+0
2015-02-11rollup merge of #22166: dcrewi/iter-impls-for-windowsAlex Crichton-2/+36
- DoubleEndedIterator - ExactSizeIterator - RandomAccessIterator
2015-02-11implement missing iterator traits for slice::WindowsDavid Creswick-2/+36
- DoubleEndedIterator - ExactSizeIterator - RandomAccessIterator
2015-02-11rollup merge of #22164: huonw/alloc--Alex Crichton-5/+6
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
2015-02-11rollup merge of #22127: alexcrichton/stability-holesAlex Crichton-9/+8
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
2015-02-11rustc: Fix a number of stability lint holesAlex Crichton-9/+8
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]
2015-02-11Add core::marker::PhantomData.Felix S. Klock II-3/+32
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.
2015-02-11Tweak wording of copy_nonoverlapping_memory to remove misleading 'allocated'.Huon Wilson-5/+6
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.
2015-02-10rollup merge of #22142: Kimundi/unsized_uniqueAlex Crichton-3/+3
This is to allow for use cases like sending a raw pointer slice across thread boundaries.
2015-02-10rollup merge of #22129: steveklabnik/gh22032Alex Crichton-3/+2
Fixes #22032
2015-02-10rollup merge of #22128: steveklabnik/gh22085Alex Crichton-0/+5
Fixes #22085 /cc @tomjakubowski
2015-02-10rollup merge of #22125: alexcrichton/into-iter-stabilityAlex Crichton-11/+11
* 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).
2015-02-10rollup merge of #22112: mbudde/std-cell-doc-fixAlex Crichton-5/+5
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).
2015-02-10rollup merge of #22094: alkor/cleanup-show-stringAlex Crichton-1/+1
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
2015-02-10rollup merge of #22065: bluss/range-size-hintAlex Crichton-10/+7
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.
2015-02-10Made the `ptr::Unique` type accept unsized types, to allow for use casesMarvin Löbel-3/+3
like sending a raw pointer slice across thread boundaries.
2015-02-09Set up docs for missing core typesSteve Klabnik-0/+5
Fixes #22085
2015-02-09Remove incorrect docs from mem::transmuteSteve Klabnik-3/+2
Fixes #22032
2015-02-09std: Mark IntoIterator::into_iter as #[stableAlex Crichton-0/+1
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.
2015-02-09std: Rename IntoIterator::Iter to IntoIterAlex Crichton-7/+7
This is in preparation for stabilization of the `IntoIterator` trait. All implementations and references to `Iter` need to be renamed to `IntoIter`. [breaking-change]
2015-02-09std: Remove typarms from IteratorExt::clonedAlex Crichton-4/+3
With associated types an where clauses none of the type parameters are necessary. [breaking-change]
2015-02-09Fix links to module-level documentation in `std::cell`Michael Budde-5/+5
Replace links to `../index.html` with `index.html` as they are linking to the `std` module and not `std::cell` as intended.
2015-02-08Rename Show to Debug, String to DisplayAlexander Korolkov-1/+1
Update reference.md: - derive() no longer supports Zero trait - derive() now supports Copy trait
2015-02-08Fix std::ops::Range size_hint and ExactSizeIterator implsUlrik Sverdrup-10/+7
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.
2015-02-07Feature-gate #![no_std]Keegan McAllister-0/+1
Fixes #21833. [breaking-change]
2015-02-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-9/+17
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-02-07Auto merge of #21995 - leejunseok:fix_invariant_ex, r=steveklabnikbors-5/+6
Should fix #20147 This is my second PR in the history of ever (I botched my first one #21828). Any tips would be appreciated!
2015-02-06make `IndexMut` a super trait over `Index`Jorge Aparicio-20/+14
closes #21630
2015-02-07Fix several tiny typosIngo Blechschmidt-2/+2
2015-02-06Rollup merge of #21989 - steveklabnik:gh21491, r=GankroManish Goregaokar-1/+1
Fixes #21491 r? @kmcallister @Gankro
2015-02-06Rollup merge of #21926 - mzabaluev:raw-lifetime, r=alexcrichtonManish Goregaokar-4/+52
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.
2015-02-06Rollup merge of #21925 - sfackler:allow-missing-copy, r=alexcrichtonManish Goregaokar-4/+0
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
2015-02-06Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnikManish Goregaokar-1/+1
The spelling corrections were made in both documentation comments and regular comments.
2015-02-06Rollup merge of #21976 - mzabaluev:fix-copy-mut-lifetime, r=alexcrichtonManish Goregaokar-3/+4
Part of #21923
2015-02-05added example back in, with a modified, (hopefully) improved descriptionJunseok Lee-0/+14
2015-02-05removed weird exampleJunseok Lee-13/+0
2015-02-05Improve ptr::read docsSteve Klabnik-1/+1
Fixes #21491