Commit Graph

34651 Commits

Author SHA1 Message Date
Josh Stone
e94912aa85 vim: move 'move' to rustStorage 2014-11-10 13:48:17 -08:00
Vitali Haravy
c254957078 Attempt to fix the problem with failing distcheck. 2014-11-10 21:05:34 +00:00
bors
f89e975685 auto merge of #18287 : michaelsproul/rust/triemap-collection-views, r=bstrie
I've implemented the new collection views API for TrieMap. I more or less followed the approach set out by @Gankro in BTreeMap, by using a `SearchStack`. There's quite a bit of unsafe code, but I've wrapped it safely where I think is appropriate. I've added tests to ensure everything works, and performance seems quite good.

```
test trie::bench_map::bench_find                           ... bench:     67879 ns/iter (+/- 4192)
test trie::bench_map::bench_find_entry                     ... bench:    186814 ns/iter (+/- 18748)
test trie::bench_map::bench_insert_large                   ... bench:    716612 ns/iter (+/- 160121)
test trie::bench_map::bench_insert_large_entry             ... bench:    851219 ns/iter (+/- 20331)
test trie::bench_map::bench_remove                         ... bench:    838856 ns/iter (+/- 27998)
test trie::bench_map::bench_remove_entry                   ... bench:    981711 ns/iter (+/- 53046)
```

Using an entry is slow compared to a plain find, but is only ~15% slower for inserts and removes, which is where this API is most useful. I'm tempted to remove the standalone `remove` function in favour of an entry-based approach (to cut down on complexity).

I've added some more comments to the general part of the code-base, which will hopefully help the next person looking over this. I moved the three key structures to the top of the file so that the nesting structure is clearly visible, and renamed `Child<T>` to `TrieNode<T>` and `TrieNode<T>` to `InternalNode<T>` to improve clarity. If these changes are creeping, I'm happy to revert them.

Let me know if my use of `fail!` is ok, I was a little unsure of how specific to be. Some of the data-structures have various invariants that shouldn't be broken, so using `fail!` seemed appropriate.

## Still to do

