Commit Graph

15904 Commits

Author SHA1 Message Date
Erick Tryzelaar
5ae06ae9de core: convert vec::{tail,tailn} to return references 2013-03-05 19:37:04 -08:00
Erick Tryzelaar
359bb3e10b core: convert vec::{head,head_opt} to return references 2013-03-05 19:37:04 -08:00
Erick Tryzelaar
431e756fd7 rustdoc: change paragraphs fn to take &str 2013-03-05 19:37:04 -08:00
Erick Tryzelaar
ac4016ff99 rustdoc: Remove a unused variable warning 2013-03-05 19:37:04 -08:00
Erick Tryzelaar
d6e583ab10 std: remove an unnecessary copy from workcache 2013-03-05 19:37:04 -08:00
bors
7c9b808d46 auto merge of #5245 : thestinger/rust/trie, r=graydon 2013-03-05 15:57:40 -08:00
Daniel Micay
ab5bc5dffe trie: remove the Copy requirement 2013-03-05 18:53:43 -05:00
bors
dec599f652 auto merge of #5234 : pcwalton/rust/equiv, r=pcwalton
r? @nikomatsakis
2013-03-05 12:12:50 -08:00
bors
4c8e12ea97 auto merge of #5232 : bstrie/rust/issue4448, r=nikomatsakis 2013-03-05 11:09:44 -08:00
Patrick Walton
2fa2ad5995 libcore: Implement an Equiv trait and use it on hashmaps.
7.3x speedup in string map search speed on a microbenchmark of pure hashmap
searching against a constant string, due to the lack of allocations.

I ran into a few snags.

1. The way the coherence check is set up, I can't implement `Equiv<@str>` and
   `Equiv<~str>` for `&str` simultaneously.

2. I wanted to implement `Equiv<T>` for all `T:Eq` (i.e. every type can be
   compared to itself if it implements `Eq`), but the coherence check didn't
   like that either.

3. I couldn't add this to the `Map` trait because `LinearMap` needs special
   handling for its `Q` type parameter: it must not only implement `Equiv<T>`
   but also `Hash` and `Eq`.

4. `find_equiv(&&"foo")` doesn't parse, because of the double ampersand. It has
   to be written `find_equiv(& &"foo")`. We can probably just fix this.

Nevertheless, this is a huge win; it should address a major source of
performance problems, including the one here:

http://maniagnosis.crsr.net/2013/02/creating-letterpress-cheating-program.html
2013-03-05 10:18:36 -08:00
Patrick Walton
c4075492ad librustc: Fix silly bug in AST conversion for const vstores. rs=bugfix
Means that we'll need another snapshot to rid the language of `[const T]`.
2013-03-05 10:18:36 -08:00
Patrick Walton
6d4ed5283c libsyntax: Separate multiple inherited traits with + 2013-03-05 10:18:35 -08:00
bors
e94465c053 auto merge of #5231 : jbclements/rust/better-macro-error-message, r=graydon
Macro invocations with path separators (e.g. foo::bar!()) now produce a sensible error message, rather than an assertion failure. Also added compile-fail test case.

Fixes #5218 ?
2013-03-05 10:06:50 -08:00
bors
afd6196d7b auto merge of #5233 : bstrie/rust/deimpselfcore, r=graydon 2013-03-05 08:12:51 -08:00
bors
5f55a07075 auto merge of #5237 : thestinger/rust/iter, r=nikomatsakis 2013-03-05 07:15:53 -08:00
Daniel Micay
17b5a14c4c trie: fix breaking out of the iterators early 2013-03-05 10:10:22 -05:00
Daniel Micay
f7ae9b1759 trie: fix each_reverse 2013-03-05 09:35:45 -05:00
bors
9ec7f3fa22 auto merge of #5225 : nikomatsakis/rust/issue-5224, r=nikomatsakis
Update region inference for traits so that a method with explicit self doesn't incorrectly cause the entire trait to be tagged as being region-parameterized.

Fixes #5224.

r? @pcwalton
2013-03-05 06:03:43 -08:00
Niko Matsakis
cbfd88a486 Update region inference for traits so that a method with
explicit self doesn't incorrectly cause the entire trait to
be tagged as being region-parameterized.

Fixes #5224.
2013-03-05 08:46:23 -05:00
bors
65986ba0c0 auto merge of #5215 : jld/rust/fn-const-env, r=graydon
Fixes #5210; unblocks #5183.
2013-03-05 03:12:43 -08:00
bors
eddefbc893 auto merge of #5212 : thestinger/rust/iter, r=graydon
A small step towards fixing #2827
2013-03-05 02:06:50 -08:00
bors
75c5bc90d2 auto merge of #5179 : alexcrichton/rust/default-warn-unused-import, r=graydon
I've found that unused imports can often start cluttering a project after a long time, and it's very useful to keep them under control. I don't like how Go forces a compiler error by default and it can't be changed, but I certainly want to know about them so I think that a warn is a good default.

Now that the `unused_imports` lint option is a bit smarter, I think it's possible to change the default level to warn. This commit also removes all unused imports throughout the compiler and libraries (500+).

