about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-02-09Rollup merge of #31516 - steveklabnik:doc_tuples, r=brsonSteve Klabnik-18/+1
Fixes #29339
2016-02-09Rollup merge of #31514 - cgar:spelling, r=alexcrichtonSteve Klabnik-2/+2
2016-02-09Properly document tuplesSteve Klabnik-18/+1
Fixes #29339
2016-02-09Some docs for std::numSteve Klabnik-1/+19
This commit does two things: * Re-works the module-level documentation. * Cleaning up wording and adding links to where error types are used. Part of #29364
2016-02-09Minor spelling fixesCarlos E. Garcia-2/+2
2016-02-09Auto merge of #31510 - dikaiosune:master, r=blussbors-4/+4
Since a lexicographic ordering of a struct could vary based on which struct members are compared first, I ended up doing some testing to ensure that the behavior when deriving these traits was what I expected (ordered based on the top to bottom order of declaration of the members). I wanted to add this little bit of documentation to potentially save someone else the same effort. That is, assuming that my testing correctly reflects the intended behavior of the compiler. r? @steveklabnik
2016-02-09Clarifying behavior of #[derive(Ord, PartialOrd)] in doc comments.Adam Perry-4/+4
Removing redundant statement about lexicographic ordering.
2016-02-08Implement fmt::Pointer for pointers to unsized typesKamal Marhubi-5/+5
This allows printing pointers to unsized types with the {:p} formatting directive. The following impls are extended to unsized types: - impl<'a, T: ?Sized> Pointer for &'a T - impl<'a, T: ?Sized> Pointer for &'a mut T - impl<T: ?Sized> Pointer for *const T - impl<T: ?Sized> Pointer for *mut T - impl<T: ?Sized> fmt::Pointer for Box<T> - impl<T: ?Sized> fmt::Pointer for Rc<T> - impl<T: ?Sized> fmt::Pointer for Arc<T>
2016-02-08Remove old #[allow(trivial_casts)] annotationsAlex Crichton-8/+0
These were added a long time ago but we long since switched the lint back to allow-by-default, so these annotations shouldn't be necessary.
2016-02-07Auto merge of #31450 - bluss:no-null-markers, r=Gankrobors-2/+10
Document that Unique<T> and Shared<T> are non-null
2016-02-06Document that Unique<T> and Shared<T> are non-nullUlrik Sverdrup-2/+10
2016-02-06Auto merge of #31410 - rkruppe:issue31109, r=pnkfelixbors-10/+30
Issue #31109 uncovered two semi-related problems: * A panic in `str::parse::<f64>` * A panic in `rustc::middle::const_eval::lit_to_const` where the result of float parsing was unwrapped. This series of commits fixes both issues and also drive-by-fixes some things I noticed while tracking down the parsing panic.
2016-02-04drive-by doc fixesRobin Kruppe-1/+1
2016-02-04Prevent the immediate panic uncovered by #31109 and add a test.Robin Kruppe-8/+28
The code there still triggers an ICE, but for different reasons (const eval unwraps the parse result).
2016-02-04Use the right target ratio in Algorithm M quickstart.Robin Kruppe-1/+1
Using f64's bit size probably wasn't actually *wrong*, but it would overshoot for no reason. This might have slowed down f32 parsing significantly.
2016-02-03Rollup merge of #31351 - steveklabnik:gh31318, r=alexcrichtonManish Goregaokar-0/+24
This is a behavior that some find confusing, so it deserves its own example. Fixes #31318 I think this wording might be a bit strange, but I couldn't come up with anything better. Feedback very welcome.
2016-02-03Rollup merge of #31220 - steveklabnik:gh30632, r=nikomatsakisManish Goregaokar-0/+43
Fixes #30632 I'm not sure if this explanation is good enough. If it is, I will add it to filter as well.
2016-02-02Rollup merge of #31346 - alopatindev:fixes, r=aturonSteve Klabnik-1/+1
Space character is missed after `let some_usize`
2016-02-02Rollup merge of #31345 - kamalmarhubi:book-docs-special-section-errors, ↵Steve Klabnik-1/+1
r=steveklabnik This matches the usage in the standard library's documentation.
2016-02-02Rollup merge of #31247 - tshepang:redundant-bindings, r=steveklabnikSteve Klabnik-28/+10
2016-02-01docs: Standardize on 'Errors' header in std docsKamal Marhubi-1/+1
2016-02-01Further explain take_whileSteve Klabnik-0/+24
This is a behavior that some find confusing, so it deserves its own example. Fixes #31318
2016-02-01Discuss pitfalls of stateful closures with MapSteve Klabnik-0/+43
Fixes #30632
2016-02-01doc: bindings not needed for this exampleTshepang Lekhonkhobe-28/+10
2016-02-01Fix a documentation typoAlexander Lopatin-1/+1
2016-02-01Auto merge of #30901 - mackwic:doc-core-convert, r=steveklabnikbors-0/+57
Also add a note about the necessary simplicity of the conversion. Related issue: #29349 r? @steveklabnik
2016-01-31 Doc:std::convert: disambiguate traits and keywordsThomas Wickham-6/+6
2016-01-29trans: Reimplement unwinding on MSVCAlex Crichton-2/+10
This commit transitions the compiler to using the new exception handling instructions in LLVM for implementing unwinding for MSVC. This affects both 32 and 64-bit MSVC as they're both now using SEH-based strategies. In terms of standard library support, lots more details about how SEH unwinding is implemented can be found in the commits. In terms of trans, this change necessitated a few modifications: * Branches were added to detect when the old landingpad instruction is used or the new cleanuppad instruction is used to `trans::cleanup`. * The return value from `cleanuppad` is not stored in an `alloca` (because it cannot be). * Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool` for indicating whether it's in a landing pad or not. The new exception handling intrinsics require that on MSVC each `call` inside of a landing pad is annotated with which landing pad that it's in. This change to the basic block means that whenever a `call` or `invoke` instruction is generated we know whether to annotate it as part of a cleanuppad or not. * Lots of modifications were made to the instruction builders to construct the new instructions as well as pass the tagging information for the call/invoke instructions. * The translation of the `try` intrinsics for MSVC has been overhauled to use the new `catchpad` instruction. The filter function is now also a rustc-generated function instead of a purely libstd-defined function. The libstd definition still exists, it just has a stable ABI across architectures and leaves some of the really weird implementation details to the compiler (e.g. the `localescape` and `localrecover` intrinsics).
2016-01-28Fix `make tidy` and name what is being computedAndrea Canciani-1/+2
2016-01-28Improve naming and explanationsAndrea Canciani-7/+14
2016-01-28Improve computation of `EscapeUnicode` offset fieldAndrea Canciani-5/+7
Instead of iteratively scanning the bits, use `leading_zeros`.
2016-01-28Unify computation of length in `EscapeUnicode`Andrea Canciani-20/+22
The `offset` value was computed both in `next` and in `size_hint`; computing it in a single place ensures consistency and makes it easier to apply improvements. The value is now computed as soon as the iterator is constructed. This means that the time to compute it is spent immediately and cannot be avoided, but it also guarantees that it is only spent once.
2016-01-27doc: insert missing charsTshepang Lekhonkhobe-2/+2
2016-01-26Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brsonbors-0/+1
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-26Auto merge of #31081 - alexcrichton:stabilize-hasher, r=aturonbors-0/+72
This commit implements the stabilization of the custom hasher support intended for 1.7 but left out due to some last-minute questions that needed some decisions. A summary of the actions done in this PR are: Stable * `std::hash::BuildHasher` * `BuildHasher::Hasher` * `BuildHasher::build_hasher` * `std::hash::BuildHasherDefault` * `HashMap::with_hasher` * `HashMap::with_capacity_and_hasher` * `HashSet::with_hasher` * `HashSet::with_capacity_and_hasher` * `std::collections::hash_map::RandomState` * `RandomState::new` Deprecated * `std::collections::hash_state` * `std::collections::hash_state::HashState` - this trait was also moved into `std::hash` with a reexport here to ensure that we can have a blanket impl to prevent immediate breakage on nightly. Note that this is unstable in both location. * `HashMap::with_hash_state` - renamed * `HashMap::with_capacity_and_hash_state` - renamed * `HashSet::with_hash_state` - renamed * `HashSet::with_capacity_and_hash_state` - renamed Closes #27713
2016-01-26std: Stabilize custom hasher support in HashMapAlex Crichton-0/+72
This commit implements the stabilization of the custom hasher support intended for 1.7 but left out due to some last-minute questions that needed some decisions. A summary of the actions done in this PR are: Stable * `std::hash::BuildHasher` * `BuildHasher::Hasher` * `BuildHasher::build_hasher` * `std::hash::BuildHasherDefault` * `HashMap::with_hasher` * `HashMap::with_capacity_and_hasher` * `HashSet::with_hasher` * `HashSet::with_capacity_and_hasher` * `std::collections::hash_map::RandomState` * `RandomState::new` Deprecated * `std::collections::hash_state` * `std::collections::hash_state::HashState` - this trait was also moved into `std::hash` with a reexport here to ensure that we can have a blanket impl to prevent immediate breakage on nightly. Note that this is unstable in both location. * `HashMap::with_hash_state` - renamed * `HashMap::with_capacity_and_hash_state` - renamed * `HashSet::with_hash_state` - renamed * `HashSet::with_capacity_and_hash_state` - renamed Closes #27713
2016-01-26RangeFrom::step_by docs: fix exampleSimon Sapin-3/+5
The previous example did not do what its description said. In it panicked on integer overflow in debug mode, and went into an infinite loop in release mode (wrapping back to 0 after printing 254).
2016-01-26Rollup merge of #31201 - steveklabnik:gh30633, r=alexcrichtonManish Goregaokar-0/+6
Fixes #30633
2016-01-25Describe next_back() wrt Iterator protocolSteve Klabnik-0/+6
Fixes #30633
2016-01-25RefCell::borrow_mut example should demonstrate mutCorey Farwell-1/+3
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-0/+1
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-23Auto merge of #31116 - bluss:expect-out-cold, r=alexcrichtonbors-7/+20
Use cold functions for panic formatting Option::expect, Result::unwrap, expect These methods are marked inline, but insert a big chunk of formatting code, as well as other error path related code, such as deallocating a std::io::Error if you have one. We can explicitly separate out that code path into a function that is never inline, since the panicking case should always be rare.
2016-01-22Auto merge of #30917 - arthurprs:bs_bounds_check, r=alexcrichtonbors-11/+12
Avoid bounds checking for binary search. All calculated indexes are safe and the branch is useless.
2016-01-22Move cold panic functions in Option and ResultUlrik Sverdrup-28/+18
Move functions out of their impl blocks; avoids unnecessary monomorphization by type parameters that are irrelevant to the message output.
2016-01-22Use cold functions for panic formatting Option::expect, Result::unwrap etcUlrik Sverdrup-7/+30
Option::expect, Result::unwrap, unwrap_err, expect These methods are marked inline, but insert a big chunk of formatting code, as well as other error path related code, such as deallocating a std::io::Error if you have one. We can explicitly separate out that code path into a function that is never inline, since the panicking case should always be rare.
2016-01-22Avoid bounds check for slice binary searcharthurprs-11/+12
2016-01-22Auto merge of #31084 - ranma42:cmd-no-unsafe, r=alexcrichtonbors-13/+4
Instead of transmuting, use a match; the compiler has learnt how to optimize it.
2016-01-21Auto merge of #31052 - bluss:split-at-mut-str, r=alexcrichtonbors-3/+31
Use raw pointers to avoid aliasing in str::split_at_mut Introduce private function from_raw_parts_mut for str to factor out the logic. We want to use raw pointers here instead of duplicating a &mut str, to be on safer ground w.r.t rust aliasing rules. This has already been fixed for slices in PR #27358, issue #27357
2016-01-21Remove `unsafe` code from `core::cmp`Andrea Canciani-13/+4
Instead of transmuting, use a match; the compiler has learnt how to optimize it.
2016-01-21core: Use raw pointers to avoid aliasing in str::split_at_mutUlrik Sverdrup-3/+31
Introduce private function from_raw_parts_mut for str to factor out the logic. We want to use raw pointers here instead of duplicating a &mut str, to be on safer ground w.r.t rust aliasing rules.