summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-09-20Fix build errorBrian Anderson-1/+0
2016-09-19Remove data structure specialization for .zip() iteratorUlrik Sverdrup-38/+14
Go back on half the specialization, the part that changed the Zip struct's fields themselves depending on the types of the iterators. This means that the Zip iterator will always carry two usize fields, which are unused. If a whole for loop using a .zip() iterator is inlined, these are simply removed and have no effect. The same improvement for Zip of for example slice iterators remain, and they still optimize well. However, like when the specialization of zip was merged, the compiler is still very sensistive to the exact context. For example this code only autovectorizes if the function is used, not if the code in zip_sum_i32 is inserted inline it was called: ``` fn zip_sum_i32(xs: &[i32], ys: &[i32]) -> i32 { let mut s = 0; for (&x, &y) in xs.iter().zip(ys) { s += x * y; } s } fn zipdot_i32_default_zip(b: &mut test::Bencher) { let xs = vec![1; 1024]; let ys = vec![1; 1024]; b.iter(|| { zip_sum_i32(&xs, &ys) }) } ``` Include a test that checks that Zip<T, U> is covariant w.r.t. T and U.
2016-08-22std: Stabilize APIs for the 1.12 releaseAlex Crichton-10/+48
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
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-0/+59
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 `()`.
2016-08-14Rollup merge of #35622 - matthew-piziak:convert-docs-typos, r=apasel422Eduard-Mihai Burtescu-4/+4
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.
2016-08-14Rollup merge of #35588 - Antti:fix-atomics-docs, r=alexcrichtonEduard-Mihai Burtescu-1/+1
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`.
2016-08-14Rollup merge of #35392 - malbarbo:cell-from, r=brsonEduard-Mihai Burtescu-0/+22
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`.
2016-08-13Rename empty/bang to neverAndrew Cann-7/+7
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Minor fixups based on @eddyb's feedbackAndrew Cann-4/+6
Mainly, remove mk_empty() method and replace with tcx.types.empty
2016-08-13Control usage of `!` through a feature gate.Andrew Cann-0/+1
Adds the `bang_type` feature gate. `!` in a non-return-type position now relies on that feature.
2016-08-13implement std::cmp::* traits for `!`Andrew Cann-0/+33
2016-08-13impl Debug + Display for !Andrew Cann-0/+23
2016-08-12fix small typos in std::convert documentationMatthew Piziak-4/+4
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.
2016-08-11Rollup merge of #35562 - birkenfeld:as-mut-doc, r=steveklabnikJonathan Turner-2/+2
Remove redundant `&mut ref mut` in doc for Result::as_mut() While a good example of how `&mut ref mut` is a no-op, I don't think we should show that here :) See https://users.rust-lang.org/t/mnemonic-for-reading-qualifiers/6853 r? @steveklabnik
2016-08-11Rollup merge of #35279 - cengizIO:master, r=brsonJonathan Turner-8/+37
Provide a cleaner documentation for 'write!' Hello! This is my attempt to fix #35110 Any feedback is more than welcome! Cheers!
2016-08-11Use an existing constant name as an example.Andrii Dmytrenko-1/+1
2016-08-10Remove redundant `&mut ref mut` in doc for Result::as_mut()Georg Brandl-2/+2
2016-08-09Auto merge of #35425 - apasel422:refcell, r=alexcrichtonbors-9/+116
Implement `RefCell::{try_borrow, try_borrow_mut}` CC #35070 r? @alexcrichton
2016-08-08Auto merge of #34762 - creativcoder:slice-ext, r=alexcrichtonbors-8/+8
extend lifetime on binary_search_by_key of SliceExt trait Fixes #34683.
2016-08-08Implement `RefCell::{try_borrow, try_borrow_mut}`Andrew Paseltiner-9/+116
2016-08-09extend lifetime on binary_search_by_key of SliceExt traitRahul Sharma-8/+8
2016-08-06Indicate tracking issue for `exact_size_is_empty` unstability.Corey Farwell-1/+1
2016-08-06Rollup merge of #35281 - apasel422:repr, r=GuillaumeGomezEduard-Mihai Burtescu-8/+8
Clean up `std::raw` docs There is no longer a `Repr` trait, so mentioning a missing impl of it was potentially confusing. r? @steveklabnik
2016-08-05Clean up `std::raw` docsAndrew Paseltiner-8/+8
There is no longer a `Repr` trait, so mentioning a missing impl of it was potentially confusing.
2016-08-05Implement From for Cell, RefCell and UnsafeCellMarco A L Barbosa-0/+22
2016-08-05Rollup merge of #35042 - Havvy:copy_error_doc, r=GuillaumeGomezGuillaume Gomez-0/+6
Add Derive not possible question to Copy This adds a question and answer to the Q&A section of the Copy docs. Specifically, it asks the question I asked while reading the docs, and gives its answer. cc @steveklabnik
2016-08-03Auto merge of #34520 - Manishearth:fix-unsafecell-docs, r=steveklabnikbors-0/+19
Clarify UnsafeCell docs; fix #34496 None
2016-08-04Be more explicit about duck typingCengiz Can-20/+24
2016-08-04Use consistent spelling for word 'implementor'Cengiz Can-4/+4
2016-08-04Provide a cleaner documentation for 'write!'Cengiz Can-6/+31
2016-08-02core: fix `cargo build` for targets with "max-atomic-width": 0Jorge Aparicio-0/+2
This crate was failing to compile due to dead_code/unused_imports warnings. This commits disables these two lints for these targets.
2016-08-01Add Derive not possible question to CopyRyan Scheel (Havvy)-0/+6
This adds a question and answer to the Q&A section of the Copy docs. Specifically, it asks the question I asked while reading the docs, and gives its answer.
2016-07-30Rollup merge of #35058 - jethrogb:no_panic_abs, r=alexcrichtonManish Goregaokar-0/+84
Add non-panicking abs() functions to all signed integer types. Currently, calling abs() on one of the signed integer types might panic (in debug mode at least) because the absolute value of the largest negative value can not be represented in that signed type. Unlike all other integer operations, there is currently not a non-panicking version on this function. This seems to just be an oversight in the design, therefore just adding it now.
2016-07-29Rollup merge of #35072 - munyari:assert_debug, r=steveklabnikGuillaume Gomez-0/+18
Update docs for assert! and debug_assert! Refer to #34455
2016-07-29Rollup merge of #35062 - frewsxcv:chars-as-str, r=GuillaumeGomezGuillaume Gomez-0/+13
Add documentation example for `str::Chars::as_str`. None
2016-07-28Auto merge of #34485 - tbu-:pr_unicode_debug_str, r=alexcrichtonbors-11/+744
Escape fewer Unicode codepoints in `Debug` impl of `str` Use the same procedure as Python to determine whether a character is printable, described in [PEP 3138]. In particular, this means that the following character classes are escaped: - Cc (Other, Control) - Cf (Other, Format) - Cs (Other, Surrogate), even though they can't appear in Rust strings - Co (Other, Private Use) - Cn (Other, Not Assigned) - Zl (Separator, Line) - Zp (Separator, Paragraph) - Zs (Separator, Space), except for the ASCII space `' '` `0x20` This allows for user-friendly inspection of strings that are not English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`). Fixes #34318. CC #34422. [PEP 3138]: https://www.python.org/dev/peps/pep-3138/
2016-07-28Add non-panicking abs() functions to all signed integer types.Jethro Beekman-0/+84
Currently, calling abs() on one of the signed integer types might panic (in debug mode at least) because the absolute value of the largest negative value can not be represented in that signed type. Unlike all other integer operations, there is currently not a non-panicking version on this function. This seems to just be an oversight in the design, therefore just adding it now.
2016-07-28Add documentation example for `str::Chars::as_str`.Corey Farwell-0/+13
2016-07-28Rename `char::escape` to `char::escape_debug` and add tracking issueTobias Bucher-14/+14
2016-07-27Mention debug_assert! in assert! docPanashe M. Fundira-1/+2
2016-07-27Revert section about panic! in assert! docPanashe M. Fundira-3/+2
2016-07-27Correct minor typo in debug_assert docPanashe M. Fundira-1/+1
2016-07-27Update docs for assert! and debug_assert!Panashe M. Fundira-2/+20
2016-07-26Rollup merge of #34732 - durka:patch-27, r=steveklabnikSteve Klabnik-3/+4
document DoubleEndedIterator::next_back document DoubleEndedIterator::next_back fixes #34726
2016-07-26Rollup merge of #34609 - ubsan:transmute_docs, r=steveklabnikSteve Klabnik-5/+188
Add more docs - mostly warnings - to std::mem::transmute
2016-07-26Restore `char::escape_default` and add `char::escape` insteadTobias Bucher-3/+39
2016-07-26Clarify UnsafeCell docs; fix #34496Manish Goregaokar-0/+19
2016-07-24Rollup merge of #34976 - GuillaumeGomez:build_hasher_doc, r=steveklabnikManish Goregaokar-0/+10
Add BuildHasher example r? @steveklabnik
2016-07-23Fix indentation in src/libcore/lib.rsTobias Bucher-9/+9
2016-07-23Escape fewer Unicode codepoints in `Debug` impl of `str`Tobias Bucher-2/+699
Use the same procedure as Python to determine whether a character is printable, described in [PEP 3138]. In particular, this means that the following character classes are escaped: - Cc (Other, Control) - Cf (Other, Format) - Cs (Other, Surrogate), even though they can't appear in Rust strings - Co (Other, Private Use) - Cn (Other, Not Assigned) - Zl (Separator, Line) - Zp (Separator, Paragraph) - Zs (Separator, Space), except for the ASCII space `' '` (`0x20`) This allows for user-friendly inspection of strings that are not English (e.g. compare `"\u{e9}\u{e8}\u{ea}"` to `"éèê"`). Fixes #34318. [PEP 3138]: https://www.python.org/dev/peps/pep-3138/