The only odd things that I ran into were that some `use` statements had to have `#[cfg(notest)]` or `#[cfg(test)]` based on where they were. The ones with `notest` were mostly in core for modules like `cmp` whereas `cfg(test)` was for tests that weren't part of a normal `mod test` module.
2013-03-05 00:57:46 -08:00
bors
71f09813c8 auto merge of #5228 : pcwalton/rust/deriving-clone, r=pcwalton
r? @graydon
2013-03-04 23:57:46 -08:00
Graydon Hoare
ab500d8b8d build fixes 2013-03-04 22:40:59 -08:00
Ben Striegel
9db61e0c21 De-implicit-self libcore 2013-03-04 22:36:15 -05:00
Ben Striegel
deaf3fdf6e Add test for issue #4448 2013-03-04 22:33:51 -05:00
John Clements
fe08364b3b added test case for macros with separators error message 2013-03-04 17:41:38 -08:00
John Clements
a191babbe5 simplified msg (TMI on old one) 2013-03-04 16:50:52 -08:00
John Clements
4f3a968f91 better error message for macros with MOD_SEPs 2013-03-04 16:21:35 -08:00
Patrick Walton
0643df28a3 libsyntax: Implement #[deriving_clone] 2013-03-04 16:13:15 -08:00
bors
dd34178b4b auto merge of #5211 : apasel422/rust/kate, r=graydon
These commits remove some obsolete language features, make some highlighting more correct with respect to the language spec, and introduce highlighting for macros, attributes, core traits, and the new region syntax.
2013-03-04 12:30:51 -08:00
bors
40e733a150 auto merge of #5209 : luqmana/rust/reader, r=graydon 2013-03-04 11:42:39 -08:00
Alex Crichton
cb4ab76e4a Adding missing imports for tests, and gate off others 2013-03-04 12:27:01 -05:00
Alex Crichton
bc3bee410a Add a special FIXME for subduing warnings in rpath.rs 2013-03-04 12:27:01 -05:00
Alex Crichton
dfb5c10dea Remove unused imports throughout src/ 2013-03-04 12:27:01 -05:00
Alex Crichton
55461d888f Change the default level of unused_imports to warn 2013-03-04 12:27:01 -05:00
bors
c639a78dc4 auto merge of #5205 : thestinger/rust/radix, r=graydon
This is an implementation of a map and set for integer keys. It's an ordered container (by byte order, which is sorted order for integers and byte strings when done in the right direction) with O(1) worst-case lookup, removal and insertion. There's no rebalancing or rehashing so it's actually O(1) without amortizing any costs.

The fanout can be adjusted in multiples of 2 from 2-ary through 256-ary, but it's hardcoded at 16-ary because there isn't a way to expose that in the type system yet. To keep things simple, it also only allows `uint` keys, but later I'll expand it to all the built-in integer types and byte arrays.

There's quite a bit of room for performance improvement, along with the boost that will come with dropping the headers on `Owned` `~` and getting rid of the overhead from the stack switches to the allocator. It currently does suffix compression for a single node and then splits into two n-ary trie nodes, which could be replaced with an array for at least 4-8 suffixes before splitting it. There's also the option of doing path compression, which may be a good or a bad idea and depends a lot on the data stored.

I want to share the test suite with the other maps so that's why I haven't duplicated all of the existing integer key tests in this file. I'll send in another pull request to deal with that.

Current benchmark numbers against the other map types:

    TreeMap:
     Sequential integers:
      insert: 0.798295
      search: 0.188931
      remove: 0.435923
     Random integers:
      insert: 1.557661
      search: 0.758325
      remove: 1.720527

    LinearMap:
     Sequential integers:
      insert: 0.272338
      search: 0.141179
      remove: 0.190273
     Random integers:
      insert: 0.293588
      search: 0.162677
      remove: 0.206142

    TrieMap:
     Sequential integers:
      insert: 0.0901
      search: 0.012223
      remove: 0.084139
     Random integers:
      insert: 0.392719
      search: 0.261632
      remove: 0.470401

@graydon is using an earlier version of this for the garbage collection implementation, so that's why I added this to libcore. I left out the `next` and `prev` methods *for now* because I just wanted the essentials first.
2013-03-04 08:21:47 -08:00
Brian Anderson
edcebac1cc There is no function in LLVM called LLVMInitializeMipsAsmLexer 2013-03-03 20:02:06 -08:00
Jyun-Yan You
314605f948 rt: fix some bugs for MIPS target 2013-03-03 20:02:06 -08:00
Jyun-Yan You
c2a61d7df3 rustc: implement MIPS O32 ABI 2013-03-03 20:02:03 -08:00
Jyun-Yan You
5150b9811b rustc: MIPS32 support 2013-03-03 19:27:27 -08:00
Jyun-Yan You
0ecd9e03ff rt: MIPS32 support 2013-03-03 19:27:01 -08:00
Jed Davis
eb1c632201 Add a test case for const fn sizing, just to be safe. 2013-03-03 17:22:51 -08:00
Jed Davis
514fd3efec Assert that constants are translated with the correct size. 2013-03-03 16:40:44 -08:00
Jed Davis
5f0a123f0d Construct const fns based on the type, not the definition.
Otherwise we can add a null environment when we shouldn't.

Fixes #5210.
2013-03-03 16:40:41 -08:00
bors
d30a4f4e67 auto merge of #5207 : erickt/rust/libsyntax-deprecated-self, r=brson
This adds an explicit `&self` to each method in libsyntax, and sets the `#[deny(deprecated_self)]` in `syntax.rc`.
2013-03-03 16:16:00 -08:00
Erick Tryzelaar
690caf8ab8 libsyntax: deny deprecated_self in libsyntax 2013-03-03 15:25:08 -08:00
Erick Tryzelaar
b9d9157883 libsyntax: add &self to extensions 2013-03-03 15:25:08 -08:00
Erick Tryzelaar
4a73426aa2 libsyntax: add &self to parser methods 2013-03-03 15:25:08 -08:00
Patrick Walton
3c23589b08 etc: Suppress another Valgrind issue. rs=burningtree 2013-03-03 10:30:00 -08:00