Commit Graph

206 Commits

Author SHA1 Message Date
Alex Crichton
dae48a07f3 Register new snapshots
Also convert a number of `static mut` to just a plain old `static` and remove
some unsafe blocks.
2014-10-10 22:09:49 -07:00
bors
45797a0765 auto merge of #17037 : kmcallister/rust/no-stack-check, r=thestinger
r? @brson 

Fixes #16980.
2014-10-10 07:52:00 +00:00
bors
f9fc49c06e auto merge of #17853 : alexcrichton/rust/issue-17718, r=pcwalton
This change is an implementation of [RFC 69][rfc] which adds a third kind of
global to the language, `const`. This global is most similar to what the old
`static` was, and if you're unsure about what to use then you should use a
`const`.

The semantics of these three kinds of globals are:

* A `const` does not represent a memory location, but only a value. Constants
  are translated as rvalues, which means that their values are directly inlined
  at usage location (similar to a #define in C/C++). Constant values are, well,
  constant, and can not be modified. Any "modification" is actually a
  modification to a local value on the stack rather than the actual constant
  itself.

  Almost all values are allowed inside constants, whether they have interior
  mutability or not. There are a few minor restrictions listed in the RFC, but
  they should in general not come up too often.

* A `static` now always represents a memory location (unconditionally). Any
  references to the same `static` are actually a reference to the same memory
  location. Only values whose types ascribe to `Sync` are allowed in a `static`.
  This restriction is in place because many threads may access a `static`
  concurrently. Lifting this restriction (and allowing unsafe access) is a
  future extension not implemented at this time.

* A `static mut` continues to always represent a memory location. All references
  to a `static mut` continue to be `unsafe`.

This is a large breaking change, and many programs will need to be updated
accordingly. A summary of the breaking changes is:

* Statics may no longer be used in patterns. Statics now always represent a
  memory location, which can sometimes be modified. To fix code, repurpose the
  matched-on-`static` to a `const`.

      static FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

  change this code to:

      const FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

* Statics may no longer refer to other statics by value. Due to statics being
  able to change at runtime, allowing them to reference one another could
  possibly lead to confusing semantics. If you are in this situation, use a
  constant initializer instead. Note, however, that statics may reference other
  statics by address, however.

* Statics may no longer be used in constant expressions, such as array lengths.
  This is due to the same restrictions as listed above. Use a `const` instead.

[breaking-change]
Closes #17718 

[rfc]: https://github.com/rust-lang/rfcs/pull/246
2014-10-10 00:07:08 +00:00
Alex Crichton
0b517117b3 Test fixes and rebase conflicts 2014-10-09 16:36:07 -07:00
Keegan McAllister
db3bd23467 Rename the no_split_stack attribute to no_stack_check
The old name is misleading as we haven't had segmented stacks in quite some
time. But we still recognize it, with a deprecation warning.
2014-10-09 14:24:36 -07:00
Brian Anderson
5c92a8e054 Use the same html_root_url for all docs 2014-10-09 10:50:13 -07:00
Brian Anderson
6beddcfd83 Revert "Update html_root_url for 0.12.0 release"
This reverts commit 2288f33230.
2014-10-09 10:34:34 -07:00
Alex Crichton
b8fb0cf789 rustrt: Convert statics to constants 2014-10-09 09:44:51 -07:00
Brian Anderson
2288f33230 Update html_root_url for 0.12.0 release 2014-10-07 11:18:50 -07:00
Nick Cameron
2d3823441f Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-07 15:49:53 +13:00
Nick Cameron
59976942ea Use slice syntax instead of slice_to, etc. 2014-10-07 15:49:53 +13:00
P1start
94bcd3539c Set the non_uppercase_statics lint to warn by default 2014-10-03 20:39:56 +13:00
Alex Crichton
7ae802f57b rollup merge of #17666 : eddyb/take-garbage-out
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-02 14:53:18 -07:00
Aaron Turon
d2ea0315e0 Revert "Use slice syntax instead of slice_to, etc."
This reverts commit 40b9f5ded5.
2014-10-02 11:48:07 -07:00
Aaron Turon
7bf56df4c8 Revert "Put slicing syntax behind a feature gate."
This reverts commit 95cfc35607.
2014-10-02 11:47:51 -07:00
Eduard Burtescu
58bea31ca0 tests: remove uses of Gc. 2014-10-02 17:02:15 +03:00
Eduard Burtescu
db55e70c97 syntax: mark the managed_boxes feature as Removed. 2014-10-02 17:02:03 +03:00
Eduard Burtescu
2487e164ae rustrt: remove local_heap implementation. 2014-10-02 16:36:01 +03:00
Nick Cameron
95cfc35607 Put slicing syntax behind a feature gate.
[breaking-change]

If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02 13:23:36 +13:00
Nick Cameron
40b9f5ded5 Use slice syntax instead of slice_to, etc. 2014-10-02 13:19:45 +13:00
Steven Fackler
ad83352618 Fix librustrt 2014-09-30 12:52:46 -07:00
bors
d2f8d4c505 auto merge of #17563 : brson/rust/wintcbfix, r=thestinger
This is the bare minimum to stop using split stacks on Windows, fixing https://github.com/rust-lang/rust/issues/13259 and #14742, by turning on stack probes for all functions and disabling compiler and runtime support for split stacks on Windows.

It does not restore the out-of-stack error message, which requires more runtime work.

This includes a test that the Windows TCB is no longer being clobbered, but the out-of-stack test itself is pretty weak, only testing that the program exits abnormally, not that it isn't writing to bogus memory, so I haven't truly verified that this is providing the safety we claim.

A more complete solution is in https://github.com/rust-lang/rust/pull/16388, which has some unresolved issues yet.

cc @Zoxc @klutzy @vadimcn
2014-09-30 06:47:25 +00:00
Alex Crichton
1ae44c2059 rollup merge of #17621 : sfackler/new-snap 2014-09-29 08:17:18 -07:00
Alex Crichton
e44393a953 rollup merge of #17582 : kmcallister/gc-box 2014-09-29 08:14:12 -07:00
Steven Fackler
fa419d3d21 Register new snapshots 2014-09-28 19:28:48 -07:00
Keegan McAllister
f8a180b36e Rename raw::Box to raw::GcBox
Fixes #17470.
2014-09-26 19:54:27 -07:00
Mateusz Czapliński
8a561266b1 tiny linguistic correction in docs: s/its'/its/
See e.g.: http://dictionary.reference.com/browse/its
2014-09-26 19:51:33 +02:00
Brian Anderson
a52eaaa996 Disable runtime split stack support on Windows 2014-09-26 10:17:01 -07:00
Florian Hahn
1c7d253ca3 Rename fail_ lang item to fail, closes #16114 2014-09-25 01:09:09 +02:00
Florian Hahn
9a01da9460 Rename begin_unwind lang item to fail_fmt, refs #16114 2014-09-24 23:44:00 +02:00
bors
8cad720879 auto merge of #17471 : vadimcn/rust/link-libgcc, r=alexcrichton
Closes #17271
Closes #15420
2014-09-24 11:25:48 +00:00
Patrick Walton
e9ad12c0ca librustc: Forbid private types in public APIs.
This breaks code like:

    struct Foo {
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

Change this code to:

    pub struct Foo {    // note `pub`
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API. In its place
a `#[feature(visible_private_types)]` gate has been added.

Closes #16463.

RFC #48.

[breaking-change]
2014-09-22 20:05:45 -07:00
Vadim Chugunov
a46865981e Link libgcc statically on Win64.
Allow linking it statically on Win32 with an override.
2014-09-22 16:33:18 -07:00
Victor Berger
52ea83dddc Update calls of deprecated functions in macros.
Fallout of #17185.
2014-09-22 19:30:06 +02:00
Alex Crichton
0169218047 Fix fallout from Vec stabilization 2014-09-21 22:15:51 -07:00
Alex Crichton
a116c7272b rollup merge of #17355 : gamazeps/issue17210 2014-09-19 10:00:35 -07:00
Nick Cameron
ce0907e46e Add enum variants to the type namespace
Change to resolve and update compiler and libs for uses.

[breaking-change]

Enum variants are now in both the value and type namespaces. This means that
if you have a variant with the same name as a type in scope in a module, you
will get a name clash and thus an error. The solution is to either rename the
type or the variant.
2014-09-19 15:11:00 +12:00
gamazeps
50d179d001 Doc says to avoid mixing allocator instead of forbiding it 2014-09-18 14:16:26 +02:00
gamazeps
6a37692ecb Document that CStrings live in the libc heap
Closes issue #17067 and improves pr #17355
2014-09-18 12:13:30 +02:00
Felix Raimundo
9ce2c51c46 Document that CStrings live in the libc heap
Insists on the fact that the memory is managed by malloc
and not jemalloc
Closes #17067
2014-09-18 00:35:26 +02:00
Aaron Turon
fc525eeb4e Fallout from renaming 2014-09-16 14:37:48 -07:00
Jonas Hietala
947a1b923b Remove some test warnings. 2014-09-09 11:32:58 +02:00
bors
d3e7922ddd auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, r=alexcrichton
I corrected spelling and capitalization errors in comments and strings.
2014-09-04 18:30:59 +00:00
bors
bef51ba234 auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichton
Changed occurances of:
extern crate foo = "bar";
to:
extern crate "bar" as foo;

Added warning for old deprecated syntax
2014-09-04 16:40:59 +00:00
Joseph Crail
b7bfe04b2d Fix spelling errors and capitalization. 2014-09-03 23:10:38 -04:00
bors
3ce5a026b0 auto merge of #16940 : treeman/rust/fail-non-utf8, r=pnkfelix
Closes #16877.
2014-09-03 09:21:02 +00:00
Nick Cameron
7f72884f13 Remove cross-borrowing for traits.
Closes #15349

[breaking-change]

Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-09-03 08:32:35 +12:00
Jonas Hietala
968b1280e3 Prevent failure when using fail! with invalid utf8.
Closes #16877.
2014-09-02 15:59:28 +02:00
wickerwaka
2cb210d2c6 Updated to new extern crate syntax.
Added warning for old deprecated syntax
2014-09-01 09:02:00 -07:00
bors
b42e079c6f auto merge of #16871 : retep998/rust/win64-fix, r=alexcrichton
It was in a x86_64 block so the buildbots didn't notice it.
Fixes #16905
2014-09-01 13:06:09 +00:00
bors
f297366593 auto merge of #16859 : alexcrichton/rust/snapshots, r=huonw 2014-08-30 19:51:25 +00:00
Peter Atashian
0061b36a77 Fix win64 regression introduced by #15773
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-30 02:02:21 -04:00
Alex Crichton
d15d559739 Register new snapshots 2014-08-29 14:33:08 -07:00
P1start
ed2aad8b43 Add lint groups; define built-in lint groups bad_style and unused
This adds support for lint groups to the compiler. Lint groups are a way of
grouping a number of lints together under one name. For example, this also
defines a default lint for naming conventions, named `bad_style`. Writing
`#[allow(bad_style)]` is equivalent to writing
`#[allow(non_camel_case_types, non_snake_case, non_uppercase_statics)]`. These
lint groups can also be defined as a compiler plugin using the new
`Registry::register_lint_group` method.

This also adds two built-in lint groups, `bad_style` and `unused`. The contents
of these groups can be seen by running `rustc -W help`.
2014-08-30 09:12:04 +12:00
P1start
de7abd8824 Unify non-snake-case lints and non-uppercase statics lints
This unifies the `non_snake_case_functions` and `uppercase_variables` lints
into one lint, `non_snake_case`. It also now checks for non-snake-case modules.
This also extends the non-camel-case types lint to check type parameters, and
merges the `non_uppercase_pattern_statics` lint into the
`non_uppercase_statics` lint.

Because the `uppercase_variables` lint is now part of the `non_snake_case`
lint, all non-snake-case variables that start with lowercase characters (such
as `fooBar`) will now trigger the `non_snake_case` lint.

New code should be updated to use the new `non_snake_case` lint instead of the
previous `non_snake_case_functions` and `uppercase_variables` lints. All use of
the `non_uppercase_pattern_statics` should be replaced with the
`non_uppercase_statics` lint. Any code that previously contained non-snake-case
module or variable names should be updated to use snake case names or disable
the `non_snake_case` lint. Any code with non-camel-case type parameters should
be changed to use camel case or disable the `non_camel_case_types` lint.

[breaking-change]
2014-08-30 09:10:05 +12:00
bors
2e92c67dc0 auto merge of #16664 : aturon/rust/stabilize-option-result, r=alexcrichton
Per API meeting

  https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-13.md

# Changes to `core::option`

Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues.

However, a few methods have been deprecated, either due to lack of use or redundancy:

* `take_unwrap`, `get_ref` and `get_mut_ref` (redundant, and we prefer for this functionality to go through an explicit .unwrap)
* `filtered` and `while`
* `mutate` and `mutate_or_set`
* `collect`: this functionality is being moved to a new `FromIterator` impl.

# Changes to `core::result`

Most of the module is marked as stable or unstable; most of the unstable items are awaiting resolution of conventions issues.

* `collect`: this functionality is being moved to a new `FromIterator` impl.
* `fold_` is deprecated due to lack of use
* Several methods found in `core::option` are added here, including `iter`, `as_slice`, and variants.

Due to deprecations, this is a:

[breaking-change]
2014-08-28 23:56:20 +00:00
Aaron Turon
276b8b125d Fallout from stabilizing core::option 2014-08-28 09:12:54 -07:00
Niko Matsakis
1b487a8906 Implement generalized object and type parameter bounds (Fixes #16462) 2014-08-27 21:46:52 -04:00
Alex Crichton
110168de2a native: Implement clone/close_accept for unix
This commits implements {Tcp,Unix}Acceptor::{clone,close_accept} methods for
unix. A windows implementation is coming in a later commit.

The clone implementation is based on atomic reference counting (as with all
other clones), and the close_accept implementation is based on selecting on a
self-pipe which signals that a close has been seen.
2014-08-24 17:08:14 -07:00
Vadim Chugunov
8c994a1237 Remove stage0 attributes. 2014-08-23 02:11:07 -07:00
bors
19a44c73c2 auto merge of #16647 : vhbit/rust/ios-build-fixes, r=alexcrichton 2014-08-22 09:05:53 +00:00
Valerii Hiora
69fbef1d87 Fixed unwinding for iOS
Was broken by Windows adoption
2014-08-21 11:12:57 +03:00
Corey Richardson
6e8ff99958 librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct
layout is now down with #[repr(C)]. For consistency, specifying a packed
layout is now also down with #[repr(packed)]. Both can be specified.

To fix errors caused by this, just add #[repr(C)] to the structs, and change
 #[packed] to #[repr(packed)]

Closes #14309

[breaking-change]
2014-08-20 21:02:23 -04:00
Patrick Walton
67deb2e65e libsyntax: Remove the use foo = bar syntax from the language in favor
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-18 09:19:10 -07:00
Patrick Walton
7f928d150e librustc: Forbid external crates, imports, and/or items from being
declared with the same name in the same scope.

This breaks several common patterns. First are unused imports:

    use foo::bar;
    use baz::bar;

Change this code to the following:

    use baz::bar;

Second, this patch breaks globs that import names that are shadowed by
subsequent imports. For example:

    use foo::*; // including `bar`
    use baz::bar;

Change this code to remove the glob:

    use foo::{boo, quux};
    use baz::bar;

Or qualify all uses of `bar`:

    use foo::{boo, quux};
    use baz;

    ... baz::bar ...

Finally, this patch breaks code that, at top level, explicitly imports
`std` and doesn't disable the prelude.

    extern crate std;

Because the prelude imports `std` implicitly, there is no need to
explicitly import it; just remove such directives.

The old behavior can be opted into via the `import_shadowing` feature
gate. Use of this feature gate is discouraged.

This implements RFC #116.

Closes #16464.

[breaking-change]
2014-08-16 19:32:25 -07:00
Vadim Chugunov
3dfd12967a Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")] 2014-08-12 00:13:43 -07:00
Niko Matsakis
4fd797e757 Register new snapshot 12e0f72 2014-08-08 07:55:00 -04:00
bors
aae7901a78 auto merge of #16285 : alexcrichton/rust/rename-share, r=huonw
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-08 03:51:15 +00:00
Alex Crichton
1f760d5d1a Rename Share to Sync
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-07 08:54:38 -07:00
Alex Crichton
720746a139 Merge commit '881bfb1a180a1b545daa9da1539ec4c8ebda7ed1' into rollup 2014-08-06 11:25:14 -07:00
bors
84782c4e26 auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichton
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-06 08:31:28 +00:00
Vadim Chugunov
881bfb1a18 Renamed record_stack_bounds for clarity.
For a good measure, implemented target_record_stack_bounds for 32-bit Windows as well.
2014-08-05 21:00:31 -07:00
Vadim Chugunov
cd2003ffd8 Added clarification regarding rust_try_inner. 2014-08-05 19:14:15 -07:00
Vadim Chugunov
5a24ee8a9e Implement unwinding for Win64.
The original trick used to trigger unwinds would not work with GCC's implementation of SEH, so I had to invent a new one: rust_try now consists of two routines: the outer one, whose handler triggers unwinds, and the inner one, that stops unwinds by having a landing pad that swallows exceptions and passes them on to the outer routine via a normal return.
2014-08-04 18:27:23 -07:00
Vadim Chugunov
bf76e00231 libnative should not mess with stack limits in the TIB. Only libgreen has a legitimate need to set them. 2014-08-04 17:43:47 -07:00
Aaron Turon
68bde0a073 stabilize atomics (now atomic)
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-04 16:03:21 -07:00
Alex Crichton
1ae1461fbf rustc: Link entire archives of native libraries
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-04 11:02:26 -07:00
bors
b495933a7f auto merge of #16141 : alexcrichton/rust/rollup, r=alexcrichton 2014-08-01 01:56:32 +00:00
bors
75a39e0fb8 auto merge of #15399 : kballard/rust/rewrite_local_data, r=alexcrichton
This was motivated by a desire to remove allocation in the common
pattern of

    let old = key.replace(None)
    do_something();
    key.replace(old);

This also switched the map representation from a Vec to a TreeMap. A Vec
may be reasonable if there's only a couple TLD keys, but a TreeMap
provides better behavior as the number of keys increases.

Like the Vec, this TreeMap implementation does not shrink the container
when a value is removed. Unlike Vec, this TreeMap implementation cannot
reuse an empty node for a different key. Therefore any key that has been
inserted into the TLD at least once will continue to take up space in
the Map until the task ends. The expectation is that the majority of
keys that are inserted into TLD will be expected to have a value for
most of the rest of the task's lifetime. If this assumption is wrong,
there are two reasonable ways to fix this that could be implemented in
the future:

1. Provide an API call to either remove a specific key from the TLD and
   destruct its node (e.g. `remove()`), or instead to explicitly clean
   up all currently-empty nodes in the map (e.g. `compact()`). This is
   simple, but requires the user to explicitly call it.
2. Keep track of the number of empty nodes in the map and when the map
   is mutated (via `replace()`), if the number of empty nodes passes
   some threshold, compact it automatically. Alternatively, whenever a
   new key is inserted that hasn't been used before, compact the map at
   that point.

---

Benchmarks:

I ran 3 benchmarks. tld_replace_none just replaces the tld key with None
repeatedly. tld_replace_some replaces it with Some repeatedly. And
tld_replace_none_some simulates the common behavior of replacing with
None, then replacing with the previous value again (which was a Some).

Old implementation:

    test tld_replace_none      ... bench:        20 ns/iter (+/- 0)
    test tld_replace_none_some ... bench:        77 ns/iter (+/- 4)
    test tld_replace_some      ... bench:        57 ns/iter (+/- 2)

New implementation:

    test tld_replace_none      ... bench:        11 ns/iter (+/- 0)
    test tld_replace_none_some ... bench:        23 ns/iter (+/- 0)
    test tld_replace_some      ... bench:        12 ns/iter (+/- 0)
2014-07-31 23:16:33 +00:00
Kevin Ballard
e65bcff7d5 Add some benchmarks for TLD 2014-07-31 13:14:06 -07:00
Kevin Ballard
4b74dc167c Rewrite the local_data implementation
This was motivated by a desire to remove allocation in the common
pattern of

    let old = key.replace(None)
    do_something();
    key.replace(old);

This also switched the map representation from a Vec to a TreeMap. A Vec
may be reasonable if there's only a couple TLD keys, but a TreeMap
provides better behavior as the number of keys increases.

Like the Vec, this TreeMap implementation does not shrink the container
when a value is removed. Unlike Vec, this TreeMap implementation cannot
reuse an empty node for a different key. Therefore any key that has been
inserted into the TLD at least once will continue to take up space in
the Map until the task ends. The expectation is that the majority of
keys that are inserted into TLD will be expected to have a value for
most of the rest of the task's lifetime. If this assumption is wrong,
there are two reasonable ways to fix this that could be implemented in
the future:

1. Provide an API call to either remove a specific key from the TLD and
   destruct its node (e.g. `remove()`), or instead to explicitly clean
   up all currently-empty nodes in the map (e.g. `compact()`). This is
   simple, but requires the user to explicitly call it.
2. Keep track of the number of empty nodes in the map and when the map
   is mutated (via `replace()`), if the number of empty nodes passes
   some threshold, compact it automatically. Alternatively, whenever a
   new key is inserted that hasn't been used before, compact the map at
   that point.

---

Benchmarks:

I ran 3 benchmarks. tld_replace_none just replaces the tld key with None
repeatedly. tld_replace_some replaces it with Some repeatedly. And
tld_replace_none_some simulates the common behavior of replacing with
None, then replacing with the previous value again (which was a Some).

Old implementation:

    test tld_replace_none      ... bench:        20 ns/iter (+/- 0)
    test tld_replace_none_some ... bench:        77 ns/iter (+/- 4)
    test tld_replace_some      ... bench:        57 ns/iter (+/- 2)

New implementation:

    test tld_replace_none      ... bench:        11 ns/iter (+/- 0)
    test tld_replace_none_some ... bench:        23 ns/iter (+/- 0)
    test tld_replace_some      ... bench:        12 ns/iter (+/- 0)
2014-07-31 13:14:03 -07:00
Alex Crichton
ec79d368d2 Test fixes from the rollup
Closes #16097 (fix variable name in tutorial)
Closes #16100 (More defailbloating)
Closes #16104 (Fix deprecation commment on `core::cmp::lexical_ordering`)
Closes #16105 (fix formatting in pointer guide table)
Closes #16107 (remove serialize::ebml, add librbml)
Closes #16108 (Fix heading levels in pointer guide)
Closes #16109 (rustrt: Don't conditionally init the at_exit QUEUE)
Closes #16111 (hexfloat: Deprecate to move out of the repo)
Closes #16113 (Add examples for GenericPath methods.)
Closes #16115 (Byte literals!)
Closes #16116 (Add a non-regression test for issue #8372)
Closes #16120 (Deprecate semver)
Closes #16124 (Deprecate uuid)
Closes #16126 (Deprecate fourcc)
Closes #16127 (Remove incorrect example)
Closes #16129 (Add note about production deployments.)
Closes #16131 (librustc: Don't ICE when trying to subst regions in destructor call.)
Closes #16133 (librustc: Don't ICE with struct exprs where the name is not a valid struct.)
Closes #16136 (Implement slice::Vector for Option<T> and CVec<T>)
Closes #16137 (alloc, arena, test, url, uuid: Elide lifetimes.)
2014-07-31 13:05:12 -07:00
bors
9826e801be auto merge of #16073 : mneumann/rust/dragonfly2, r=alexcrichton
Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
2014-07-31 14:41:34 +00:00
Alex Crichton
ecac4d2e6c rustrt: Don't conditionally init the at_exit QUEUE
This initialization should happen unconditionally, but the rtassert! macro is
gated on the ENFORCE_SANITY define

Closes #16106
2014-07-31 07:30:53 -07:00
Brian Anderson
134946d06e rustrt: Make begin_unwind take a single file/line pointer
Smaller text size.
2014-07-31 07:30:17 -07:00
Kevin Ballard
3db5cf6f1d Update docs for TLS -> TLD
The correct terminology is Task-Local Data, or TLD. Task-Local Storage,
or TLS, is the old terminology that was abandoned because of the
confusion with Thread-Local Storage (TLS).
2014-07-30 10:36:45 -07:00
Alex Crichton
8643a0d613 green: Prevent runtime corruption on spawn failure
Like with libnative, when a green task failed to spawn it would leave the world
in a corrupt state where the local scheduler had been dropped as well as the
local task. Also like libnative, this patch sets up a "bomb" which when it goes
off will restore the state of the world.
2014-07-30 08:33:53 -07:00
Alex Crichton
355c798ac3 native: Don't deadlock the runtime on spawn failure
Previously, the call to bookkeeping::increment() was never paired with a
decrement when the spawn failed (due to unwinding). This fixes the problem by
returning a "bomb" from increment() which will decrement on drop, and then
moving the bomb into the child task's procedure which will be dropped naturally.
2014-07-30 07:06:44 -07:00
Alex Crichton
e156d001c6 rustrt: Allow dropping a brand-new Task
When a new task fails to spawn, it triggers a task failure of the spawning task.
This ends up causing runtime aborts today because of the destructor bomb in the
Task structure. The bomb doesn't actually need to go off until *after* the task
has run at least once.

This now prevents a runtime abort when a native thread fails to spawn.
2014-07-30 07:06:44 -07:00
Michael Neumann
2e2f53fad2 Port Rust to DragonFlyBSD
Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
2014-07-29 16:44:39 +02:00
bors
279a780804 auto merge of #15983 : brson/rust/fail, r=alexcrichton
A few refactorings to decrease text size and increase data size. I'm not sure about this tradeoff. Various stats below. cc @pcwalton

This reduces the code needed to pass arguments for `fail!()`, `fail!("{}", ...)`, and to a lesser extent `fail!("...")`. Still more work to be done on compiler-generated failures and the `fail!("...")` case.

do_fail_empty:

```
#[inline(never)]
fn do_fail_empty() {
    fail!()
}
```

do_fail_empty before:

```
	leaq	8(%rsp), %rdi
	movabsq	$13, %rsi
	leaq	"str\"str\"(1494)"(%rip), %rax
	movq	%rax, 8(%rsp)
	movq	$19, 16(%rsp)
	callq	_ZN6unwind31begin_unwind_no_time_to_explain20h57030457935ab6111SdE@PLT
```

do_fail_empty after:

```
	leaq	_ZN13do_fail_empty9file_line20h339df6a0541e837eIaaE(%rip), %rdi
	callq	_ZN6unwind31begin_unwind_no_time_to_explain20h33184cfdcce4dfd8QTdE@PLT
```

do_fail_fmt:

```
#[inline(never)]
fn do_fail_fmt() {
    fail!("guh{}", "faw")
}
```

do_fail_fmt before:

```
        ... (snip lots of fmt stuff)
	callq	_ZN3fmt22Arguments$LT$$x27a$GT$3new20he09b3a3f473879c41paE
	leaq	144(%rsp), %rsi
	movabsq	$23, %rdx
	leaq	"str\"str\"(1494)"(%rip), %rax
	leaq	32(%rsp), %rcx
	movq	%rcx, 160(%rsp)
	movq	160(%rsp), %rdi
	movq	%rax, 144(%rsp)
	movq	$19, 152(%rsp)
	callq	_ZN6unwind16begin_unwind_fmt20h3ebeb42f4d189b2buQdE@PLT
```

do_fail_fmt after:

```
        ... (snip lots of fmt stuff)
	callq	_ZN3fmt22Arguments$LT$$x27a$GT$3new20h42e5bb8d1711ee61OqaE
	leaq	_ZN11do_fail_fmt7run_fmt9file_line20h339df6a0541e837eFbaE(%rip), %rsi
	leaq	32(%rsp), %rax
	movq	%rax, 144(%rsp)
	movq	144(%rsp), %rdi
	callq	_ZN6unwind16begin_unwind_fmt20hfdcadc14d188656biRdE@PLT
```

File size increases.

file size before:

```
-rw-rw-r-- 1 brian brian 100501740 Jul 24 23:28 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21201780 Jul 24 23:27 /home/brian/dev/rust2/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

file size after:

```
-rw-rw-r-- 1 brian brian 101542484 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.rlib
-rwxrwxr-x 1 brian brian  21348862 Jul 25 00:34 x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

Text size decreases by 52486 while data size increases by 143686.

section size before:

```
   text    data     bss     dec     hex filename
12712262        5924997     368 18637627        11c633b x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

section size after:

```
   text    data     bss     dec     hex filename
12659776        6068683     368 18728827        11dc77b /home/brian/dev/rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so
```

I don't know if anything can be learned from these benchmarks. Looks like a wash.

std bench before:

```
test collections::hashmap::bench::find_existing             ... bench:     43452 ns/iter (+/- 2423)
test collections::hashmap::bench::find_nonexisting          ... bench:     42416 ns/iter (+/- 3996)
test collections::hashmap::bench::find_pop_insert           ... bench:       214 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       123 ns/iter (+/- 6)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 14)
test collections::hashmap::bench::new_drop                  ... bench:       547 ns/iter (+/- 259)
test collections::hashmap::bench::new_insert_drop           ... bench:       682 ns/iter (+/- 366)
test io::buffered::test::bench_buffered_reader              ... bench:      1046 ns/iter (+/- 86)
test io::buffered::test::bench_buffered_stream              ... bench:      2156 ns/iter (+/- 801)
test io::buffered::test::bench_buffered_writer              ... bench:      1057 ns/iter (+/- 75)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        80 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        80 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 4)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        69 ns/iter (+/- 3)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 4)
test io::mem::test::bench_buf_reader                        ... bench:       628 ns/iter (+/- 18)
test io::mem::test::bench_buf_writer                        ... bench:       478 ns/iter (+/- 19)
test io::mem::test::bench_mem_reader                        ... bench:       712 ns/iter (+/- 44)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 1)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        51 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       121 ns/iter (+/- 8)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       774 ns/iter (+/- 47)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       756 ns/iter (+/- 50)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2726 ns/iter (+/- 198)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8961 ns/iter (+/- 712)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105673 ns/iter (+/- 24711)
test num::bench::bench_pow_function                         ... bench:      5849 ns/iter (+/- 371)
test num::strconv::bench::f64::float_to_string              ... bench:       662 ns/iter (+/- 202)
test num::strconv::bench::int::to_str_base_36               ... bench:       424 ns/iter (+/- 7)
test num::strconv::bench::int::to_str_bin                   ... bench:      1227 ns/iter (+/- 80)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 13)
test num::strconv::bench::int::to_str_hex                   ... bench:       498 ns/iter (+/- 22)
test num::strconv::bench::int::to_str_oct                   ... bench:       502 ns/iter (+/- 229)
test num::strconv::bench::uint::to_str_base_36              ... bench:       375 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1011 ns/iter (+/- 590)
test num::strconv::bench::uint::to_str_dec                  ... bench:       407 ns/iter (+/- 17)
test num::strconv::bench::uint::to_str_hex                  ... bench:       442 ns/iter (+/- 7)
test num::strconv::bench::uint::to_str_oct                  ... bench:       433 ns/iter (+/- 46)
test path::posix::bench::ends_with_path_home_dir            ... bench:       167 ns/iter (+/- 10)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       148 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       221 ns/iter (+/- 31)
test path::posix::bench::join_abs_path_home_dir             ... bench:       144 ns/iter (+/- 23)
test path::posix::bench::join_home_dir                      ... bench:       196 ns/iter (+/- 9)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_many_home_dir                 ... bench:       195 ns/iter (+/- 8)
test path::posix::bench::path_relative_from_backward        ... bench:       248 ns/iter (+/- 10)
test path::posix::bench::path_relative_from_forward         ... bench:       241 ns/iter (+/- 13)
test path::posix::bench::path_relative_from_same_level      ... bench:       296 ns/iter (+/- 11)
test path::posix::bench::push_abs_path_home_dir             ... bench:       104 ns/iter (+/- 7)
test path::posix::bench::push_home_dir                      ... bench:     27311 ns/iter (+/- 2727)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       109 ns/iter (+/- 5)
test path::posix::bench::push_many_home_dir                 ... bench:     23263 ns/iter (+/- 1726)
test rand::bench::rand_isaac                                ... bench:       884 ns/iter (+/- 31) = 904 MB/s
test rand::bench::rand_isaac64                              ... bench:       440 ns/iter (+/- 126) = 1818 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2518 ns/iter (+/- 1371)
test rand::bench::rand_std                                  ... bench:       429 ns/iter (+/- 17) = 1864 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```

std bench after:

```
test collections::hashmap::bench::find_existing             ... bench:     43635 ns/iter (+/- 4508)
test collections::hashmap::bench::find_nonexisting          ... bench:     42323 ns/iter (+/- 1753)
test collections::hashmap::bench::find_pop_insert           ... bench:       216 ns/iter (+/- 11)
test collections::hashmap::bench::hashmap_as_queue          ... bench:       125 ns/iter (+/- 8)
test collections::hashmap::bench::insert                    ... bench:       153 ns/iter (+/- 63)
test collections::hashmap::bench::new_drop                  ... bench:       517 ns/iter (+/- 282)
test collections::hashmap::bench::new_insert_drop           ... bench:       734 ns/iter (+/- 264)
test io::buffered::test::bench_buffered_reader              ... bench:      1063 ns/iter (+/- 206)
test io::buffered::test::bench_buffered_stream              ... bench:      2321 ns/iter (+/- 2302)
test io::buffered::test::bench_buffered_writer              ... bench:      1060 ns/iter (+/- 24)
test io::extensions::bench::u64_from_be_bytes_4_aligned     ... bench:        69 ns/iter (+/- 2)
test io::extensions::bench::u64_from_be_bytes_4_unaligned   ... bench:        81 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_7_aligned     ... bench:        70 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_7_unaligned   ... bench:        69 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_8_aligned     ... bench:        80 ns/iter (+/- 6)
test io::extensions::bench::u64_from_be_bytes_8_unaligned   ... bench:        81 ns/iter (+/- 5)
test io::mem::test::bench_buf_reader                        ... bench:       663 ns/iter (+/- 44)
test io::mem::test::bench_buf_writer                        ... bench:       489 ns/iter (+/- 17)
test io::mem::test::bench_mem_reader                        ... bench:       700 ns/iter (+/- 23)
test io::mem::test::bench_mem_writer_001_0000               ... bench:        31 ns/iter (+/- 3)
test io::mem::test::bench_mem_writer_001_0010               ... bench:        49 ns/iter (+/- 5)
test io::mem::test::bench_mem_writer_001_0100               ... bench:       112 ns/iter (+/- 6)
test io::mem::test::bench_mem_writer_001_1000               ... bench:       765 ns/iter (+/- 59)
test io::mem::test::bench_mem_writer_100_0000               ... bench:       727 ns/iter (+/- 54)
test io::mem::test::bench_mem_writer_100_0010               ... bench:      2586 ns/iter (+/- 215)
test io::mem::test::bench_mem_writer_100_0100               ... bench:      8846 ns/iter (+/- 439)
test io::mem::test::bench_mem_writer_100_1000               ... bench:    105747 ns/iter (+/- 17443)
test num::bench::bench_pow_function                         ... bench:      5844 ns/iter (+/- 421)
test num::strconv::bench::f64::float_to_string              ... bench:       669 ns/iter (+/- 571)
test num::strconv::bench::int::to_str_base_36               ... bench:       417 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_bin                   ... bench:      1216 ns/iter (+/- 36)
test num::strconv::bench::int::to_str_dec                   ... bench:       466 ns/iter (+/- 24)
test num::strconv::bench::int::to_str_hex                   ... bench:       492 ns/iter (+/- 8)
test num::strconv::bench::int::to_str_oct                   ... bench:       496 ns/iter (+/- 295)
test num::strconv::bench::uint::to_str_base_36              ... bench:       366 ns/iter (+/- 8)
test num::strconv::bench::uint::to_str_bin                  ... bench:      1005 ns/iter (+/- 69)
test num::strconv::bench::uint::to_str_dec                  ... bench:       396 ns/iter (+/- 20)
test num::strconv::bench::uint::to_str_hex                  ... bench:       435 ns/iter (+/- 4)
test num::strconv::bench::uint::to_str_oct                  ... bench:       436 ns/iter (+/- 451)
test path::posix::bench::ends_with_path_home_dir            ... bench:       171 ns/iter (+/- 6)
test path::posix::bench::ends_with_path_missmatch_jome_home ... bench:       152 ns/iter (+/- 6)
test path::posix::bench::is_ancestor_of_path_with_10_dirs   ... bench:       215 ns/iter (+/- 8)
test path::posix::bench::join_abs_path_home_dir             ... bench:       143 ns/iter (+/- 6)
test path::posix::bench::join_home_dir                      ... bench:       192 ns/iter (+/- 29)
test path::posix::bench::join_many_abs_path_home_dir        ... bench:       144 ns/iter (+/- 9)
test path::posix::bench::join_many_home_dir                 ... bench:       194 ns/iter (+/- 19)
test path::posix::bench::path_relative_from_backward        ... bench:       254 ns/iter (+/- 15)
test path::posix::bench::path_relative_from_forward         ... bench:       244 ns/iter (+/- 17)
test path::posix::bench::path_relative_from_same_level      ... bench:       293 ns/iter (+/- 27)
test path::posix::bench::push_abs_path_home_dir             ... bench:       108 ns/iter (+/- 5)
test path::posix::bench::push_home_dir                      ... bench:     32292 ns/iter (+/- 4361)
test path::posix::bench::push_many_abs_path_home_dir        ... bench:       108 ns/iter (+/- 6)
test path::posix::bench::push_many_home_dir                 ... bench:     20305 ns/iter (+/- 1331)
test rand::bench::rand_isaac                                ... bench:       888 ns/iter (+/- 35) = 900 MB/s
test rand::bench::rand_isaac64                              ... bench:       439 ns/iter (+/- 17) = 1822 MB/s
test rand::bench::rand_shuffle_100                          ... bench:      2582 ns/iter (+/- 1001)
test rand::bench::rand_std                                  ... bench:       431 ns/iter (+/- 93) = 1856 MB/s
test rand::bench::rand_xorshift                             ... bench:         0 ns/iter (+/- 0) = 800000 MB/s
```
2014-07-28 20:51:33 +00:00
Alex Crichton
e5da6a71a6 std: Stabilize unit, bool, ty, tuple, arc, any
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-26 13:12:20 -07:00
Brian Anderson
53f0eae386 Revert "Use fewer instructions for fail!"
This reverts commit c61f9763e2.

Conflicts:
	src/librustrt/unwind.rs
	src/libstd/macros.rs
2014-07-25 15:57:15 -07:00
Brian Anderson
4636b32a42 Make most of the failure functions take &(&'static str, uint)
Passing one pointer takes less code than one pointer and an integer.
2014-07-25 00:02:29 -07:00
Patrick Walton
bb165eb5c2 libsyntax: Remove ~self and mut ~self from the language.
This eliminates the last vestige of the `~` syntax.

Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut
~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with
the self-type parameter as specified in the implementation.

Closes #13885.

[breaking-change]
2014-07-24 07:26:03 -07:00
Adolfo Ochagavía
4ea1dd5494 Add a null pointer check to CString::new
This also removes checks in other methods of `CString`

Breaking changes:
* `CString::new` now fails if `buf` is null. To avoid this add a check
before creatng a new `CString` .
* The `is_null` and `is_not_null` methods are deprecated, because a
`CString` cannot be null.
* Other methods which used to fail if the `CString` was null do not fail anymore

[breaking-change]
2014-07-24 07:25:48 -07:00
Adolfo Ochagavía
6988bcd74c Implement Show for CString
We use use `from_utf8_lossy` to convert it to a MaybeOwned string, to
avoid failing in case the CString contains invalid UTF-8
2014-07-24 07:25:48 -07:00
Brian Anderson
d36a8f3f9c collections: Move push/pop to MutableSeq
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-23 13:20:10 -07:00
bors
bfcde309e7 auto merge of #15876 : brson/rust/failfat, r=pcwalton
Adds a new runtime unwinding function that encapsulates the printing of the words "explicit failure" when `fail!()` is called w/o arguments.

The before/after optimized assembly:



```
        leaq    "str\"str\"(1412)"(%rip), %rax
        movq    %rax, 24(%rsp)
        movq    $16, 32(%rsp)
        leaq    "str\"str\"(1413)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    24(%rsp), %rdi
        leaq    8(%rsp), %rsi
        movl    $11, %edx
        callq   _ZN6unwind12begin_unwind21h15836560661922107792E
```

```
        leaq    "str\"str\"(1369)"(%rip), %rax
        movq    %rax, 8(%rsp)
        movq    $19, 16(%rsp)
        leaq    8(%rsp), %rdi
        movl    $11, %esi
        callq   _ZN6unwind31begin_unwind_no_time_to_explain20hd1c720cdde6a116480dE@PLT
```

Before/after filesizes:

rwxrwxr-x 1 brian brian 21479503 Jul 20 22:09 stage2-old/lib/librustc-4e7c5e5c.so
rwxrwxr-x 1 brian brian 21475415 Jul 20 22:30 x86_64-unknown-linux-gnu/stage2/lib/librustc-4e7c5e5c.so

This is the lowest-hanging fruit in the fail-bloat wars. Further fixes are going to require harder tradeoffs.

r? @pcwalton
2014-07-22 10:46:16 +00:00
bors
8d43e4474a auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichton 2014-07-22 07:16:17 +00:00