Commit Graph

1886 Commits

Author SHA1 Message Date
Luqman Aden
625fac3c7e core: Rewrite last_os_error in Rust for windows as well. 2013-02-11 23:49:49 -05:00
Luqman Aden
9877d98b8f core: Rewrite last_os_error in Rust for unix and provide access to errno (unix) and GetLastError (windows). 2013-02-11 23:49:49 -05:00
Zack Corr
0db527e2f8 core: Fix dec/inc_kernel_live_count mixup 2013-02-12 12:27:19 +10:00
Zack Corr
33ae05871c core: Fix files that needed GenericChan/Port from prelude 2013-02-11 12:11:23 +10:00
Brendan Zabarauskas
48b2141b83 Add NumCast trait for generic numeric type casts 2013-02-11 12:33:05 +11:00
Erick Tryzelaar
4fb4a4b66d core: add LinearMap::find_or_insert{,_with}
This allows for inserting a new value into the map only if it doesn't
already exist in the map.
2013-02-10 15:51:25 -08:00
Erick Tryzelaar
849644b5bc core: rename hashmap test functions 2013-02-10 15:51:25 -08:00
Erick Tryzelaar
fed5df8f2e libcore: LinearMap doesn't need to pass around the bucket vec 2013-02-10 15:51:25 -08:00
Daniel Micay
99ff74c1bd make Option's iter method use a lifetime 2013-02-10 16:30:17 -05:00
Zack Corr
4f843763a1 core: Remove GenericChan/Port from prelude. Closes #4762 2013-02-10 18:10:09 +10:00
bors
d90abd5879 auto merge of #4848 : nikomatsakis/rust/issue-4821-bad-kind-computation, r=catamorphism
...ear

values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.

r? @catamorphism
2013-02-09 10:20:55 -08:00
Zack Corr
ebd20b7944 Rename dec/inc_weak_task_count to inc/dec_live_count and remove register_task/unregister_task. Closes #4768 2013-02-09 19:19:31 +10:00
Niko Matsakis
a380df809c Fix subtle error in caching during kind computation that could cause linear
values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.
2013-02-08 07:20:39 -08:00
bors
e5637226d8 auto merge of #4839 : catamorphism/rust/rm-structural-records, r=catamorphism 2013-02-07 23:16:42 -08:00
Tim Chevalier
3b8f1fa2b6 core: Remove structural records from the rest of core, except pipes
That will, sadly, require one more snapshot.
2013-02-07 22:48:57 -08:00
Daniel Micay
9599cc86f0 implement BaseIter for LinearMap 2013-02-07 22:28:58 -05:00
Daniel Micay
3e0a28c7da add a ReverseIter trait 2013-02-07 22:04:38 -05:00
Daniel Micay
e018244777 make Option's map and map_default use a lifetime 2013-02-07 22:04:38 -05:00
Daniel Micay
83270d2d79 rm each method from the Map trait
the map types should implement BaseIter instead
2013-02-07 22:04:35 -05:00
Tim Chevalier
9123c58526 core: Remove transitional code 2013-02-07 18:26:43 -08:00
Patrick Walton
472797b04a librustc: Lots of de-muting. rs=demuting 2013-02-07 16:17:39 -08:00
Brian Anderson
6e9298ab88 Merge pull request #4619 from brson/exchange
Some work on freestanding Rust: foreign calls, exchange allocator
2013-02-07 13:46:10 -08:00
Niko Matsakis
a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
bors
951ad11d68 auto merge of #4815 : thestinger/rust/treemap, r=pcwalton
5283a8b reworks the TreeMap lazy iterator to use `&mut` again, which closes #4763. It gets the performance of the set methods back in the same ballpark that it was pre-INHTWAMA which is nice. These can be turned back into methods eventually.

e5b6334 removes the transitional smallintmap attributes which closes #4737.
2013-02-06 22:57:08 -08:00
bors
2df473dc69 auto merge of #4801 : z0w0/rust/randomtrait, r=graydon
Also adds Rng::gen() for generically generating any type that implements the Rand trait. There's no way to generate things with a length (for e.g. strings or vectors), because I can't think of an elegant way to do that. Maybe have a RandLen trait that inherits Rand?

