about summary refs log tree commit diff
path: root/src/libcore/failure.rs
AgeCommit message (Collapse)AuthorLines
2014-09-29rollup merge of #17621 : sfackler/new-snapAlex Crichton-27/+0
2014-09-28Register new snapshotsSteven Fackler-23/+0
2014-09-28Defailbloat fail!(&'static str)Tobba-6/+5
2014-09-25Rename `begin_unwind_string` to `fail_str`, refs #16114Florian Hahn-6/+6
2014-09-25Rename `fail_` lang item to `fail`, closes #16114Florian Hahn-1/+16
2014-09-24Rename `core::failure::begin_unwind` to `fail_impl`, refs #16114Florian Hahn-9/+9
2014-09-24Rename `begin_unwind` lang item to `fail_fmt`, refs #16114Florian Hahn-0/+8
2014-08-30Defailbloat fail!(string)Tobba-0/+5
2014-08-08Register new snapshot 12e0f72Niko Matsakis-24/+0
2014-07-31core: Fix failure doc commentBrian Anderson-1/+1
2014-07-31core: Add #[inline(never)] to failure functionsBrian Anderson-2/+2
For consistency, just because `fail_` has it.
2014-07-31Modify failure lang items to take less pointers.Brian Anderson-0/+26
Divide-by-zero before: ``` leaq "str\"str\"(1762)"(%rip), %rax movq %rax, 16(%rsp) movq $27, 24(%rsp) leaq "str\"str\"(1542)"(%rip), %rax movq %rax, (%rsp) movq $19, 8(%rsp) leaq 16(%rsp), %rdi leaq (%rsp), %rsi movl $32, %edx callq _ZN7failure5fail_20hc04408f955ce60aaqWjE@PLT ``` After: ``` leaq .Lconst(%rip), %rdi callq _ZN7failure5fail_20haf918a97c8f7f2bfqWjE@PLT ``` Bounds check before: ``` leaq "str\"str\"(1542)"(%rip), %rax movq %rax, 8(%rsp) movq $19, 16(%rsp) leaq 8(%rsp), %rdi movl $38, %esi movl $1, %edx movl $1, %ecx callq _ZN7failure17fail_bounds_check20hf4bc3c69e96caf41RXjE@PLT ``` Bounds check after: ``` leaq .Lconst2(%rip), %rdi movl $1, %esi movl $1, %edx callq _ZN7failure17fail_bounds_check20h5267276a537a7de22XjE@PLT ``` Size before: 21277995 librustc-4e7c5e5c.s ``` text data 12554881 6089335 ``` Size after: 21247617 librustc-4e7c5e5c.so ``` text data 12518497 6095748 ```
2014-07-25core: Remove unneeded cfgsBrian Anderson-37/+0
2014-07-25Make most of the failure functions take &(&'static str, uint)Brian Anderson-3/+42
Passing one pointer takes less code than one pointer and an integer.
2014-06-29Extract tests from libcore to a separate crateSteven Fackler-3/+1
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-18rustdoc: Fix testing indented code blocksAlex Crichton-1/+3
The collapse/unindent passes were run in the wrong order, generating different markdown for indented tests.
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-1/+1
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-05-30Register new snapshotsAlex Crichton-38/+2
2014-05-27rustc: Use rust strings for failure argumentsAlex Crichton-6/+29
This avoids having to perform conversions from `*u8` to `&'static str` which can suck in a good deal of code. Closes #14442
2014-05-19rustc: Add official support for weak failureAlex Crichton-5/+14
This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-15core: Implement unwrap()/unwrap_err() on ResultAlex Crichton-18/+32
Now that std::fmt is in libcore, it's possible to implement this as an inherit method rather than through extension traits. This commit also tweaks the failure interface of libcore to libstd to what it should be, one method taking &fmt::Arguments
2014-05-13core: Allow using failure outside of libcoreAlex Crichton-1/+1
Due to our excellent macro hygiene, this involves having a global path and a hidden module in libcore itself.
2014-05-07core: Get coretest workingAlex Crichton-0/+1
This mostly involved frobbing imports between realstd, realcore, and the core being test. Some of the imports are a little counterintuitive, but it mainly focuses around libcore's types not implementing Show while libstd's types implement Show.
2014-05-07core: Add a limited implementation of failureAlex Crichton-0/+54
This adds an small of failure to libcore, hamstrung by the fact that std::fmt hasn't been migrated yet. A few asserts were re-worked to not use std::fmt features, but these asserts can go back to their original form once std::fmt has migrated. The current failure implementation is to just have some symbols exposed by std::rt::unwind that are linked against by libcore. This is an explicit circular dependency, unfortunately. This will be officially supported in the future through compiler support with much nicer failure messages. Additionally, there are two depended-upon symbols today, but in the future there will only be one (once std::fmt has migrated).