Commit Graph

19541 Commits

Author SHA1 Message Date
Niko Matsakis
42344af713 Correct handling of if/match, and make explicit computation of
common supertypes.

This was breaking with the change to regions because of the
(now incorrect) assumpton that our inference code makes,
which is that if a <: b succeeds, there is no need to compute
the LUB/GLB.
2013-07-01 20:43:54 -04:00
Niko Matsakis
9e6d5e152e Defer reasoning about region relationships until after regionck.
This patch makes error handling for region inference failures more
uniform by not reporting *any* region errors until the reigon inference
step. This requires threading through more information about what
caused a region constraint, so that we can still give informative
error messages.

I have only taken partial advantage of this information: when region
inference fails, we still report the same error we always did, despite
the fact that we now know precisely what caused the various constriants
and what the region variable represents, which we did not know before.

This change is required not only to improve error messages but
because the region hierarchy is not in fact fully known until regionck,
because it is not clear where closure bodies fit in (our current
treatment is unsound). Moreover, the relationships between free variables
cannot be fully determined until type inference is otherwise complete.

cc #3238.
2013-07-01 20:43:54 -04:00
bors
e482856d76 auto merge of #7409 : alexcrichton/rust/threadsafe, r=cmr
@catamorphism, this re-enables threadsafe rustpkg tests, @brson this will fail unless the bots have LLVM rebuilt, so this is a good indicator of whether that happened or not.
2013-07-01 11:29:24 -07:00
Alex Crichton
5183a6cc6c Turn on using LLVM threadsafely 2013-07-01 08:30:05 -07:00
bors
b44953b8a3 auto merge of #7488 : yichoi/rust/sanitize_utf8, r=huonw
back:🔗:sanitize support escape_utf8
fix #7486
2013-07-01 08:03:15 -07:00
bors
0bd67f6891 auto merge of #7443 : yjh0502/rust/fix_field_dup, r=huonw
Check if there is duplicated field names in struct.
2013-07-01 04:37:59 -07:00
bors
d324014c6c auto merge of #7521 : thestinger/rust/vec, r=Aatch
continued from #7495
2013-07-01 02:26:46 -07:00
bors
6a2ad0801a auto merge of #7492 : yichoi/rust/fix_cleanllvm, r=luqmana
fix clean-llvm in mk/clean.mk for cross-compile

after #7442 landed, below error produced while android cross-compile
```
make[1]: *** No rule to make target `clean-llvmarm-linux-androideabi', needed by `clean-llvm'.  Stop.
make[1]: Leaving directory `/home/yichoi/rust_latest/build'
make: *** [rustllvm/llvm-auto-clean-stamp] Error 2
```
2013-07-01 00:14:02 -07:00
Young-il Choi
567cf30450 librustc: apply changes of char::escape_unicode 2013-07-01 16:11:32 +09:00
Young-il Choi
d387e78712 librustc: back:🔗:sanitize support esacpe_utf8 2013-07-01 16:10:10 +09:00
bors
07feeb95c5 auto merge of #7487 : huonw/rust/vec-kill, r=cmr
Continuation of #7430.

I haven't removed the `map` method, since the replacement `v.iter().transform(f).collect::<~[SomeType]>()` is a little ridiculous at the moment.
2013-06-30 21:14:13 -07:00
Brian Anderson
d5c5ce3f8d Update verison numbers in README.md 2013-06-30 21:08:48 -07:00
Daniel Micay
5b40f2ae5b pass exchange_malloc an alignment, not a tydesc 2013-06-30 23:30:40 -04:00
Daniel Micay
0d7799d304 global_heap: inline get_box_size and align_to 2013-06-30 22:41:51 -04:00
Daniel Micay
b731d96b4f vec: implement exchange vector reserve in Rust 2013-06-30 22:30:37 -04:00
Daniel Micay
80ab877841 global_heap: inline malloc_raw and add realloc_raw 2013-06-30 22:22:52 -04:00
bors
1c48aac9aa auto merge of #7517 : brson/rust/0.7, r=brson 2013-06-30 17:34:58 -07:00
Brian Anderson
a766a955a9 Bump version from 0.7-pre to 0.7 2013-06-30 16:36:48 -07:00
Brian Anderson
9b8c435c8e More 0.7 release notes 2013-06-30 15:02:52 -07:00
bors
040ac2a932 auto merge of #7495 : thestinger/rust/exchange, r=cmr
With these changes, exchange allocator headers are never initialized, read or written to. Removing the header will now just involve updating the code in trans using an offset to only do it if the type contained is managed.

