about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-03-28Remove `unsafe` qualifier from `RefCell::as_unsafe_cell`Tobias Bucher-6/+2
This method is no longer unsafe because the field of `UnsafeCell` is no longer public.
2016-03-27Extend linkchecker with anchor checkingmitaa-2/+2
This adds checks to ensure that: * link anchors refer to existing id's on the target page * id's are unique within an html document * page redirects are valid
2016-03-26Rollup merge of #32456 - bluss:str-zero, r=alexcrichtonManish Goregaokar-1/+5
Hardcode accepting 0 as a valid str char boundary If we check explicitly for index == 0, that removes the need to read the byte at index 0, so it avoids a trip to the string's memory, and it optimizes out the slicing index' bounds check whenever it is (a constant) zero.
2016-03-24Auto merge of #32396 - nodakai:range-contains, r=alexcrichtonbors-6/+208
Add core::ops::Range*::contains() as per rust-lang/rust#32311
2016-03-24Rollup merge of #32464 - GuillaumeGomez:patch-6, r=steveklabnikSteve Klabnik-7/+3
Improve some Option code example Part of #29366. r? @steveklabnik
2016-03-24Rollup merge of #32416 - GuillaumeGomez:patch-3, r=steveklabnikSteve Klabnik-0/+23
Add doc example to clone trait Fixes #29346. r? @steveklabnik
2016-03-24Improve some Option code exampleGuillaume Gomez-7/+3
2016-03-24Add core::ops::Range*::contains() as per rust-lang/rust#32311NODA, Kai-6/+208
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-03-24Accept 0 as a valid str char boundaryUlrik Sverdrup-1/+4
Index 0 must be a valid char boundary (invariant of str that it contains valid UTF-8 data). If we check explicitly for index == 0, that removes the need to read the byte at index 0, so it avoids a trip to the string's memory, and it optimizes out the slicing index' bounds check whenever it is zero. With this change, the following examples all change from having a read of the byte at 0 and a branch to possibly panicing, to having the bounds checking optimized away. ```rust pub fn split(s: &str) -> (&str, &str) { s.split_at(0) } pub fn both(s: &str) -> &str { &s[0..s.len()] } pub fn first(s: &str) -> &str { &s[..0] } pub fn last(s: &str) -> &str { &s[0..] } ```
2016-03-23Mark str::split_at inlineUlrik Sverdrup-0/+1
2016-03-22sprinkle feature gates here and thereJorge Aparicio-0/+1
2016-03-22try! -> ?Jorge Aparicio-32/+32
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-22std: Change `encode_utf{8,16}` to return iteratorsAlex Crichton-84/+132
Currently these have non-traditional APIs which take a buffer and report how much was filled in, but they're not necessarily ergonomic to use. Returning an iterator which *also* exposes an underlying slice shouldn't result in any performance loss as it's just a lazy version of the same implementation, and it's also much more ergonomic! cc #27784
2016-03-22Add doc example to clone traitGuillaume Gomez-0/+23
2016-03-21Rollup merge of #32322 - GuillaumeGomez:cmp_doc, r=steveklabnikSteve Klabnik-0/+35
Add doc examples Fixes #29347 r? @steveklabnik
2016-03-21Auto merge of #32054 - seanmonstar:impl-debug-core, r=alexcrichtonbors-34/+319
libcore: add Debug implementations to most missing types Also adds `#![deny(missing_debug_implementations)]` to the core crate. cc #31869
2016-03-20Update snapshots to 2016-03-18 (235d774).Eduard Burtescu-53/+39
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-34/+319
2016-03-19Auto merge of #32244 - Amanieu:compare_exchange_result, r=alexcrichtonbors-87/+134
Change compare_exchange to return a Result<T, T> As per the discussion in #31767 I also changed the feature name from `extended_compare_and_swap` to `compare_exchange`. r? @alexcrichton
2016-03-19Change compare_exchange to return a Result<T, T>Amanieu d'Antras-87/+134
2016-03-18Add intrinsics for float arithmetic with `fast` flag enabledUlrik Sverdrup-0/+26
`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe" (according to llvm) float optimizations. See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags Providing these operations with less precise associativity rules (for example) is useful to numerical applications. For example, the summation loop: let sum = 0.; for element in data { sum += *element; } Using the default floating point semantics, this loop expresses the floats must be added in a sequence, one after another. This constraint is usually completely unintended, and it means that no autovectorization is possible.
2016-03-18Add doc examplesGuillaume Gomez-0/+35
2016-03-17Add #[rustc_no_mir] to make tests pass with -Z orbit.Eduard Burtescu-0/+4
2016-03-12std: Clean out deprecated APIsAlex Crichton-383/+13
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-11std: Add a tracking issue for Peekable::is_emptyAlex Crichton-1/+1
The listed tracking issue was hooked up to the wrong location by accident.
2016-03-11core: Make a new tracking issue for prelude traitsAlex Crichton-7/+7
The referenced issues here were both closed, so hook up a new issue which tracks specifically the prelude traits being unstable.
2016-03-11core: Mark Wrapping impls as stableAlex Crichton-5/+5
These are all insta-stable anyway, so just properly tag them.
2016-03-12Rollup merge of #32183 - bluss:doc-index, r=alexcrichtonManish Goregaokar-0/+58
Clarify doc for slice slicing (Index impls) Clarify doc for slice slicing (Index impls) This is a follow up for PR #32099 and #32057
2016-03-11Auto merge of #32133 - alexcrichton:linkchecker, r=brsonbors-56/+78
Add a link validator to rustbuild This commit was originally targeted at just adding a link checking script to the rustbuild system. This ended up snowballing a bit to extend rustbuild to be amenable to various tools we have as part of the build system in general. There's a new `src/tools` directory which has a number of scripts/programs that are purely intended to be used as part of the build system and CI of this repository. This is currently inhabited by rustbook, the error index generator, and a new linkchecker script added as part of this PR. I suspect that more tools like compiletest, tidy scripts, snapshot scripts, etc will migrate their way into this directory over time. The commit which adds the error index generator shows the steps necessary to add new tools to the build system, namely: 1. New steps are defined for building the tool and running the tool 2. The dependencies are configured 3. The steps are implemented In terms of the link checker, these commits do a few things: * A new `src/tools/linkchecker` script is added. This will read an entire documentation tree looking for broken relative links (HTTP links aren't followed yet). * A large number of broken links throughout the documentation were fixed. Many of these were just broken when viewed from core as opposed to std, but were easily fixed. * A few rustdoc bugs here and there were fixed
2016-03-10Clarify doc for slice slicing (Index impls)Ulrik Sverdrup-0/+58
This is a follow up for PR #32099 and #32057
2016-03-10Auto merge of #32173 - steveklabnik:rollup, r=steveklabnikbors-8/+10
Rollup of 8 pull requests - Successful merges: #31830, #32091, #32125, #32136, #32147, #32148, #32149, #32150 - Failed merges:
2016-03-10Rollup merge of #32091 - dirk:dirk/siphasher-docs-clarification, r=alexcrichtonSteve Klabnik-8/+10
Clarify documentation of hash::SipHasher The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links. Fixes #32043. r? @sfackler
2016-03-10Auto merge of #32100 - SimonSapin:patch-6, r=alexcrichtonbors-2/+4
"can be built on Ref::map"… how? Now that `std::cell::Ref::filter_map` and `RefMut::filter_map` are deprecated, using them gives a warning like: ``` script/dom/element.rs:754:9: 754:24 warning: use of deprecated item: can be built on Ref::map, #[warn(deprecated)] on by default ``` But it’s not at all obvious *how* the functionality can be built on `Ref::map`. This PR adds to the warning message a crates.io URL for a crate that does.
2016-03-08Link to actual CSPRNG in `hash::SipHasher` documentationDirk Gadsden-4/+4
2016-03-08std: Fix rustdoc links with std::fmt::AlignmentAlex Crichton-12/+33
This is actually a reexported implementation detail in the `rt::v1` module but rustdoc doesn't like reexporting items from `doc(hidden)` modules. Do what we'd end up doing anyway from an API perspective and make a public-facing `enum` that can be retranslated under the hood if necessary.
2016-03-08doc: Fix a bunch of broken linksAlex Crichton-44/+45
A few categories: * Links into compiler docs were just all removed as we're not generating compiler docs. * Move up one more level to forcibly go to std docs to fix inlined documentation across the facade crates.
2016-03-08Rollup merge of #32099 - bluss:doc-string-slicing, r=alexcrichtonSteve Klabnik-13/+51
Clarify documentation for string slicing (Index impls) Clarify documentation for string slicing (Index impls) - Mention the sugared syntax for the implementations, since it's not apparent from the docs that `Index<Range<usize>>` corresponds to `&self[a..b]`. - Be specific in that start <= end and end <= len This is just one fix in response to #32057
2016-03-07Clarify documentation for string slicing (Index impls)Ulrik Sverdrup-13/+51
- Mention the sugared syntax for the implementations, since it's not apparent from the docs that `Index<Range<usize>>` corresponds to `&self[a..b]`. - Be specific in that start <= end and end <= len
2016-03-07Fix some line lengthsSimon Sapin-2/+4
2016-03-07"can be built on Ref::map"… how?Simon Sapin-2/+2
Now that `std::cell::Ref::filter_map` and `RefMut::filter_map` are deprecated, using them gives a warning like: ``` script/dom/element.rs:754:9: 754:24 warning: use of deprecated item: can be built on Ref::map, #[warn(deprecated)] on by default ``` But it’s not at all obvious *how* the functionality can be built on `Ref::map`. This PR adds to the warning message a crates.io URL for a crate that does.
2016-03-07Auto merge of #32051 - steveklabnik:gh9447, r=blussbors-8/+8
Fixes #9447
2016-03-06Amend `hash::SipHasher` docs to more strongly discourage cryptographic usesDirk Gadsden-4/+3
2016-03-06Clarify documentation of `hash::SipHasher`Dirk Gadsden-6/+9
The docs were making assertions/recommendations they shouldn't have. This clarifies them and adds some helpful links. Fixes #32043.
2016-03-07Auto merge of #32064 - bluss:str-slice-panic, r=alexcrichtonbors-3/+21
Fix panic on string slicing error to truncate the string The string may be arbitrarily long, but we want to limit the panic message to a reasonable length. Truncate the string if it is too long (simply to char boundary). Also add details to the start <= end message. I think it's ok to flesh out the code here, since it's in a cold function. Fixes #32063
2016-03-06Auto merge of #30884 - durka:inclusive-ranges, r=aturonbors-102/+415
This PR implements [RFC 1192](https://github.com/rust-lang/rfcs/blob/master/text/1192-inclusive-ranges.md), which is triple-dot syntax for inclusive range expressions. The new stuff is behind two feature gates (one for the syntax and one for the std::ops types). This replaces the deprecated functionality in std::iter. Along the way I simplified the desugaring for all ranges. This is my first contribution to rust which changes more than one character outside of a test or comment, so please review carefully! Some of the individual commit messages have more of my notes. Also thanks for putting up with my dumb questions in #rust-internals. - For implementing `std::ops::RangeInclusive`, I took @Stebalien's suggestion from https://github.com/rust-lang/rfcs/pull/1192#issuecomment-137864421. It seemed to me to make the implementation easier and increase type safety. If that stands, the RFC should be amended to avoid confusion. - I also kind of like @glaebhoerl's [idea](https://github.com/rust-lang/rfcs/pull/1254#issuecomment-147815299), which is unified inclusive/exclusive range syntax something like `x>..=y`. We can experiment with this while everything is behind a feature gate. - There are a couple of FIXMEs left (see the last commit). I didn't know what to do about `RangeArgument` and I haven't added `Index` impls yet. Those should be discussed/finished before merging. cc @Gankro since you [complained](https://www.reddit.com/r/rust/comments/3xkfro/what_happened_to_inclusive_ranges/cy5j0yq) cc #27777 #30877 rust-lang/rust#1192 rust-lang/rfcs#1254 relevant to #28237 (tracking issue)
2016-03-05Fix panic on string slicing error to truncate the stringUlrik Sverdrup-3/+21
The string may be arbitrarily long, but we want to limit the panic message to a reasonable length. Truncate the string if it is too long (simply to char boundary). Also add details to the start <= end message. I think it's ok to flesh out the code here, since it's in a cold function.
2016-03-05Auto merge of #31700 - oli-obk:skip_double_ended, r=alexcrichtonbors-0/+11
[Playground Example](https://play.rust-lang.org/?gist=66fdb4fe1cf4d8aa2ad4&version=stable)
2016-03-04remove under/overflow from next_back/nextAlex Burka-6/+10
2016-03-04add more unstable annotationsAlex Burka-0/+15
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-8/+8
Fixes #9447