* Modernise iterators (make them double-ended).
* Make the keys generic, or rename this data-structure (see: https://github.com/rust-lang/rust/issues/14902).
* Possibly move this code out of libcollections. [Searching Github for TrieMap turns up very few real results.][triemap-search]

Related issues: https://github.com/rust-lang/rust/issues/18009 and https://github.com/rust-lang/rust/issues/17320

[triemap-search]: https://github.com/search?utf8=%E2%9C%93&q=TrieMap+language%3ARust&type=Code&ref=searchresults
2014-11-10 20:21:53 +00:00
Michael Sproul
f52e2bd32f Implement collection views API for TrieMap. 2014-11-10 10:39:44 -08:00
Michael Gehring
f54f8b3c29 Fix 'renamed lint' warnings 2014-11-10 17:28:23 +01:00
bors
a30b72bb14 auto merge of #18802 : bkoropoff/rust/issue-18769, r=luqmana
Drill down the loan path for `McDeclared` references as well since it might lead to an upvar.  Closes #18769
2014-11-10 16:12:03 +00:00
bors
f18757305a auto merge of #18795 : haberman/rust/master, r=cmr
Previously Int inherited from PartialOrd (via Primitive)
but not Ord.  But integers have a total order, so
inheriting from Ord is appropriate. Fixes #18776.
2014-11-10 14:07:00 +00:00
Manish Goregaokar
37afc528ea Document ast::Ty_ 2014-11-10 19:14:04 +05:30
bors
221115ceee auto merge of #18792 : sfackler/rust/struct-variants, r=alexcrichton
We need a snapshot before the parser can be adjusted.
2014-11-10 11:06:54 +00:00
Jeff Parsons
2df9a085bd Rogue 'panic' -> 'fail' in guide.
Should refer to handling panicking tasks like any other computation
that may _fail_, not any other computation that may _panic_.
2014-11-10 21:20:11 +11:00
Adam Szkoda
1d01f3715a Fix broken documentation link 2014-11-10 08:22:10 +01:00
bors
830c82dd74 auto merge of #18782 : netvl/rust/update-vim-syntax, r=alexcrichton
`as` (already for a long time) and `move` (which was only added recently, AFAIK) are not marked as keywords in Vim syntax file, so they are not highlighted as keywords in Rust sources. This PR fixes this.
2014-11-10 07:01:49 +00:00
bors
e575cff77d auto merge of #18781 : klutzy/rust/cross, r=cmr
cc #12859
2014-11-10 04:41:49 +00:00
Ariel Ben-Yehuda
85f1262c18 Use FnvHashMap instead of HashMap in rustc 2014-11-10 01:12:59 +02:00
bors
809cd0c89e auto merge of #18780 : bkoropoff/rust/regionck-for-loop, r=eddyb
Use the mem-cat of the iterator element type rather than the iterator itself when processing the for loop pattern.

Closes #17068
Closes #18767
2014-11-09 22:31:44 +00:00
bors
507927299a auto merge of #18739 : vhbit/rust/issue-18574, r=alexcrichton
Fixes #18574
2014-11-09 20:01:44 +00:00
Vladimir Matveev
3961eaec85 Added move keyword and renamed fail to panic 2014-11-09 21:10:08 +03:00
bors
efc9a441b9 auto merge of #18762 : mdinger/rust/str_coerce, r=steveklbanik
I had slight confusion when using this as a reference and was told it was imprecise. Most of the rewording was suggested by @huonw.

cc @steveklabnik
2014-11-09 17:06:45 +00:00
Colin Sherratt
477155e638 Add Encodable and Decodable for VecMap 2014-11-09 11:31:33 -05:00
Piotr Czarnecki
a3208246f1 Fix ICEs that involved quasi-quotation
* fixed get_tt for doc comments
* properly handle MatchNt in `quote`

Fixes #18763
Fixes #18775
2014-11-09 16:34:04 +01:00
bors
eeca3c7b4c auto merge of #18756 : jbcrail/rust/add-enum-set-bitxor, r=alexcrichton
I implemented BitXor, and also added tests for BitAnd and BitXor.

cc #18424
2014-11-09 15:11:43 +00:00
bors
946225d77f auto merge of #18755 : japaric/rust/ord, r=alexcrichton
Closes #18738
cc #15689

r? @alexcrichton 
cc @cmr
2014-11-09 12:31:40 +00:00
Steven Fackler
00741a2c27 First stage of struct variant field visibility changes
We need a snapshot before the parser can be adjusted.
2014-11-09 00:30:04 -08:00
bors
a6b70914b6 auto merge of #18748 : carols10cents/rust/prepend-to-append, r=alexcrichton
A most trivial documentation correction. The examples in the intro are all about adding to the end of the array, not the beginning, but this one line says "prepend".

This isn't a very serious problem, it just made me a bit confused when I got to it.
2014-11-09 07:46:41 +00:00
bors
16d80de231 auto merge of #18557 : aturon/rust/io-removal, r=alexcrichton
This PR includes a sequence of commits that gradually dismantles the `librustrt` `rtio` system -- the main trait previously used to abstract over green and native io. It also largely dismantles `libnative`, moving much of its code into `libstd` and refactoring as it does so.

TL;DR:

* Before this PR: `rustc hello.rs && wc -c hello` produces 715,996
* After this PR:  `rustc hello.rs && wc -c hello` produces 368,100

That is, this PR reduces the footprint of hello world by ~50%.

This is a major step toward #17325 (i.e. toward implementing the [runtime removal RFC](https://github.com/rust-lang/rfcs/pull/230).) What remains is to pull out the scheduling, synchronization and task infrastructure, and to remove `libgreen`. These will be done soon in a follow-up PR.

Part of the work here is eliminating the `rtio` abstraction, which in many cases means bringing the implementation of io closer to the actual API presented in `std::io`.

Another aspect of this PR is the creation of two new, *private* modules within `std` that implement io:

* The `sys` module, which represents a platform-specific implementation of a number of low-level abstractions that are used directly within `std::io` and `std::os`. These "abstractions" are left largely the same as they were in `libnative` (except for the removal of `Arc` in file descriptors), but they are expected to evolve greatly over time. Organizationally, there are `sys/unix/` and `sys/windows/` directories which both implement the entire `sys` module hierarchy; this means that nearly all of the platform-specific code is isolated and you can get a handle on each platform in isolation.

* The `sys_common` module, which is rooted at `sys/common`, and provides a few pieces of private, low-level, but cross-platform functionality.

In the long term, the `sys` modules will provide hooks for exposing high-level platform-specific APIs as part of `libstd`. The first such API will be access to file descriptors from `std::io` abstractions, but a bit of design work remains before that step can be taken. 

The `sys_common` module includes some traits (like `AsFileDesc`) which allow communication of private details between modules in disparate locations in the hierarchy; this helps overcome the relatively simple hierarchical privacy system in Rust.

To emphasize: the organization in `sys` is *very preliminary* and the main goal was to migrate away from `rtio` as quickly and simply as possible. The design will certainly evolve over time, and all of the details are currently private.

Along the way, this PR also entirely removes signal handling, since it was only supported on `librustuv` which was removed a while ago. 

Because of the removal of APIs from `libnative` and `librustrt`, and the removal of signal handling, this is a:

[breaking-change]

Some of these APIs will return in public from from `std` over time.

r? @alexcrichton
2014-11-09 05:51:44 +00:00
Brian Koropoff
c0a7d557db Update test to cover #18769 2014-11-08 21:51:02 -08:00
Brian Koropoff
fb4e618c33 Fix upvars sometimes not being marked as used mutably
Drill down the loan path for McDeclared references as well since
it might lead to an upvar.  Closes #18769
2014-11-08 21:49:29 -08:00
Aaron Turon
5ea09e6a25 Ignore sepcomp-lib-lto on android due to linker weirdness 2014-11-08 20:59:59 -08:00
Aaron Turon
0bea593ea2 Remove somewhat bogus process-spawn-errno test (non-mac, non-windows only) 2014-11-08 20:40:39 -08:00
Aaron Turon
fa94fdad3e Runtime removal: fully remove rtio
This patch cleans up the remnants of the runtime IO interface.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:39 -08:00
Aaron Turon
431dcdc840 Runtime removal: refactor tty
This patch continues runtime removal by moving the tty implementations
into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:39 -08:00
Aaron Turon
b8f1193bb1 Runtime removal: refactor timer
This patch continues runtime removal by moving out timer-related code
into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:39 -08:00
Aaron Turon
0f98e75b69 Runtime removal: refactor process
This patch continues the runtime removal by moving and refactoring the
process implementation into the new `sys` module.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:39 -08:00
Aaron Turon
3d195482a4 Runtime removal: refactor helper threads
This patch continues the runtime removal by moving
libnative::io::helper_thread into sys::helper_signal and
sys_common::helper_thread

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:38 -08:00
Aaron Turon
d34b1b0ca9 Runtime removal: refactor pipes and networking
This patch continues the runtime removal by moving pipe and
networking-related code into `sys`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:38 -08:00
Aaron Turon
0c1e1ff1e3 Runtime removal: refactor fs
This moves the filesystem implementation from libnative into the new
`sys` modules, refactoring along the way and hooking into `std::io::fs`.

Because this eliminates APIs in `libnative` and `librustrt`, it is a:

[breaking-change]

This functionality is likely to be available publicly, in some form,
from `std` in the future.
2014-11-08 20:40:38 -08:00
Aaron Turon
16470cf01b Remove signal handling.
Since signal handling was only implemented through librustuv, which is
now gone, there's no reason to even provide the API.

[breaking-change]
2014-11-08 20:40:38 -08:00
Aaron Turon
3a527f2b33 Runtime removal: add private sys, sys_common modules
These modules will house the code that used to be part of the runtime system
in libnative. The `sys_common` module contains a few low-level but
cross-platform details. The `sys` module is set up using `#[cfg()]` to
include either a unix or windows implementation of a common API
surface. This API surface is *not* exported directly in `libstd`, but is
instead used to bulid `std::os` and `std::io`.

Ultimately, the low-level details in `sys` will be exposed in a
controlled way through a separate platform-specific surface, but that
setup is not part of this patch.
2014-11-08 20:40:38 -08:00
bors
a2f303ad09 auto merge of #18743 : nikomatsakis/rust/hrtb-refactor-2, r=pcwalton
Various miscellaneous changes pushing towards HRTB support:

1. Update parser and adjust ast to support `for<'a,'b>` syntax, both in closures and trait bounds. Warn on the old syntax (not error, for stage0).
2. Refactor TyTrait representation to include a TraitRef.
3. Purge `once_fns` feature gate and `once` keyword.

r? @pcwalton 

This is a [breaking-change]:

- The `once_fns` feature is now officially deprecated. Rewrite using normal closures or unboxed closures.
- The new `for`-based syntax now issues warnings (but not yet errors):
  - `fn<'a>(T) -> U` becomes `for<'a> fn(T) -> U`
  - `<'a> |T| -> U` becomes `for<'a> |T| -> U`
2014-11-09 03:51:41 +00:00
Vadim Chugunov
cb2328f839 Include some of the more popular Windows import libs into the bundle. 2014-11-08 19:47:37 -08:00
Josh Haberman
a7533b8a6b Make Int inherit from Ord.
Previously Int inherited from PartialOrd (via Primitive)
but not Ord.  But integers have a total order, so
inheriting from Ord is appropriate. Fixes #18776.
2014-11-08 22:34:19 -05:00
Vadim Chugunov
ad777778d4 Prefer bundled linker. 2014-11-08 18:33:42 -08:00
Vadim Chugunov
5cd4862c69 Move gcc back to rustlib\<triple>\bin 2014-11-08 18:33:41 -08:00
Vadim Chugunov
3d9a346aa3 As of 4.9.2, gcc started passing -fno-lto to collect2, or to ld if collect2 cannot be found. The latter is the case for our bundles, because we don't include collect2. Unfortunately, ld does not understand this option and errors out.
On the bright side, -fno-use-linker-plugin still works to suppress gcc's LTO, so we can drop -fno-lto.
2014-11-08 18:33:40 -08:00
bors
93c85eb8bd auto merge of #18730 : bkoropoff/rust/issue-18652, r=eddyb
`FnOnce` environments that fit within an `int` are passed to the closure by value.  For some reason there was an assert that this would only happen if there were 1 or 0 free variables, but it can also happen if there are multiple variables that happen to fit.

Closes #18652
2014-11-08 23:56:39 +00:00
bors
f0ca717c64 auto merge of #18475 : gamazeps/rust/toExtend, r=alexcrichton
Ensured that Extend & FromIterator are implemented for the libcollection.

Removed the fact that FromIterator had to be implemented in order to implement Extend, as it did not make sense for LruCache (it needs to be given a size and there are no Default for LruCache).

Changed the name from Extend to Extendable.

Part of #18424
2014-11-08 21:06:37 +00:00
klutzy
1df6be1926 mk: Fix Windows cross-build prefix 2014-11-09 04:26:18 +09:00
Brian Koropoff
a553c2d3bc Add regression for #18767 2014-11-08 11:07:28 -08:00
Brian Koropoff
472e0cf8f3 Add regression for #17068 2014-11-08 11:07:28 -08:00
Brian Koropoff
fbc2e92caa Fix handling of for loop patterns in regionck
When establishing region links within a pattern, use the mem-cat
of the type the pattern matches against (that is, the result
of `iter.next()`) rather than that of the iterator type.

Closes #17068
Closes #18767
2014-11-08 11:07:28 -08:00