The only thing blocking removing the initialization of the last field in the header was ~fn since it uses it to store the dynamic size/types due to captures. I temporarily switched it to a `closure_exchange_alloc` lang item (it uses the same `exchange_free`) and #7496 is filed about removing that.

Since the `exchange_free` call is now inlined all over the codebase, I don't think we should have an assert for null. It doesn't currently ever happen, but it would be fine if we started generating code that did do it. The `exchange_free` function also had a comment declaring that it must not fail, but a regular assert would cause a failure. I also removed the atomic counter because valgrind can already find these leaks, and we have valgrind bots now.

Note that exchange free does not currently print an error an out-of-memory when it aborts, because our `io` code may allocate. We could probably get away with a `#[rust_stack]` call to a `stdio` function but it would be better to make a write system call.
2013-06-30 15:02:05 -07:00
Daniel Micay
4a29d6eb3f add a closure_exchange_malloc lang item
this makes the exchange allocation header completely unused, and leaves
it uninitialized
2013-06-30 16:24:47 -04:00
Daniel Micay
45e2582e09 stop copying the tydesc in unique box take glue
the only user of the tydesc is ~fn, and it doesn't use this glue code
2013-06-30 16:22:58 -04:00
Daniel Micay
7f3752c7f9 managed: rm RC_EXCHANGE_UNIQUE constant
this is no longer used, exchange allocations do not set ref_count
2013-06-30 16:22:58 -04:00
Daniel Micay
408eef0d89 stop initializing ref_count in exchange_alloc
this is never read anymore
2013-06-30 16:22:55 -04:00
Brian Anderson
ca835f482c rustpkg: Ignore a test that's failing on the dist-snap bot 2013-06-30 13:12:15 -07:00
bors
1790400335 auto merge of #7465 : alexcrichton/rust/issue-4432, r=cmr
This stems from trying to perform as few allocations as possible throughout the standard libraries.

This specializes the `ToStr` implementation for floats/ints separately because it's known that ints will have a maximum length (whereas floats could be very very large).

I also removed a `FIXME` to remove a malloc from the `to_str()` of floats in `repr.rs` because I think that this should be addressed elsewhere. I think that we may not be able to avoid it easily because floats can have such large representations, but regardless this should be a problem with the implementation of `float_to_str_bytes_common` now and not in the `Repr` module.
2013-06-30 09:32:01 -07:00
Alex Crichton
d3155faede Specialize to_str_common for floats/integers in strconv
This allows the integral paths to avoid allocations on the heap

