about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2014-07-09str: use more helpful assertion failure messagesCorey Richardson-2/+5
2014-07-09Add example to Any documentationAlisdair Owens-6/+55
2014-07-08make macros non-capturingJohn Clements-67/+67
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-1/+1
[breaking-change]
2014-07-08auto merge of #15406 : luqmana/rust/nop, r=pcwaltonbors-12/+24
Extend the null ptr optimization to work with slices, closures, procs, & trait objects by using the internal pointers as the discriminant. This decreases the size of `Option<&[int]>` (and similar) by one word.
2014-07-07Add libunicode; move unicode functions from corekwantam-5377/+4
- created new crate, libunicode, below libstd - split Char trait into Char (libcore) and UnicodeChar (libunicode) - Unicode-aware functions now live in libunicode - is_alphabetic, is_XID_start, is_XID_continue, is_lowercase, is_uppercase, is_whitespace, is_alphanumeric, is_control, is_digit, to_uppercase, to_lowercase - added width method in UnicodeChar trait - determines printed width of character in columns, or None if it is a non-NULL control character - takes a boolean argument indicating whether the present context is CJK or not (characters with 'A'mbiguous widths are double-wide in CJK contexts, single-wide otherwise) - split StrSlice into StrSlice (libcore) and UnicodeStrSlice (libunicode) - functionality formerly in StrSlice that relied upon Unicode functionality from Char is now in UnicodeStrSlice - words, is_whitespace, is_alphanumeric, trim, trim_left, trim_right - also moved Words type alias into libunicode because words method is in UnicodeStrSlice - unified Unicode tables from libcollections, libcore, and libregex into libunicode - updated unicode.py in src/etc to generate aforementioned tables - generated new tables based on latest Unicode data - added UnicodeChar and UnicodeStrSlice traits to prelude - libunicode is now the collection point for the std::char module, combining the libunicode functionality with the Char functionality from libcore - thus, moved doc comment for char from core::char to unicode::char - libcollections remains the collection point for std::str The Unicode-aware functions that previously lived in the Char and StrSlice traits are no longer available to programs that only use libcore. To regain use of these methods, include the libunicode crate and use the UnicodeChar and/or UnicodeStrSlice traits: extern crate unicode; use unicode::UnicodeChar; use unicode::UnicodeStrSlice; use unicode::Words; // if you want to use the words() method NOTE: this does *not* impact programs that use libstd, since UnicodeChar and UnicodeStrSlice have been added to the prelude. closes #15224 [breaking-change]
2014-07-07librustc (RFC #34): Implement the new `Index` and `IndexMut` traits.Patrick Walton-5/+40
This will break code that used the old `Index` trait. Change this code to use the new `Index` traits. For reference, here are their signatures: pub trait Index<Index,Result> { fn index<'a>(&'a self, index: &Index) -> &'a Result; } pub trait IndexMut<Index,Result> { fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result; } Closes #6515. [breaking-change]
2014-07-06Register snapshot.Luqman Aden-15/+0
2014-07-05Add #[crate_name] attributes as necessaryAlex Crichton-0/+2
2014-07-05libcore: Fix Items iterator for zero sized types.Luqman Aden-12/+24
2014-07-04Fixed Result type parameters in doc comment.Zbigniew Siciarz-1/+1
2014-07-04Change Shl<T, T> for Int to Shl<uint, T>Samuel Neves-13/+13
2014-07-04auto merge of #15321 : huonw/rust/nil-prim, r=alexcrichtonbors-0/+50
This adds a primitive page for () like http://doc.rust-lang.org/master/std/uint/primitive.uint.html . I would prefer the modules to be `std::tuple::unit`, but rustdoc only searches at the top level (filed as #15320).
2014-07-04auto merge of #15343 : alexcrichton/rust/0.11.0-release, r=brsonbors-2/+2
2014-07-04core: add a primitive page for `()`.Huon Wilson-0/+50
2014-07-03auto merge of #15324 : sneves/rust/master, r=alexcrichtonbors-2/+2
The current implementation of `rotate_left` and `rotate_right` are incorrect when the rotation amount is 0, or a multiple of the input's bitsize. When `n = 0`, the expression (self >> n) | (self << ($BITS - n)) results in a shift left by `$BITS` bits, which is undefined behavior (see https://github.com/rust-lang/rust/issues/10183), and currently results in a hardcoded `-1` value, instead of the original input value. Reducing `($BITS - n)` modulo `$BITS`, simplified to `(-n % $BITS)`, fixes this problem.
2014-07-02Fix rotate_{left, right} for multiple of bitsize rotation amountsSamuel Neves-2/+2
Add additional rotation tests
2014-07-02Merge remote-tracking branch 'origin/master' into 0.11.0-releaseAlex Crichton-3955/+885
Conflicts: src/libstd/lib.rs
2014-07-01rustc: Remove `&str` indexing from the language.Brian Anderson-14/+16
Being able to index into the bytes of a string encourages poor UTF-8 hygiene. To get a view of `&[u8]` from either a `String` or `&str` slice, use the `as_bytes()` method. Closes #12710. [breaking-change]
2014-07-01auto merge of #15288 : brson/rust/cleanslice, r=alexcrichtonbors-459/+505
This does two things: * Reorganizes the declaration order to be more readable, less random. * Removes the `slice::traits` module, a public module that does nothing but declare impls of `cmp` traits.
2014-07-01auto merge of #15281 : alexcrichton/rust/show-for-show, r=kballardbors-0/+3
This makes printing a `Show` trait object much easier.
2014-06-30core: Remove the unnecessary 'traits' module from 'slice'Brian Anderson-49/+39
This is only breaking for code that references the empty `slice::traits` module. [breaking-change]
2014-06-30core: Reorganize slice module.Brian Anderson-458/+514
This is just moving things around so they are defined in a logical order.
2014-06-30Add `impl Show for &Show`Alex Crichton-0/+3
This makes printing a `Show` trait object much easier.
2014-06-30auto merge of #14613 : schmee/rust/utf16-iterator, r=huonwbors-1/+45
Closes #14358. ~~The tests are not yet moved to `utf16_iter`, so this probably won't compile. I'm submitting this PR anyway so it can be reviewed and since it was mentioned in #14611.~~ EDIT: Tests now use `utf16_iter`. This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_iter().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_iter()` directly, if it can be used in an iterator context. [breaking-change] cc @huonw
2014-06-30Add `utf16_units`John Schmidt-1/+45
This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_units().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_units()` directly, if it can be used in an iterator context. Closes #14358 [breaking-change]
2014-06-30auto merge of #15030 : sfackler/rust/partial-cmp, r=huonwbors-13/+155
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. # Note This isn't ready to merge yet since libcore tests are broken as you end up with 2 versions of `Option`. The rest should be reviewable though. RFC: 0028-partial-cmp
2014-06-29Implement RFC#28: Add PartialOrd::partial_cmpSteven Fackler-13/+155
I ended up altering the semantics of Json's PartialOrd implementation. It used to be the case that Null < Null, but I can't think of any reason for an ordering other than the default one so I just switched it over to using the derived implementation. This also fixes broken `PartialOrd` implementations for `Vec` and `TreeMap`. RFC: 0028-partial-cmp
2014-06-30auto merge of #15256 : erickt/rust/optimizations, r=alexcrichtonbors-20/+44
The bug #11084 causes `option::collect` and `result::collect` about twice as slower as it should because llvm is having some trouble optimizing away the scan closure. This gets rid of it so now those functions perform equivalent to a hand written version. This also adds an impl of `Default` for `Rc` along the way.
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-3337/+13
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
2014-06-29core: optimize {option,result}::collectErick Tryzelaar-20/+44
The bug #11084 causes these collect functions to run about twice as slow as they should because llvm is having trouble optimizing away the closure for some reason. This patch works around that performance bug by using a simple adapter iterator explicitly for capturing if the outer iterator returns an error.
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-30/+30
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-29c_str: replace .with_ref with .as_ptr throughout the codebase.Huon Wilson-12/+8
2014-06-28auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwaltonbors-131/+126
This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
2014-06-28Rename all raw pointers as necessaryAlex Crichton-118/+126
2014-06-28librustc: Match trait self types exactly.Patrick Walton-6/+8
This can break code that looked like: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any + Send> = ...; x.f(); Change such code to: impl Foo for Box<Any> { fn f(&self) { ... } } let x: Box<Any> = ...; x.f(); That is, upcast before calling methods. This is a conservative solution to #5781. A more proper treatment (see the xfail'd `trait-contravariant-self.rs`) would take variance into account. This change fixes the soundness hole. Some library changes had to be made to make this work. In particular, `Box<Any>` is no longer showable, and only `Box<Any+Send>` is showable. Eventually, this restriction can be lifted; for now, it does not prove too onerous, because `Any` is only used for propagating the result of task failure. This patch also adds a test for the variance inference work in #12828, which accidentally landed as part of DST. Closes #5781. [breaking-change]
2014-06-27Update to 0.11.0 0.11.0Alex Crichton-2/+2
2014-06-25Register new snapshotsAlex Crichton-13/+0
This change starts denying `*T` in the parser. All code using `*T` should ensure that the FFI call does indeed take `const T*` on the other side before renaming the type to `*const T`. Otherwise, all code can rename `*T` to `*const T`. [breaking-change]
2014-06-24librustc: Remove cross borrowing from mutable `Box`es to `&mut`.Patrick Walton-1/+1
This will break code like: fn f(x: &mut int) {} let mut a = box 1i; f(a); Change it to: fn f(x: &mut int) {} let mut a = box 1i; f(&mut *a); RFC 33; issue #10504. [breaking-change]
2014-06-25auto merge of #15160 : alexcrichton/rust/remove-f128, r=brsonbors-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-24std: Add stability attributes to primitive numeric modulesBrian Anderson-0/+18
The following are unstable: - core::int, i8, i16, i32, i64 - core::uint, u8, u16, u32, u64 - core::int::{BITS, BYTES, MIN, MAX}, etc. - std::int, i8, i16, i32, i64 - std::uint, u8, u16, u32, u64 The following are experimental: - std::from_str::FromStr and impls - may need to return Result instead of Option - std::int::parse_bytes, etc. - ditto - std::num::FromStrRadix and impls - ditto - std::num::from_str_radix - ditto The following are deprecated: - std::num::ToStrRadix and imples - Wrapper around fmt::radix. Wrong name (Str vs String) See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#uint
2014-06-24Move core::bool tests to run-passBrian Anderson-99/+0
These are closer to language tests than library.
2014-06-24core: Remove bool::to_bitBrian Anderson-24/+1
This is an unused one-liner.
2014-06-24core: Add stability attributes to CloneBrian Anderson-0/+7
The following are tagged 'unstable' - core::clone - Clone - Clone::clone - impl Clone for Arc - impl Clone for arc::Weak - impl Clone for Rc - impl Clone for rc::Weak - impl Clone for Vec - impl Clone for Cell - impl Clone for RefCell - impl Clone for small tuples The following are tagged 'experimental' - Clone::clone_from - may not provide enough utility - impls for various extern "Rust" fns - may not handle lifetimes correctly See https://github.com/rust-lang/rust/wiki/Meeting-API-review-2014-06-23#clone
2014-06-24librustc: Remove the fallback to `int` from typechecking.Niko Matsakis-216/+233
This breaks a fair amount of code. The typical patterns are: * `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`; * `println!("{}", 3)`: change to `println!("{}", 3i)`; * `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`. RFC #30. Closes #6023. [breaking-change]
2014-06-24Remove the quad_precision_float feature gateAlex Crichton-1/+0
The f128 type has very little support in the compiler and the feature is basically unusable today. Supporting half-baked features in the compiler can be detrimental to the long-term development of the compiler, and hence this feature is being removed.
2014-06-24auto merge of #14963 : w3ln4/rust/master, r=alexcrichtonbors-0/+2
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
2014-06-24Added Mipsel architecture supportPawel Olzacki-0/+2
2014-06-23librustc: Feature gate lang items and intrinsics.Patrick Walton-1/+3
If you define lang items in your crate, add `#[feature(lang_items)]`. If you define intrinsics (`extern "rust-intrinsic"`), add `#[feature(intrinsics)]`. Closes #12858. [breaking-change]
2014-06-22Register new snapshotsAlex Crichton-1/+0