This can be used for a quickcheck mechanism I'm working on.
2013-02-06 21:04:37 -08:00
Daniel Micay
b91a51daca remove issue #3148 workarounds (no longer needed) 2013-02-06 17:37:56 -05:00
Brian Anderson
e43c5bdc6b Rewrite the exchange allocator to work without an active scheduler. #4457 2013-02-06 14:27:36 -08:00
Tim Chevalier
33e2c979ce Merge branch 'incoming' into removing 2013-02-05 10:33:35 -08:00
Tim Chevalier
2dcb3ed745 Merge 2013-02-05 10:33:28 -08:00
bors
e72c917f71 auto merge of #4793 : brson/rust/ignore_exclusive_unwrap_conflict, r=brson 2013-02-05 05:21:28 -08:00
Zack Corr
abd29e5ead core: Add a rand::Rand trait that is implemented by types that can be
randomly generated
Also adds Rng::gen() for generating any type that implements the Rand
trait
2013-02-05 22:56:40 +10:00
bors
6e0f05b059 auto merge of #4790 : pcwalton/rust/at-readers, r=pcwalton 2013-02-05 02:09:29 -08:00
Tim Chevalier
2f46b763da core/syntax: Staging fixes 2013-02-04 17:42:19 -08:00
Tim Chevalier
e22aa029fb core/syntax: Add transitional code for pipes 2013-02-04 15:18:53 -08:00
Brian Anderson
8dfab498ef Ignore test exclusive_unwrap_conflict. #4689 2013-02-04 14:19:19 -08:00
bors
eb28ce01ed automated merge 2013-02-04 13:35:37 -08:00
Patrick Walton
7d5322cf09 libcore: Add @ to Readers 2013-02-04 13:33:17 -08:00
Erick Tryzelaar
159568eab5 core: Flesh out the either traits 2013-02-03 21:55:51 -08:00
Erick Tryzelaar
f4ed7d9b6e core: export either::{Either,Left,Right} from the prelude 2013-02-03 21:55:51 -08:00
Erick Tryzelaar
31404364e1 core: sort each prelude.rs section 2013-02-03 21:55:51 -08:00
Erick Tryzelaar
9adfa59d8e core: convert ToStr::to_str to take explicit &self 2013-02-03 20:47:26 -08:00
Marvin Löbel
eeb89c5012 Solved float, f32 and f64 to_str_radix() special value ambiguity.
Calling it on a special value now causes a failure, however `to_str_radix_special()` is provided which can be
used if those values are expected, and which returns a tupel to allow differentating them.
2013-02-03 15:37:25 -08:00
Marvin Löbel
974d5ac1e0 Fixed errors resulting from rebase. 2013-02-03 15:37:25 -08:00
Marvin Löbel
af4972f3ce Fixed fmt!, tests, doc-tests. 2013-02-03 15:37:25 -08:00
Marvin Löbel
98445d95d4 Removed wrong/wip doc 2013-02-03 15:37:25 -08:00
Marvin Löbel
a612e49a21 Converted the floating point types to the new string conversion functions.
Also fixed all conflicting calls of the old functions in the rest of the codebase.

The set of string conversion functions for each float type now consists of those items:
- to_str(), converts to number in base 10
- to_str_hex(), converts to number in base 16
- to_str_radix(), converts to number in given radix
- to_str_exact(), converts to number in base 10 with a exact number of trailing digits
- to_str_digits(), converts to number in base 10 with a maximum number of trailing digits
- implementations for to_str::ToStr and num::ToStrRadix
- from_str(), parses a string as number in base 10 including decimal exponent and special values
- from_str_hex(), parses a string as a number in base 16 including binary exponent and special values
- from_str_radix(), parses a string as a number in a given base excluding any exponent and special values
- implementations for from_str::FromStr and num::FromStrRadix
2013-02-03 15:37:24 -08:00
Marvin Löbel
7113fd150a Fixed tests still using old integer to_str
Fixed integer tests
2013-02-03 15:37:24 -08:00
Marvin Löbel
eb19462104 Converted libcore/uint-template.rs to the new string functions.
- Moved ToStr implementation of unsigned integers to uint-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added uint-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Marvin Löbel
26e72bf92b Converted libcore/int-template.rs to the new string functions.
- Moved ToStr implementation of integers to int-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added int-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Marvin Löbel
5b0335ec8e Added generic string <-> number conversion functions to core::num.
They unify the different implementations that exists in int-template.rs, uint-template.rs and float.rs into one pair of functions, which are also in principle usable for anything that implements the necessary numeric traits. Their usage is somewhat complex due to the large amount of arguments each one takes, but as they're not meant to be used directly that shouldn't be a problem.
2013-02-03 15:37:24 -08:00
Marvin Löbel
bb9c3ed876 Added some generic number functions to core::num
Also fixes previous commit not compiling due to not finding Option.
2013-02-03 15:37:24 -08:00
Marvin Löbel
05d83017ec Added char::from_digit(), char::is_digit_radix() and an argument check to char::to_digit(). 2013-02-03 15:37:24 -08:00
Marvin Löbel
d13b23f37e Added ToStrRadix and FromStrRadix traits 2013-02-03 15:37:24 -08:00
Marvin Löbel
96f0512a45 Added Round trait to core 2013-02-03 15:37:23 -08:00
Marvin Löbel
40f0b45f8e Moved all numeric modules in core into own directory
Reason: Better grouping of related modules, future-proving for a more extensive math library.
2013-02-03 15:37:23 -08:00
Brian Anderson
4f6516969e rt: Remove ports 2013-02-01 21:22:49 -08:00
Brian Anderson
542bf20414 core: Remove oldcomm 2013-02-01 21:22:49 -08:00
Nick Desaulniers
7868b6bf55 Remove fail keyword from lexer & parser and clean up remaining calls to
fail

