about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2014-10-02Test fixes from the rollupAlex Crichton-0/+1
2014-10-02rollup merge of #17666 : eddyb/take-garbage-outAlex Crichton-39/+0
Conflicts: src/libcollections/lib.rs src/libcore/lib.rs src/librustdoc/lib.rs src/librustrt/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/test/run-pass/issue-8898.rs
2014-10-02alloc: fix reallocate_inplace implementationDaniel Micay-9/+26
The returned size is the new real size of the allocation.
2014-10-02tests: remove uses of Gc.Eduard Burtescu-8/+0
2014-10-02core: remove raw::GcBox.Eduard Burtescu-31/+0
2014-09-30Fix liballocSteven Fackler-8/+8
2014-09-29rollup merge of #17582 : kmcallister/gc-boxAlex Crichton-1/+1
2014-09-26Rename raw::Box to raw::GcBoxKeegan McAllister-1/+1
Fixes #17470.
2014-09-26librustc: Eliminate the `ref` syntax for unboxed closure capture clausesPatrick Walton-6/+0
in favor of `move`. This breaks code that used `move` as an identifier, because it is now a keyword. Change such identifiers to not use the keyword `move`. Additionally, this breaks code that was counting on by-value or by-reference capture semantics for unboxed closures (behind the feature gate). Change `ref |:|` to `|:|` and `|:|` to `move |:|`. Part of RFC #63; part of issue #12831. [breaking-change]
2014-09-22Update calls of deprecated functions in macros.Victor Berger-3/+3
Fallout of #17185.
2014-09-16Register new snapshotsAlex Crichton-29/+0
This is the first linux snapshot created on our new CentOS 5.10 builders. Closes #9545
2014-09-16Fallout from renamingAaron Turon-5/+5
2014-09-16auto merge of #17197 : nikomatsakis/rust/issue-5527-trait-reform-revisited, ↵bors-1/+0
r=pcwalton This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way. Major changes: - Do not track impls through trans, instead recompute as needed. - Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment) - Consider where clauses in their more general form - Integrate checking of builtin bounds into the trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds) What is not included: - Where clauses are still not generalized. This should be a straightforward follow-up patch. - Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are. - Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today. - Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref. - Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.
2014-09-15remove the closure_exchange_malloc lang itemDaniel Micay-17/+1
2014-09-15heap: optimize EMPTY to avoid relocationsDaniel Micay-5/+6
Sized deallocation makes it pointless to provide an address that never overlaps with pointers returned by an allocator. Code can branch on the capacity of the allocation instead of a comparison with this sentinel. This improves the situation in #8859, and the remaining issues are only from the logging API, which should be disabled by default in optimized release builds anyway along with debug assertions. The remaining issues are part of #17081. Closes #8859
2014-09-15heap: rm out-of-date FIXMEsDaniel Micay-2/+0
2014-09-15silence various warnings in stdlib, no idea why they suddenly startedNiko Matsakis-1/+0
2014-09-11auto merge of #17110 : thestinger/rust/dst, r=cmrbors-6/+0
The pointer in the slice must not be null, because enum representations make that assumption. The `exchange_malloc` function returns a non-null sentinel for the zero size case, and it must not be passed to the `exchange_free` lang item. Since the length is always equal to the true capacity, a branch on the length is enough for most types. Slices of zero size types are statically special cased to never attempt deallocation. This is the same implementation as `Vec<T>`. Closes #14395
2014-09-10implement sized deallocationDaniel Micay-0/+11
Closes #13994
2014-09-10micro-optimize dynamic allocation alignmentDaniel Micay-34/+64
Previously, some parts of this optimization were impossible because the alignment passed to the free function was not correct. That was fully fixed by #17012. Closes #17092
2014-09-09fixes for Box<[T]>Daniel Micay-6/+0
The pointer in the slice must not be null, because enum representations make that assumption. The `exchange_malloc` function returns a non-null sentinel for the zero size case, and it must not be passed to the `exchange_free` lang item. Since the length is always equal to the true capacity, a branch on the length is enough for most types. Slices of zero size types are statically special cased to never attempt deallocation. This is the same implementation as `Vec<T>`. Closes #14395
2014-09-06fix sized deallocation for procDaniel Micay-2/+17
2014-08-28Fixed misleading docs in liballocClark Gaebel-1/+1
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-3/+3
2014-08-26DST coercions and DST structsNick Cameron-0/+6
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-23Copy only up to `min(new_size, old_size)` when doing reallocate.Felix S. Klock II-1/+2
Fix #16687
2014-08-19A few minor documentation fixesP1start-178/+180
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-1/+1
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-07Rename `Share` to `Sync`Alex Crichton-18/+18
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
2014-08-06auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichtonbors-28/+28
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-04stabilize atomics (now atomic)Aaron Turon-28/+28
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-04rustc: Link entire archives of native librariesAlex Crichton-0/+3
As discovered in #15460, a particular #[link(kind = "static", ...)] line is not actually guaranteed to link the library at all. The reason for this is that if the external library doesn't have any referenced symbols in the object generated by rustc, the entire library is dropped by the linker. For dynamic native libraries, this is solved by passing -lfoo for all downstream compilations unconditionally. For static libraries in rlibs this is solved because the entire archive is bundled in the rlib. The only situation in which this was a problem was when a static native library was linked to a rust dynamic library. This commit brings the behavior of dylibs in line with rlibs by passing the --whole-archive flag to the linker when linking native libraries. On OSX, this uses the -force_load flag. This flag ensures that the entire archive is considered candidate for being linked into the final dynamic library. This is a breaking change because if any static library is included twice in the same compilation unit then the linker will start emitting errors about duplicate definitions now. The fix for this would involve only statically linking to a library once. Closes #15460 [breaking-change]
2014-08-01Add is_unique(), try_unwrap(), get_mut() to alloc::rcKevin Ballard-9/+116
Add a few new free functions to alloc::rc for manipulating uniquely-owned Rc values. is_unique() can be used to test if the Rc is uniquely-owned, try_unwrap() can remove the value from a uniquely-owned Rc, and get_mut() can return a &mut for a uniquely-owned Rc. These are all free functions, because smart pointers should avoid having methods when possible. They can't be static methods because UFCS will remove that distinction. I think we should probably change downgrade() and make_unique() into free functions as well, but that's out of scope.
2014-07-31alloc, arena, test, url, uuid: Elide lifetimes.OGINO Masanori-5/+5
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-29Elide lifetimes around Arc<T>.OGINO Masanori-4/+4
It's a small step forward in application of RFC 39 to the code base itself. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-26std: Stabilize unit, bool, ty, tuple, arc, anyAlex Crichton-8/+18
This commit applies stability attributes to the contents of these modules, summarized here: * The `unit` and `bool` modules have become #[unstable] as they are purely meant for documentation purposes and are candidates for removal. * The `ty` module has been deprecated, and the inner `Unsafe` type has been renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field has been removed as the compiler now always infers `UnsafeCell` to be invariant. The `new` method i stable, but the `value` field, `get` and `unwrap` methods are all unstable. * The `tuple` module has its name as stable, the naming of the `TupleN` traits as stable while the methods are all #[unstable]. The other impls in the module have appropriate stability for the corresponding trait. * The `arc` module has received the exact same treatment as the `rc` module previously did. * The `any` module has its name as stable. The `Any` trait is also stable, with a new private supertrait which now contains the `get_type_id` method. This is to make the method a private implementation detail rather than a public-facing detail. The two extension traits in the module are marked #[unstable] as they will not be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods have been renamed to downcast_{mut,ref} and are #[unstable]. The extension trait `BoxAny` has been clarified as to why it is unstable as it will not be necessary with DST. This is a breaking change because the `marker1` field was removed from the `UnsafeCell` type. To deal with this change, you can simply delete the field and only specify the value of the `data` field in static initializers. [breaking-change]
2014-07-23collections: Move push/pop to MutableSeqBrian Anderson-0/+1
Implement for Vec, DList, RingBuf. Add MutableSeq to the prelude. Since the collections traits are in the prelude most consumers of these methods will continue to work without change. [breaking-change]
2014-07-18alloc: Stabilize rc module.Brian Anderson-1/+18
Weak pointers experimental. Most everything else stable.
2014-07-17librustc: Remove cross-borrowing of `Box<T>` to `&T` from the language,Patrick Walton-2/+4
except where trait objects are involved. Part of issue #15349, though I'm leaving it open for trait objects. Cross borrowing for trait objects remains because it is needed until we have DST. This will break code like: fn foo(x: &int) { ... } let a = box 3i; foo(a); Change this code to: fn foo(x: &int) { ... } let a = box 3i; foo(&*a); [breaking-change]
2014-07-13Stabilization for `owned` (now `boxed`) and `cell`Aaron Turon-44/+29
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
2014-07-09Register new snapshotsAlex Crichton-2/+0
Closes #15544
2014-07-05Add #[crate_name] attributes as necessaryAlex Crichton-1/+3
2014-07-04auto merge of #15343 : alexcrichton/rust/0.11.0-release, r=brsonbors-1/+1
2014-07-03Fix spelling errors.Joseph Crail-1/+1
2014-07-02Merge remote-tracking branch 'origin/master' into 0.11.0-releaseAlex Crichton-19/+239
Conflicts: src/libstd/lib.rs
2014-07-01Improve rustdocs for Rc, add examplesAlisdair Owens-9/+134
2014-06-30auto merge of #15030 : sfackler/rust/partial-cmp, r=huonwbors-0/+10
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-0/+10
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-0/+8
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-0/+48
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.