Closes #4424, #4423
2013-06-30 09:19:25 -07:00
Alex Crichton
8fe6fc11de Change char::escape_{default,unicode} to take callbacks instead of allocating
strings
2013-06-30 09:19:02 -07:00
Huon Wilson
c0a20d2929 Remove vec::{map, mapi, zip_map} and the methods, except for .map, since this
is very common, and the replacement (.iter().transform().collect()) is very
ugly.
2013-06-30 21:59:44 +10:00
bors
2b3569a1b3 auto merge of #7374 : Jeaye/rust/func_highlight, r=cmr
This allows for highlighting of function calls
for free floating, member, and static functions.
2013-06-30 04:40:37 -07:00
Huon Wilson
a396e1e2e9 Convert vec::{grow, grow_fn, grow_set} to methods. 2013-06-30 21:17:47 +10:00
Huon Wilson
2eea642c30 Convert vec::dedup to a method. 2013-06-30 21:17:09 +10:00
Huon Wilson
faa8f8ff8b Convert vec::{bsearch, bsearch_elem} to methods. 2013-06-30 21:15:25 +10:00
Huon Wilson
562dea1820 etc: update etc/unicode.py for the changes made to std::unicode. 2013-06-30 21:15:25 +10:00
Huon Wilson
9e83b2fe55 Convert vec::{reverse, swap} to methods. 2013-06-30 21:15:25 +10:00
Huon Wilson
a890c2cbf1 Convert vec::{rposition, rposition_elem, position_elem, contains} to methods. 2013-06-30 21:15:24 +10:00
Huon Wilson
45940ed988 Remove vec::[r]position_between, replaced by slices & iterators. 2013-06-30 21:06:48 +10:00
Huon Wilson
5d46bcc0e4 Remove vec::{rfind, rfind_between, find_between}, replaced by slices and iterator adapators. 2013-06-30 21:06:47 +10:00
bors
6fcd8bf567 auto merge of #7468 : cmr/rust/great_renaming, r=pcwalton 2013-06-30 01:19:38 -07:00
Daniel Micay
350a5c0b72 vec: use contains_managed instead of box header 2013-06-30 03:45:39 -04:00
Daniel Micay
b91416214e add a contains_managed intrinsic 2013-06-30 03:45:39 -04:00
Daniel Micay
b883d6a54c simplify the exchange allocator
* stop using an atomic counter, this has a significant cost and
  valgrind will already catch these leaks
* remove the extra layer of function calls
* remove the assert of non-null in free, freeing null is well defined
  but throwing a failure from free will not be
* stop initializing the `prev`/`next` pointers
* abort on out-of-memory, failing won't necessarily work
2013-06-30 03:45:36 -04:00
bors
b4bb36490d auto merge of #7490 : mozilla/rust/rollup, r=thestinger
603137c r=cmr
fe10db2 r=bstrie
2013-06-29 23:34:43 -07:00
bors
c6b0d4f516 auto merge of #7475 : Seldaek/rust/fixsplit, r=cmr
I almost got locked out of my machine because I misunderstood the purpose of the function and called it with a limit of uint::max_value, which turned this function into an almost endless loop.
2013-06-29 21:13:31 -07:00
Young-il Choi
0a3f6bc130 mk: clean-llvm for cross-compile 2013-06-30 12:54:17 +09:00
bors
3017343232 auto merge of #7457 : Blei/rust/fix-ffi-floats, r=cmr
Also contains a fix to help ctag pick up macro definitions.
2013-06-29 18:40:33 -07:00
jihyun
7bcde87d1b Fixes #7377 2013-06-30 09:41:21 +09:00
bors
df39932090 auto merge of #7452 : dotdash/rust/self_indirection, r=cmr
Currently we pass all "self" arguments by reference, for the pointer
variants this means that we end up with double indirection which causes
a unnecessary performance hit.

The fix itself is pretty straight-forward and just means that "self"
needs to be handled like any other argument, except for by-value "self"
which still needs to be passed by reference. This is because
non-pointer types can't just be stuffed into the environment slot which
is used to pass "self".

What made things tricky is that there was also a bug in the typechecker
where the method map entries are created. For type impls, that stored
the base type instead of the actual self-type in the method map, e.g.
Foo instead of &Foo for &self. That worked with pass-by-reference, but
fails with pass-by-value which needs the real type.

Code that makes use of methods seems to be about 10% faster with this
change. Also, build times are reduced by about 4%.

Fixes #4355, #4402, #5280, #4406 and #7285
2013-06-29 16:46:32 -07:00
Daniel Micay
052f28a808 minor vec cleanup
* hide the rustrt module in the docs
* remove the useless `traits` module wrapping the `Add` impl
2013-06-29 17:37:03 -04:00
Jordi Boggiano
eee7accedb Add -v/--version support to rust binary 2013-06-29 17:33:18 -04:00