Fix merge conflicts - Issue 4524
2013-02-01 00:15:42 -08:00
Nick Desaulniers
6fb4239bb3 Replace most invocations of fail keyword with die! macro 2013-01-31 22:25:12 -08:00
Nick Desaulniers
aee7929469 Replace most invocations of fail keyword with die! macro 2013-01-31 20:12:49 -08:00
Tim Chevalier
a9587b8fcd core: Remove transitional code 2013-01-31 19:35:57 -08:00
Tim Chevalier
845b06542e messing around with pipes and stages 2013-01-31 19:35:56 -08:00
Tim Chevalier
e0281d991c core: Stamp out XXXes (comments only) 2013-01-31 19:34:46 -08:00
Brian Anderson
5aacf791e8 Merge pull request #4706 from sanxiyn/cleanup-fixme
Cleanup FIXMEs (#3488)
2013-01-31 17:00:27 -08:00
Brian Anderson
c95c7c87b1 Merge pull request #4702 from aydinkim/patch-1
Delete unnecessary logs
2013-01-31 16:57:30 -08:00
Niko Matsakis
0682ad0eb9 Finalize moves-based-on-type implementation.
Changes:

- Refactor move mode computation
- Removes move mode arguments, unary move, capture clauses
  (though they still parse for backwards compatibility)
- Simplify how moves are handled in trans
- Fix a number of illegal copies that cropped up
- Workaround for bug involving def-ids in params
  (see details below)

Future work (I'll open bugs for these...):

- Improve error messages for moves that are due
  to bindings
- Add support for moving owned content like a.b.c
  to borrow check, test in trans (but I think it'll
  "just work")
- Proper fix for def-ids in params

Def ids in params:

Move captures into a map instead of recomputing.

This is a workaround for a larger bug having to do with the def-ids associated
with ty_params, which are not always properly preserved when inlining.  I am
not sure of my preferred fix for the larger bug yet.  This current fix removes
the only code in trans that I know of which relies on ty_param def-ids, but
feels fragile.
2013-01-31 12:09:00 -08:00
Seo Sanghyeon
7b268e8316 Cleanup FIXMEs (#3488) 2013-01-31 19:23:18 +09:00
Aydin Kim
6102d2abf2 Delete unnecessary logs 2013-01-31 15:47:44 +09:00
Patrick Walton
366812a5c3 librustc: Change self as a type to Self everywhere. r=brson 2013-01-30 19:52:45 -08:00
Graydon Hoare
4030aaff20 rustc: make integral type inference transactional, close #3211, close #4401, close #3398. 2013-01-30 16:21:19 -08:00
Tim Chevalier
77f2aac389 Merge pull request #4687 from alexcrichton/hashmap-speedup
Use task local random when initializing LinearMap
2013-01-30 14:48:49 -08:00
Cody Schroeder
b505504dc4 Add test for float::round 2013-01-30 01:28:04 -08:00
Alex Crichton
c75e59ac0f Use task local random when initializing maps 2013-01-30 02:49:58 -05:00
Patrick Walton
28ed9dc09e librustc: Long lines. rs=burning 2013-01-29 22:40:13 -08:00
Patrick Walton
0c1d9befb3 librustc: Speed up byte copy operations. r=nmatsakis 2013-01-29 22:15:06 -08:00
Patrick Walton
1b613ff9fc librustc: Strdup unique strings instead of copying in byte by byte. Shaves 2MB off librustc at -O0. 2013-01-29 22:14:08 -08:00
Tim Chevalier
4b8dfad5cd core tests: Add use vec; directive inside core::hashmap tests
This is probably to work around a bug.
2013-01-29 20:43:44 -08:00
Tim Chevalier
b927e48a26 Merge pull request #4682 from thestinger/treemap
Set trait improvements + minor treemap cleanup
2013-01-29 20:09:15 -08:00
Tim Chevalier
0aef28dd6d De-capitalize "note" to get rid of spurious tidy warnings 2013-01-29 19:26:55 -08:00
Daniel Micay
6b08683e15 add intersection and union to the Set trait 2013-01-29 22:24:00 -05:00
Daniel Micay
99eb4ddddd add difference and symmetric_difference to Set 2013-01-29 21:59:58 -05:00
Daniel Micay
42cafcee2c add is_disjoint to the Set trait 2013-01-29 21:30:55 -05:00
Daniel Micay
bfa9c9a00f add is_subset and is_superset to the Set trait 2013-01-29 21:30:55 -05:00
Patrick Walton
d0391c5b09 libcore: De-export libcore. rs=deexporting 2013-01-29 11:48:46 -08:00
Tim Chevalier
1b021d5868 Long line 2013-01-29 11:44:46 -08:00
Patrick Walton
226cd68f13 librustc: De-implicit-self the visitor. r=graydon 2013-01-29 10:43:12 -08:00
Patrick Walton
6ce74460e6 librustc: Disallow trait bounds in types, enumerations, and structure definitions. r=tjc 2013-01-29 10:42:58 -08:00
Patrick Walton
eb4d39e1fe libstd: Remove "dual impls" from the language and enforce coherence rules. r=brson
"Dual impls" are impls that are both type implementations and trait
implementations. They can lead to ambiguity and so this patch removes them
from the language.

This also enforces coherence rules. Without this patch, records can implement
traits not defined in the current crate. This patch fixes this, and updates
all of rustc to adhere to the new enforcement. Most of this patch is fixing
rustc to obey the coherence rules, which involves converting a bunch of records
to structs.
2013-01-29 10:42:45 -08:00
Alex Crichton
810eeef444 Fix the len() method on LinearMap during popping 2013-01-29 11:16:39 -05:00
Tim Chevalier
c5461e46ae core: Allow legacy records in in a few modules
Because of macros, #[allow(structural_records]] in
extfmt, gc, os, pipes, and run. Will need a snapshot.
2013-01-28 19:41:56 -08:00
Brian Anderson
a72aeef9f7 Revert readline optimization and add test 2013-01-28 19:32:02 -08:00
Michael Neumann
d38939c7e8 Slightly optimize read_line()
No need to allocate an additional vector. Instead directly push into the
string.
2013-01-28 14:40:11 -08:00
Michael Neumann
02de11c1e7 Fix example code 2013-01-28 14:40:11 -08:00
Daniel Micay
8eaf0737b7 get rid of LinearMap's find_copy method 2013-01-28 16:06:09 -05:00
Brian Anderson
83ca034d2e Merge remote-tracking branch 'brson/nocommupstream2' 2013-01-26 14:57:58 -08:00
Tim Chevalier
0743cec023 core: Remove structural records in library tests 2013-01-26 11:35:17 -08:00
Tyler Bindon
3a5d2cdbf3 Fix Option camel case in comments 2013-01-25 19:42:23 -07:00
Brian Anderson
1ef83945c1 Merge remote-tracking branch 'brson/nocommupstream'
Conflicts:
	src/libcore/private.rs
	src/libcore/task/mod.rs
	src/libcore/task/spawn.rs
	src/libstd/net_tcp.rs
	src/libstd/uv_global_loop.rs
	src/libstd/uv_iotask.rs
2013-01-25 18:06:30 -08:00
Tim Chevalier
85a34c2898 Merge pull request #4625 from thestinger/container
more little container improvements
2013-01-25 11:57:51 -08:00
Tim Chevalier
2d33e308ac core: Mop up Windows breakage 2013-01-24 20:39:09 -08:00