Commit graph

16984 commits

Author SHA1 Message Date
bors
4a52ff0786 auto merge of #7072 : thestinger/rust/ptr, r=catamorphism
I don't think this will even show up in the documentation right now.... but it should still be correct :).
2013-06-11 22:31:39 -07:00
bors
cc80652e4a auto merge of #7060 : huonw/rust/more-str, r=thestinger
There are now only half-a-dozen or so functions left `std::str` that should be methods.

Highlights:
- `.substr` was removed, since most of the uses of it in the code base were actually incorrect (it had a weird mixing of a byte index and a unicode character count), adding `.slice_chars` if one wants to handle characters, and the normal `.slice` method to handle bytes.
- Code duplication between the two impls for `connect` and `concat` was removed via a new `Str` trait, that is purely designed to allow an explicit -> `&str` conversion (`.as_slice()`)
- Deconfuse the 5 different functions for converting to `[u8]` (3 of which had actually incorrect documentation: implying that they didn't have the null terminator), into 3: `as_bytes` (all strings), `as_bytes_with_null` (`&'static str`, `@str` and `~str`) and `as_bytes_with_null_consume` (`~str`). None of these allocate, unlike the old versions.

(cc @thestinger)
2013-06-11 21:37:43 -07:00
Daniel Micay
0685c657f0 update jemalloc to 3.4.0 2013-06-12 00:26:15 -04:00
bors
7033dfcf91 auto merge of #7069 : dotdash/rust/cast_combine, r=graydon
Shaves off a percent or so from the LLVM passes for librustc.
2013-06-11 20:43:39 -07:00
Huon Wilson
9f0c85acc9 std: fix windows 2013-06-12 13:42:41 +10:00
Huon Wilson
13460de61c std: fix method renaming. 2013-06-12 13:09:02 +10:00
bors
8761b1fb16 auto merge of #7067 : brson/rust/notasktrans, r=graydon 2013-06-11 19:37:39 -07:00
Huon Wilson
eecbe5556b Silence some warnings. 2013-06-12 12:21:05 +10:00
Huon Wilson
26d7b460a3 std: generalise .trim_chars to use CharEq. 2013-06-12 12:21:05 +10:00
Huon Wilson
073e82fff2 std: create Str trait for DRY. Use it on StrVector.
The Str trait collects the various strings types and provides a method
for coercing to a slice, so that functions and impls can be written for
generic types containing strings (e.g. &[~str], &[&str], ...) without
having to write one for each string type (assuming that the impl only
needs a slice).
2013-06-12 12:21:04 +10:00
Huon Wilson
3a1e13c7a0 std: convert str::escape_* to methods. 2013-06-12 12:21:04 +10:00
Huon Wilson
9e60e2e297 std: convert str::replace to a method. 2013-06-12 12:21:04 +10:00
Huon Wilson
12750c8893 std: methodise str::capacity 2013-06-12 12:21:04 +10:00
Huon Wilson
3ac00a9489 std: remove substr & str::count_*, methodise char_len, implement slice_chars.
The confusing mixture of byte index and character count meant that every
use of .substr was incorrect; replaced by slice_chars which only uses
character indices. The old behaviour of `.substr(start, n)` can be emulated
via `.slice_from(start).slice_chars(0, n)`.
2013-06-12 12:21:04 +10:00
Huon Wilson
9fff8c6eba std: add a test for HashMap::find_equiv. 2013-06-12 12:21:04 +10:00
Huon Wilson
efc71a8bdb std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
The first acts on &str and is not nul-terminated, the last two act on strings
that are always null terminated (&'static str, ~str and @str).
2013-06-12 12:21:04 +10:00
Huon Wilson
ba4a4778cc std: convert str::{*shift,pop}* to methods. 2013-06-12 12:21:04 +10:00
Huon Wilson
8786bca7e2 std: convert str::repeat to a method. 2013-06-12 12:21:03 +10:00
Huon Wilson
3c23a0a836 std: replace str::append with a method 2013-06-12 12:21:03 +10:00
Huon Wilson
96cd61ad03 std: convert {vec,str}::to_owned to methods. 2013-06-12 12:21:03 +10:00
bors
e06579bc09 auto merge of #7056 : alexcrichton/rust/issue-4727, r=catamorphism
Closes #4727
2013-06-11 17:22:46 -07:00
Ron Dahlgren
37489a67e5 Iterator documentation fixes
Fixes two typos and one incorrect description.
2013-06-11 16:34:03 -07:00
bors
3f900dc7d1 auto merge of #7055 : thestinger/rust/iterator, r=catamorphism
This was a lot more painful than just changing `x.each` to `x.iter().advance` . I ran into my old friend #5898 and had to add underscores to some method names as a temporary workaround.

The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic `@mut` failures, so those had to be wrapped in blocks except where the scope ends immediately.

Anyway, the ugliness will be fixed as the compiler issues are fixed and this change will amount to `for x.each |x|` becoming `for x.iter |x|` and making all the iterator adaptors available.

I dropped the run-pass tests for `old_iter` because there's not much point in fixing a module that's on the way out in the next week or so.
2013-06-11 16:19:42 -07:00
Daniel Micay
fbae011ad1 fix the docstring for copy_nonoverlapping_memory 2013-06-11 19:06:01 -04:00
Daniel Micay
107e371bf0 fix the ptr::set_memory docstring 2013-06-11 17:48:44 -04:00
bors
1175e94de3 auto merge of #7033 : influenza/rust/rust-7022, r=graydon
This commit fixes #7022 - I've added an additional check to ensure that
stk is not null before dereferencing it to get it's next element,
assigning NULL if it is itself NULL.
2013-06-11 14:40:48 -07:00
bors
da9172af60 auto merge of #7040 : alexcrichton/rust/issue-6511-threadsafe-llvm, r=graydon
This is a reopening of #6570, and almost fixes #6511.

Note that this doesn't actually enable building a threadsafe LLVM, because that will require an LLVM rebuild which will be bundled with the upgrades in #6713.

What this does do, however, is removes all thread-unsafe usage of LLVM from the compiler.
2013-06-11 13:46:54 -07:00
Björn Steinbrink
f526434197 Codegen: Combine two PointerCasts into one
Shaves off a percent or so from the LLVM passes for librustc.
2013-06-11 22:45:13 +02:00
Ron Dahlgren
37c8558895 Replace tabs with spaces 2013-06-11 13:10:41 -07:00
Alex Crichton
78404af882 Ignore the test_package_request_version test for now 2013-06-11 12:40:53 -07:00
Alex Crichton
305f5110a7 Add a finally impl for extern "Rust" fn() 2013-06-11 12:40:40 -07:00
Brian Anderson
48c7bc17c6 rustc: Remove task type defs from trans 2013-06-11 12:36:42 -07:00
Daniel Micay
bbe3d4a9dc fix windows build 2013-06-11 15:00:58 -04:00
Daniel Micay
004816f4c6 option: remove redundant old_iter impls 2013-06-11 14:06:12 -04:00
Daniel Micay
4f2f545ac2 add Iterator implementations for Option 2013-06-11 14:05:27 -04:00
bors
d0b1979004 auto merge of #7035 : influenza/rust/getopts-doc-update, r=bstrie
The documentation was still refering to getopts as though it was in the
std module - I've changed this to refer to extra instead.
2013-06-11 10:46:37 -07:00
Ron Dahlgren
301f9001c0 Assert stk rather than checking null
Given that a big stack is never requested before allocating an initial
stack segment, having a non-null stk member here is an invariant.
2013-06-11 10:11:49 -07:00
bors
d1d855993d auto merge of #7047 : bblum/rust/bug_triage, r=graydon
r? anybody
2013-06-11 09:52:40 -07:00
bors
bf41586a18 auto merge of #7058 : Blei/rust/fix-7048, r=bstrie 2013-06-11 08:01:50 -07:00
Philipp Brüschweiler
3f62f9bccd ty: several small fixes to is_instantiable
* Don't return early, so logging is not skipped
* Remove one allocation
* Indent the match statement correctly
2013-06-11 11:44:53 +02:00
Philipp Brüschweiler
278b3beafe decoder: better error message when failing to look up an id 2013-06-11 11:44:53 +02:00
Philipp Brüschweiler
1ac90bb74b lexer: show correct span on unrecognized token start
Fixes part of #7048.
2013-06-11 11:44:53 +02:00
bors
075da9c3e9 auto merge of #7050 : huonw/rust/extra-complex-work, r=Aatch 2013-06-11 00:22:34 -07:00
bors
6bdd4c8545 auto merge of #7054 : yichoi/rust/after_jemalloc, r=brson
jemalloc searches pthread_atfork
2013-06-10 23:28:34 -07:00
Young-il Choi
febba9f418 rt: dummy function pthread_atfork for android 2013-06-11 14:52:15 +09:00
bors
df5b0c040c auto merge of #7046 : luqmana/rust/issue-7044, r=sanxiyn
Fixes #7044.
2013-06-10 20:52:32 -07:00
Huon Wilson
19c31b6b1a extra: implement .norm(), and Polar conversion functions for complex numbers.
Also, convert complex to use Clone, rather than Copy.

Fixes #5734 and #5735.
2013-06-11 11:37:33 +10:00
Huon Wilson
7e6a5940cb std: convert pow, hypot, atan2, log to take arguments by reference. 2013-06-11 11:36:03 +10:00
Kevin Ballard
8f1edd5307 terminfo: Support more terminfo directory structures
OS X's terminfo uses the hex representation of the first character of
the terminal name as the directory name.

Ubuntu seems to use /lib/terminfo instead of /usr/share/terminfo, at
least on the one machine I have access to.
2013-06-10 15:52:10 -07:00
Ben Blum
8081aea3b8 Tag a bunch of destructors that need mutable self with FIXME for #4330. Close #4943. 2013-06-10 18:18:04 -04:00
Luqman Aden
693b9ce4e8 Add test for #7044. 2013-06-10 18:06:56 -04:00
Luqman Aden
a95232a59e librustc: Better errors for duplicate definitions. 2013-06-10 18:00:57 -04:00
Ben Blum
d25fae0e10 Remove 'this could be clearer' FIXME. Looks fine. Close #2618. 2013-06-10 17:51:02 -04:00
Ben Blum
967c7d828a Replace str::raw::buf_as_slice with c_str_to_static_slice. Close #3843. 2013-06-10 17:34:28 -04:00
Luqman Aden
5a3e1cdaec librustc: Don't allow newtype or unit-like structs to shadow other names in the value namespace. 2013-06-10 17:29:48 -04:00
Alex Crichton
5c5095d25e Have JIT execution take ownership of the LLVMContextRef
Also stop leaking the ExecutionEngine created for jit code by forcibly disposing
of it after the JIT code has finished executing
2013-06-10 13:17:04 -07:00
Alex Crichton
779191cd4b Remove all usage of the global LLVMContextRef
This allows parallel usage of the rustc library
2013-06-10 13:17:04 -07:00
Huon Wilson
e8782eeb63 fix tests, remove some warnings 2013-06-11 02:34:14 +10:00
Huon Wilson
2fa83c0503 std: replace str::is_{alphanumeric,whitespace} with the methods. 2013-06-11 01:07:52 +10:00
Huon Wilson
838191c40b std: replace str::{starts,ends}_with with the method. 2013-06-11 01:03:24 +10:00
Huon Wilson
248b6e38b5 std: replace str::substr with the method. 2013-06-11 00:52:47 +10:00
Huon Wilson
ebefe425b9 std: remove str::to_chars 2013-06-11 00:49:19 +10:00
Huon Wilson
8c59d920a1 std: basic documentation for the new str methods 2013-06-11 00:08:57 +10:00
Huon Wilson
ccd0ac59e9 std: remove str::{connect,concat}*. 2013-06-10 23:57:03 +10:00
Huon Wilson
5a711ea7c3 clean-up unused import warnings 2013-06-10 23:15:01 +10:00
Huon Wilson
ead4468249 std: fix tests 2013-06-10 23:02:55 +10:00
Huon Wilson
ec5a028ada std: convert str::char_at* to methods. 2013-06-10 23:02:55 +10:00
Huon Wilson
f632f46614 std: convert str::trim* to methods. 2013-06-10 23:02:55 +10:00
Huon Wilson
1553874149 std: convert str::reserve* to methods, and methodise str::push_*. 2013-06-10 23:02:55 +10:00
Huon Wilson
a64e886e3c std: remove str::contains in favour of the method 2013-06-10 23:02:55 +10:00
Huon Wilson
017450a611 std: replace str::find_str* with a method 2013-06-10 23:02:54 +10:00
Huon Wilson
7281fb948a std: replace str::{any,all}_between with the iterator equivalent. 2013-06-10 23:02:54 +10:00
Huon Wilson
0cfc08d81e std: convert character-based str::find_* to methods. Add .slice_{to,from} methods. 2013-06-10 23:02:54 +10:00
Huon Wilson
76fc9be5a1 std: convert each_split_str to an iterator 2013-06-10 23:02:54 +10:00
Huon Wilson
ee41ad4168 std: fix compile & test 2013-06-10 23:02:54 +10:00
Huon Wilson
c32fb53cf9 std: remove str::{len, slice, is_empty} in favour of methods. 2013-06-10 23:02:54 +10:00
Huon Wilson
b29cd22bce std: replace str::all/any fns and methods with iterators 2013-06-10 23:02:54 +10:00
Huon Wilson
1e8982bdb2 std: replace str::each_split* with an iterator 2013-06-10 23:02:54 +10:00
James Miller
e9c309c0e5 STATIC_PAGE_SHIFT for cross-compiling jemalloc
Sets `STATIC_PAGE_SHIFT` for cross-compiling jemalloc to 12. A
shift of 12 represents a page size of 4k for practically all
platforms.
2013-06-10 18:26:24 +12:00
bors
8f4f0bebe7 auto merge of #7038 : alexcrichton/rust/issue-6935, r=catamorphism
Tracks the `type_target` and `value_target` source imports separately to correctly warn about unused imports.
2013-06-09 21:49:23 -07:00
Alex Crichton
b6cccb3d81 Track the source of the type_target and value_target separately for ImportResolutions 2013-06-09 21:42:57 -07:00
bors
6e5e97fc78 auto merge of #7028 : thestinger/rust/cmp, r=brson 2013-06-09 20:13:23 -07:00
Daniel Micay
86833ea286 cmp: remove duplicate free functions 2013-06-09 20:47:40 -04:00
Ron Dahlgren
9e4beaac9d Fix all issues with sample code
The getopts sample program now compiles and runs. Additionally I made
all of the indentation uniformly four spaces.
2013-06-09 16:13:52 -07:00
Ron Dahlgren
983269e71a Updated documentation to refer to extra module
The documentation was still refering to getopts as though it was in the
std module - I've changed this to refer to extra instead.
2013-06-09 15:45:55 -07:00
bors
9bcf9119d8 auto merge of #7029 : luqmana/rust/issue-4228, r=catamorphism
Fixes #4228
2013-06-09 14:46:24 -07:00
bors
94f72dd736 auto merge of #6904 : catamorphism/rust/rustpkg_version_vcs, r=catamorphism
r? @brson
2013-06-09 13:16:27 -07:00
Tim Chevalier
d92b4358d2 rustpkg: Accept package IDs like github.com/foo/bar#0.3
If the package ID is of the form s#v, where v is a valid version
string, fetch tag v of that package.
2013-06-09 13:05:52 -07:00
Ron Dahlgren
12203a76c2 Check stk before dereferencing
This commit fixes #7022 - I've added an additional check to ensure that
stk is not null before dereferencing it to get it's next element,
assigning NULL if it is itself NULL.
2013-06-09 10:43:16 -07:00
Luqman Aden
0bf6d9e9ef Add test for #4228. 2013-06-09 08:00:52 -04:00
Luqman Aden
618558a70f librustc: Allow adding static fn's in multiple impl's. 2013-06-09 08:00:40 -04:00
bors
88c318d28c auto merge of #7023 : thestinger/rust/vec, r=brson 2013-06-08 22:34:10 -07:00
Daniel Micay
de367157b5 remove deprecated vec::{is_empty, len} functions 2013-06-08 23:19:30 -04:00
bors
1f0c05ff74 auto merge of #7018 : bill-myers/rust/fix_7017, r=thestinger
Minimally fixes #7017, we were overwriting the result and thus ignoring attributes before the last.

csearch::get_item_attrs and decoder::get_item_attrs should probably also be changed to each_item_attrs using the for protocol, but that's just a minor performance/style issue.
2013-06-08 19:16:11 -07:00
Bill Myers
54ec7ab057 add test for RcMut being Const and Owned, tests #7017 being fixed 2013-06-09 03:43:58 +02:00
Bill Myers
90ec4228be fix decoding of multiple attributes (fixes #7017)
We were just looking at the last because we were overwriting ret.
2013-06-09 02:36:31 +02:00
bors
470bf0dfb3 auto merge of #7016 : thestinger/rust/ptr, r=luqmana 2013-06-08 14:31:10 -07:00
bors
878a9b92eb auto merge of #7004 : dotdash/rust/allocs, r=thestinger
This removes some unnecessary allocations in the lexer, the typechecker and the metadata decoder. Reduces the time spent in the parsing and typechecking passes by about 10% for me.
2013-06-08 13:37:10 -07:00
bors
4aa77198cb auto merge of #6992 : Blei/rust/fix-autoderef-ice, r=catamorphism
Related to #5062, but doesn't fix that one.
2013-06-08 12:40:15 -07:00
Daniel Micay
fe3ad0a204 rm some uses of to_mut_unsafe_ptr 2013-06-08 15:02:32 -04:00
Tim Chevalier
53b8352552 rustpkg: Extract version number from git, as per #5684
For now, the test I added just checks that PkgId::new parses the
version number out of a git repo's tags list, where relevant.
2013-06-08 11:59:03 -07:00
Tim Chevalier
a014088da1 std: Fix search-and-replace typos 2013-06-08 11:59:03 -07:00
Huon Wilson
98ba91f81b remove unused import warnings 2013-06-09 02:22:23 +10:00
Huon Wilson
00f5916809 std: replace the str::each* fns/methods with byte iterators 2013-06-09 02:22:23 +10:00
Huon Wilson
4b806b4d06 std: remove each_char* fns and methods from str, replaced by iterators. 2013-06-09 02:22:23 +10:00
Huon Wilson
513d2292e5 std: remove foldr and alli methods in vec 2013-06-09 02:22:23 +10:00
Huon Wilson
ed299af625 std: remove fold[lr] in favour of iterators 2013-06-09 02:22:23 +10:00
Huon Wilson
65c7c58c8f std: remove {all*,any*,count} in favour of iterators 2013-06-09 02:22:23 +10:00
Huon Wilson
ce4f63dcee std: add reverse vec iterators, replace vec::each*_reverse. 2013-06-09 02:22:23 +10:00
bors
e2ec8e71ce auto merge of #7008 : thestinger/rust/iterator, r=catamorphism
The `IteratorUtil` trait hits a bug in method resolve, but the basic trait has no issue.
2013-06-08 02:28:15 -07:00
Philipp Brüschweiler
a99ba1180d rustc::regionck: fix ICE when getting signature of ty_err
Fixes #5062
2013-06-08 09:34:47 +02:00
Philipp Brüschweiler
c74f39782f Add test for #5062 2013-06-08 09:34:38 +02:00
Philipp Brüschweiler
f3f9db133a rustc: Fix an ICE "Autoderef but type not derefable"
Related to #5062 (same error message), but that test case causes
a different ICE than mentioned there (even without this fix).
2013-06-08 09:34:32 +02:00
Philipp Brüschweiler
c786b68dd3 Add a test that causes an ICE currently 2013-06-08 09:34:25 +02:00
bors
1d06aea0b7 auto merge of #7005 : dotdash/rust/fix_get_str_from, r=bstrie
As the comment said, the subtraction is bogus for multibyte characters.
Fortunately, we can just use last_pos instead of pos to get the correct
position without any subtraction hackery.
2013-06-08 00:34:22 -07:00
bors
88517f9874 auto merge of #7000 : Blei/rust/fix-6155, r=catamorphism 2013-06-07 22:46:25 -07:00
bors
3fc0524818 auto merge of #6920 : catamorphism/rust/issue-4765, r=bstrie
r? anybody As per #4765
2013-06-07 21:13:31 -07:00
Tim Chevalier
aac1298122 testsuite: Add test cases that pass 2013-06-07 19:37:29 -07:00
Daniel Micay
d27ba09245 add the Iterator trait to the prelude 2013-06-07 22:23:48 -04:00
Björn Steinbrink
2096d79626 Avoid unnecessary allocations in the metadata decoder 2013-06-08 03:27:48 +02:00
Björn Steinbrink
43cae88079 Lexer: Fix offset handling in get_str_from()
As the comment said, the subtraction is bogus for multibyte characters.
Fortunately, we can just use last_pos instead of pos to get the correct
position without any subtraction hackery.
2013-06-08 03:24:47 +02:00
Björn Steinbrink
29e5aa0942 Remove some unnecessary closures 2013-06-08 03:24:47 +02:00
Björn Steinbrink
b65dc42b25 TypeChecker: Avoid unnecessary copies 2013-06-08 03:24:47 +02:00
Björn Steinbrink
de1df3608b Lexer: Avoid unnecessary allocations 2013-06-08 03:24:47 +02:00
Björn Steinbrink
96798f5e05 tydecode: Accept a plain borrowed pointer to the data 2013-06-08 03:24:47 +02:00
Björn Steinbrink
51e85f5e6e Avoid unnecessary heap allocations in the metadata ty decoder 2013-06-08 03:24:47 +02:00
Björn Steinbrink
b870477897 Avoid unnecessary (re-)allocations in the lexer 2013-06-08 03:24:47 +02:00
Tim Chevalier
239b81f111 std: Change str::from_bytes to raise a condition on invalid input
As per #4765
2013-06-07 17:42:50 -07:00
Philipp Brüschweiler
080a462050 rustc::typeck: fix array out of bounds
Fixes #6155
2013-06-07 22:09:01 +02:00
Philipp Brüschweiler
320995198c Add test for #6155 2013-06-07 22:08:54 +02:00
Daniel Micay
07e4d69baa iterator: work around method resolve bug (#5898) 2013-06-07 14:50:06 -04:00
Daniel Micay
d945543ebf Merge branch 'each-fn-kill' of https://github.com/huonw/rust into each-fn-kill 2013-06-07 14:43:02 -04:00
Huon Wilson
54d914a9a9 std: remove each[i]_mut functions, in favour of iterators. 2013-06-08 03:24:27 +10:00
Huon Wilson
bc81d279fa rustc: Convert a fail! to a useful error message. 2013-06-08 01:46:49 +10:00
Huon Wilson
f661a15b2b std: remove vec::each2 and vec::each2_mut in favour of iterators 2013-06-08 01:20:47 +10:00
Huon Wilson
5e9f006c5b std: more dummy type parameters on iterators to work around #6967. 2013-06-08 01:10:27 +10:00
bors
0d0c004b81 auto merge of #6988 : huonw/rust/deriving-changes, r=bstrie
Several minor changes:
 - The clean-up I mentioned in #6851 (moving functions from deriving/mod.rs to deriving/generic.rs)
 - Move `expand_generic_deriving` to a method
 - Reimplement `deriving(Ord)` with no dependence on `Eq`
2013-06-07 06:58:33 -07:00
Huon Wilson
a965f4981a syntax: correct the modifications to deriving(Ord) so that it works. 2013-06-07 22:36:57 +10:00
Huon Wilson
ebf7281b7b syntax: rewrite deriving(Ord) to not require Eq.
lt and gt are implement directly in terms of the corresponding
method on their elements, and le and ge are the negations of these.
2013-06-07 18:36:16 +10:00
Philipp Brüschweiler
9b3743938d rustc::metadata::decoder: cleanup and slightly speed up each_path 2013-06-07 10:00:48 +02:00
Huon Wilson
6d5beda677 syntax: move expand_generic_deriving to be a method on TraitDef 2013-06-07 17:46:44 +10:00
Huon Wilson
43e52e4bf1 syntax: move functions from deriving/mod to deriving/generic.
These are now only called in generic and can be private. This
includes manually inlining/merging some that are called once.
2013-06-07 17:30:38 +10:00
bors
4abd83b18d auto merge of #6985 : Aatch/rust/fixed-vec-6977, r=thestinger
This fixes #6977. Negative counts don't make sense anyway.
2013-06-06 20:34:32 -07:00
bors
74d9de7abd auto merge of #6979 : thestinger/rust/libc, r=brson
LLVM provides these functions as intrinsics, and will generate calls to
libc when appropriate. They are exposed in the `ptr` module as
`copy_nonoverlapping_memory`, `copy_memory` and `set_memory`.

@graydon: r?
2013-06-06 19:40:32 -07:00
bors
5d2cadbfea auto merge of #6895 : cmr/rust/jemalloc, r=brson 2013-06-06 18:43:37 -07:00
James Miller
de27064d84 Disallow negative counts in repeat expressions 2013-06-07 12:30:44 +12:00
bors
d6b4fde97e auto merge of #6982 : Aatch/rust/better-foreign-error, r=pcwalton
I encountered this. A straight fail is not useful and most people aren't going to happily spelunk in `parser.rs`
2013-06-06 16:52:36 -07:00
James Miller
9c8d0e375e Provide an actual error when expanding macros to foreign items 2013-06-07 11:28:38 +12:00
bors
6a09b6f0c3 auto merge of #6981 : jbclements/rust/fold-traverses-macros, r=catamorphism
Fixes bug #2888 . Includes test cases

r? @catamorphism
2013-06-06 15:43:35 -07:00
bors
145279709d auto merge of #6980 : Kimundi/rust/iterator-collect3, r=thestinger 2013-06-06 14:46:41 -07:00
John Clements
eff49fc48b implement fold traversing macros 2013-06-06 14:21:07 -07:00
John Clements
2d59ebadb9 add test cases for fold traversing macros 2013-06-06 14:21:07 -07:00
bors
533425e242 auto merge of #6053 : nikomatsakis/rust/fixme-2699, r=thestinger
r? @jld or @graydon

The calculation looks right to me, but perhaps one of you two can double check.  You two seem like you are doing the most recent work in this sort of area.
2013-06-06 13:52:41 -07:00
Marvin Löbel
cac4891154 Fixups 2013-06-06 22:40:35 +02:00
Marvin Löbel
070015468d Removed IteratorUtil::to_vec and iter::to_vec 2013-06-06 22:11:48 +02:00
Marvin Löbel
857d433b9a Added IteratorUtil::collect 2013-06-06 22:11:48 +02:00
Marvin Löbel
af2086a2f1 Added iter::FromIter 2013-06-06 22:11:47 +02:00
bors
a51fae097f auto merge of #6937 : msullivan/rust/no-warnings, r=bstrie 2013-06-06 12:58:41 -07:00
Daniel Micay
8bcefef2f2 libc: omit memcpy, memmove and memset
LLVM provides these functions as intrinsics, and will generate calls to
libc when appropriate. They are exposed in the `ptr` module as
`copy_nonoverlapping_memory`, `copy_memory` and `set_memory`.
2013-06-06 15:18:45 -04:00
Michael Sullivan
8bbf83b62a Clean up a handful of build warnings. 2013-06-06 12:14:41 -07:00
bors
0e96369224 auto merge of #6968 : huonw/rust/takeskip-iter, r=thestinger
@thestinger r?

Adding the dummy parameter stops the inference from having to work so hard.
2013-06-06 10:07:41 -07:00
bors
021e6d38f0 auto merge of #6975 : artagnon/rust/tuple-tostr, r=bstrie
[1/2] fixes a couple of comments.
[2/2] uses fmt! instead of hand-concatenating strings in a couple of places.

No functional changes.
2013-06-06 09:13:44 -07:00
Ramkumar Ramachandra
01c4f11cf8 libstd: use fmt! in to_str impl for (one|two)-tuple
The three-tuple uses fmt!, and there's no reason to hand-concatenate
strings.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 20:50:29 +05:30
Ramkumar Ramachandra
ab10b1ed29 libstd: fix comment in to_str impl of tuple
There is a pointer to #4760, which is a closed issue.  The real issue is
the more general problem described in #4653.  Correct the comment.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 20:50:29 +05:30
bors
8450dc8f5e auto merge of #6972 : artagnon/rust/bad-for-loop, r=bstrie
I noticed this while reading the tutorial.

[1/2] adds tests to guard against regressions.
[2/2] corrects the tutorial.

Please let me know if you have a standard place to put tests: they seem to be all over the place currently.
2013-06-06 07:46:47 -07:00
Ramkumar Ramachandra
c2cb238075 test/compile-fail: clarify bad-for-loop
There are two distinct kinds of bad-for-loops to check for with two
distinct error messages.  The current bad-for-loop.rs does not make this
clear, so rewrite it into bad-for-loop{,-2}.rs.  The two failing
prototypes are:

  fn quux(_: &fn(&int) -> int) -> bool { true }
  fn quux(_: &fn(&int) -> bool) -> () { }

Note that the second one runs fine in rust-0.6 (the latest release), and
only fails with a rust built from `incoming`.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-06 19:23:52 +05:30
Philipp Brüschweiler
13df1198d5 infer: remove superfluous call to try() 2013-06-06 11:53:09 +02:00
Alexei Sholik
e75572c879 Deduplicate words in code comments 2013-06-06 10:48:27 +03:00
Huon Wilson
32228f3d57 std: work-around for take/skip type inference (#6967) 2013-06-06 16:40:12 +10:00
bors
7e62ad6876 auto merge of #6964 : huonw/rust/vec-mut-iter, r=thestinger 2013-06-05 22:25:38 -07:00
Huon Wilson
848dbc93ee std: add an external iterator for mutating vec elements 2013-06-06 15:16:07 +10:00
bors
4a19af1b03 auto merge of #6960 : msullivan/rust/fix-pollution, r=brson 2013-06-05 19:55:36 -07:00
Michael Sullivan
1ebb62f591 Fix stat.rs to not pollute the build directory. Closes #6959. 2013-06-05 16:00:12 -07:00
bors
2c65e2e385 auto merge of #6956 : Blei/rust/fix-symbol-mangling, r=catamorphism
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 14:13:43 -07:00
Philipp Brüschweiler
eb62781720 rustc:🔙🔗 redo symbol mangling
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 22:21:25 +02:00
John Clements
91b652695b moved TLS of sctable to ast_util, hid parameter in hygiene calls 2013-06-05 12:01:40 -07:00
John Clements
fe6baa9023 added fresh-name fn 2013-06-05 12:01:40 -07:00
John Clements
5a158f1d19 add hygiene support functions 2013-06-05 12:01:40 -07:00
John Clements
ecdb6e4722 remove unused get_ident_interner's 2013-06-05 12:01:40 -07:00
John Clements
8dad2bb281 removed unused imports (and one unused argument) 2013-06-05 12:01:39 -07:00
John Clements
367eddf5b1 remove interner field from string_reader 2013-06-05 12:01:39 -07:00
John Clements
19cbd0d284 remove interner from tt_reader 2013-06-05 12:01:39 -07:00
John Clements
be22fddba0 rand example fixup 2013-06-05 12:01:39 -07:00
John Clements
c88f337fc9 remove unused cx's 2013-06-05 12:01:39 -07:00
John Clements
04a691a511 token_to_ident takes argument by reference 2013-06-05 12:01:38 -07:00
John Clements
3203595471 interner just uses uints, not idents with syntax context 2013-06-05 12:01:38 -07:00
John Clements
ae02bf70e0 removed some interner fields 2013-06-05 12:01:38 -07:00
John Clements
1537056982 just use TLS interner 2013-06-05 12:01:37 -07:00
John Clements
22d21ab4c2 rename repr to name 2013-06-05 12:01:37 -07:00
John Clements
7266981b4c removed obsolete reference to purity 2013-06-05 12:01:37 -07:00
John Clements
e99657c7e7 parser comments 2013-06-05 12:01:37 -07:00
John Clements
b24b453e4a comments & whitespace 2013-06-05 12:01:37 -07:00
John Clements
d7638f9dba change to newer macro escape mechanism, using uints in more places 2013-06-05 12:01:36 -07:00
John Clements
77c2c0900f add renaming and sctable funs 2013-06-05 12:01:31 -07:00
bors
de3000af8f auto merge of #6948 : huonw/rust/less-alloc, r=bstrie 2013-06-05 06:46:51 -07:00
bors
e2d0a30fa2 auto merge of #6947 : Blei/rust/fix-dup-freevars, r=bstrie 2013-06-05 05:19:41 -07:00
Huon Wilson
b871c46934 syntax: Remove an unnecessary allocation. 2013-06-05 21:57:24 +10:00
Philipp Brüschweiler
c08df70f2b rust::driver: remove accidental double freevar calculation 2013-06-05 13:31:19 +02:00
Patrick Walton
8114d0e950 librustc: Disallow multiple patterns from appearing in a "let" declaration.
You can still initialize multiple variables at once with "let (x, y) = (1, 2)".
2013-06-04 21:45:42 -07:00
Patrick Walton
16086ecff7 libsyntax: Remove pub impl from the language 2013-06-04 21:45:42 -07:00
bors
9873f67e94 auto merge of #6942 : thestinger/rust/cleanup, r=catamorphism
borrowed pointers already implement Eq and Ord with deep comparisons
2013-06-04 17:55:34 -07:00
bors
cf2b00dc8b auto merge of #6941 : Thiez/rust/pub_atomics, r=thestinger
As the title suggests, this marks all the fns on the impls on the atomic types in std::unstable::atomics as pub, which makes them significantly more usable (they are rather unusable otherwise).
r?
2013-06-04 16:52:34 -07:00
Daniel Micay
5148e2f78b sys: get rid of shape functions
borrowed pointers already implement Eq and Ord with deep comparisons
2013-06-04 19:00:19 -04:00
Daniel Micay
61ac5fdab7 clone: fix docstring
@T and @mut T for T: Const have DeepClone
2013-06-04 18:40:50 -04:00
Matthijs Hofstra
979b037e5a Made fns in the impls for the Atomic structs pub 2013-06-05 00:37:52 +02:00
bors
69511c219c auto merge of #6928 : Blei/rust/fix-constructors, r=bstrie
As part of #3853
2013-06-04 09:37:41 -07:00
Philipp Brüschweiler
1eb3a35094 std::util: fix missed old constructor 2013-06-04 17:29:38 +02:00
Philipp Brüschweiler
3ce75e786d std::util: Modernize NonCopyable constructor
part of #3853
2013-06-04 14:08:25 +02:00
Philipp Brüschweiler
e1c1c059c6 std::io: Modernize some constructors
Part of #3853
2013-06-04 12:47:45 +02:00
Philipp Brüschweiler
34ee63e93b std::cell: Modernize constructors
Part of #3853
2013-06-04 12:03:58 +02:00
Jed Davis
0c9510ac38 Use ABI alignment, not "preferred" alignment, to unify monomorphizations.
See the comment in the added test case for details.
2013-06-04 00:18:48 -07:00
bors
133d451715 auto merge of #6886 : jld/rust/vec-each-ret-fix, r=sanxiyn 2013-06-03 18:55:29 -07:00
Michael Sullivan
d85938f7c8 Make type_is_pod handle structs correctly. Closes #6868. 2013-06-03 17:16:12 -07:00
bors
13aa18891c auto merge of #6910 : Blei/rust/fix-6698, r=pcwalton
Fixes #6698
2013-06-03 15:40:29 -07:00
bors
846545a6e1 auto merge of #6907 : steveklabnik/rust/prelude_docs, r=graydon 2013-06-03 14:37:39 -07:00
bors
8a43b318bf auto merge of #6826 : cmr/rust/terminfo, r=thestinger
This will let *everyone* (non-windows, at least) who can see colors see the glorious colors rustc produces.
2013-06-03 13:34:56 -07:00
Corey Richardson
ae5f3de5f0 Ignore tests that cannot pass on buildbot 2013-06-03 16:05:46 -04:00
Steve Klabnik
fe70361bb6 Add better documentation for the Prelude. 2013-06-03 11:49:06 -07:00
Daniel Micay
e900dba28a rename the Ptr trait to RawPtr
Closes #6607
2013-06-03 13:50:29 -04:00
Philipp Brüschweiler
394ac1aae4 resolve: don't resolve paths that point to non-static methods
Fixes #6698
2013-06-03 13:31:43 +02:00
Philipp Brüschweiler
45441e046b Add test for issue #6698 2013-06-03 13:09:26 +02:00
bors
4f6285fbf9 auto merge of #6903 : dotdash/rust/self_by_value, r=catamorphism
For types that are passed by value, we can't just cast the value to a
pointer, but have to use an alloca and copy the value there. This
handling is already present for all other arguments, but was missing
for "self".

Fixes #6682 #4850 #4878
2013-06-02 22:31:36 -07:00
Brendan Zabarauskas
dee7c5af69 Add traits for concat and connect methods 2013-06-03 13:19:37 +10:00
bors
c40baf68cb auto merge of #6905 : thestinger/rust/ptr, r=catamorphism
The ptr module is intended to be for raw pointers.

Closes #3111
2013-06-02 16:55:33 -07:00
Daniel Micay
454133127a ptr: split out borrowed pointer utilities
The ptr module is intended to be for raw pointers.

Closes #3111
2013-06-02 19:24:33 -04:00
bors
dad945646f auto merge of #6879 : yichoi/rust/arm-test, r=brson
Fix #6353 and better support for ARM Test
2013-06-02 15:49:30 -07:00
Björn Steinbrink
b51f44e21b Fix passing self by value for types passed by value
For types that are passed by value, we can't just cast the value to a
pointer, but have to use an alloca and copy the value there. This
handling is already present for all other arguments, but was missing
for "self".

Fixes #6682, #4850 and #4878
2013-06-03 00:06:09 +02:00
gareth
d443fc6d90 Add a get_mut method to accompany the get method. 2013-06-02 16:22:43 +01:00
bors
c354a0c7eb auto merge of #6896 : nickdesaulniers/rust/issue4501, r=brson
review? @brson
2013-06-01 22:37:35 -07:00
bors
14c331053e auto merge of #6815 : kballard/rust/hashmap-insert_or_modify_with, r=erickt
`std::hashmap::HashMap.insert_or_update_with()` is basically the opposite
of `find_or_insert_with()`. It inserts a given key-value pair if the key
does not already exist, or replaces the existing value with the output
of the passed function if it does.

This is useful because replicating this with existing functionality is awkward, especially with the current borrow-checker. In my own project I have code that looks like

	if match map.find_mut(&key) {
		None => { true }
		Some(x) => { *x += 1; false }
	} {
		map.insert(key, 0);
	}

and it took several iterations to make it look this good. The new function turns this into

    map.insert_or_update_with(key, 0, |_,x| *x += 1);
2013-06-01 21:31:36 -07:00
bors
96f6f29477 auto merge of #6891 : luqmana/rust/unit-struct-drop, r=catamorphism 2013-06-01 20:16:39 -07:00
Luqman Aden
101e3872fe Mark run-pass/unit-like-struct-drop-run.rs as xfast-fail. 2013-06-01 22:35:55 -04:00
bors
fc5debd8fd auto merge of #6807 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Addresses #5681
2013-06-01 19:22:42 -07:00
Tim Chevalier
60126e9365 testsuite: Add an xfailed test case for the new extern mod syntax 2013-06-01 18:48:07 -07:00
Tim Chevalier
c120464be0 rustc/rusti/rustpkg: Infer packages from extern mod directives
This commit won't be quite as useful until I implement RUST_PATH and
until we change `extern mod` to take a general string instead of
an identifier (#5682 and #6407).

With that said, now if you're using rustpkg and a program contains:

extern mod foo;

rustpkg will attempt to search for `foo`, so that you don't have to
provide a -L directory explicitly. In addition, rustpkg will
actually try to build and install `foo`, unless it's already
installed (specifically, I tested that `extern mod extra;` would
not cause it to try to find source for `extra` and compile it
again).

This is as per #5681.

Incidentally, I changed some driver code to infer the link name
from the crate link_meta attributes. If that change isn't ok, say
something. Also, I changed the addl_lib_search_paths field in the
session options to be an @mut ~[Path] so that it can be modified
after expansion but before later phases.
2013-06-01 18:48:07 -07:00
Tim Chevalier
341678b815 rustc: Call str::is_empty 2013-06-01 18:48:07 -07:00
Tim Chevalier
760c71dc4f syntax: Add an each_view_item method on traits 2013-06-01 18:48:07 -07:00
Tim Chevalier
231aea6d6e rustc: Improve astconv error message 2013-06-01 18:48:07 -07:00
Nick Desaulniers
ecd08b989a Swap return value of pipes::init Fixes #4501 2013-06-01 18:19:16 -07:00
Kevin Ballard
75f1b7f96f Add new function hashmap.insert_or_update_with()
fn insert_or_update_with<'a>(&'a mut self,
                             k: K,
                             f: &fn(&K, &mut V)) -> &'a V
2013-06-01 17:38:24 -07:00
Kevin Ballard
7bc950c43c Refactor some hashmap code into a new private function mangle()
Add new private hashmap function

    fn mangle(&mut self,
              k: K,
              not_found: &fn(&K) -> V,
              found: &fn(&K, &mut V)) -> uint

Rewrite find_or_insert() and find_or_insert_with() on top of mangle().

Also take the opportunity to change the return type of find_or_insert()
and find_or_insert_with() to &'a mut V. This fixes #6394.
2013-06-01 17:37:57 -07:00
bors
63417daea4 auto merge of #6885 : erickt/rust/move-callee_id, r=catamorphism
The `callee_id` in `ast::expr` in only used in a couple expression variants. This moves the `callee_id` into those branches to make it more clear when its should be used.

Also, it fixes a bug in a std::run test when there is a symlink in the path rust where was checked out.
2013-06-01 17:13:39 -07:00
Luqman Aden
ddbd1aa883 Add test for #6861 2013-06-01 18:55:49 -04:00
bors
24e85ac82d auto merge of #6880 : thomaslee/rust/issue-6745, r=catamorphism
This fixes #6745, which itself relates to #4202. Slightly ham-fisted -- feel particularly funny about using the typeck phase to gather the base -> impl mapping, and the separate code paths for traits vs. "real" bases feels like it could be avoided -- but it seems to work.

As always, open to suggestions if there's a better way to accomplish what I'm trying to do.

@catamorphism r?
2013-06-01 15:46:40 -07:00
Erick Tryzelaar
23808efd11 syntax: move callee_id into the expr_ variants 2013-06-01 15:31:56 -07:00
Corey Richardson
2d635179f0 Windows fixes 2013-06-01 17:50:26 -04:00
Luqman Aden
64759c9f25 librustc: Have destructor run for unit-like structs. 2013-06-01 17:41:07 -04:00
Jed Davis
c5d7a77a53 Fix vec::each* return values 2013-06-01 11:52:02 -07:00
Erick Tryzelaar
871684376f std: fix run tests when symlink is in the rust checkout path 2013-06-01 10:59:24 -07:00
Corey Richardson
023861cbd1 test fixes 2013-06-01 13:24:58 -04:00