Commit Graph

24102 Commits

Author SHA1 Message Date
Alex Crichton 7dcc066bd2 Remove unused std::routine 2013-11-26 15:19:41 -08:00
bors 18687a92ae auto merge of #10649 : sfackler/rust/multi-macro, r=alexcrichton
The majority of this change is modifying some of the `ast_visit` methods to return multiple values.

It's prohibitively expensive to allocate a `~[Foo]` every time a statement, declaration, item, etc is visited, especially since the vast majority will have 0 or 1 elements. I've added a `SmallVector` class that avoids allocation in the 0 and 1 element cases to take care of that.
2013-11-26 14:52:05 -08:00
Steven Fackler c403c1f18e Clean up SmallVector use a bit 2013-11-26 13:56:02 -08:00
Steven Fackler c144752a2d Support multiple item macros
Closes #4375
2013-11-26 13:56:02 -08:00
Steven Fackler 09f84aa8f4 Add SmallVector to libsyntax 2013-11-26 13:54:00 -08:00
bors 35ebf03489 auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchton
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 13:32:43 -08:00
bors e9a1869a5f auto merge of #10581 : pcwalton/rust/dedo, r=pcwalton
r? @alexcrichton
2013-11-26 12:13:03 -08:00
Daniel Micay a5af479bb4 add a thread_local feature gate 2013-11-26 14:49:14 -05:00
Daniel Micay 2cf3d8adf2 port the runtime to `#[thread_local]` 2013-11-26 14:49:14 -05:00
Daniel Micay 1795ae4e8a add `#[thread_local]` attribute
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 14:49:10 -05:00
Patrick Walton 9521551b47 librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00
bors 9f9efae790 auto merge of #10673 : klutzy/rust/quite, r=alexcrichton 2013-11-26 10:57:01 -08:00
Jed Davis 792077274c Remove the unused obsolete enum_discrim type. 2013-11-26 10:54:35 -08:00
bors e03f17eb21 auto merge of #10664 : alexcrichton/rust/issue-10663, r=luqmana
It turns out that libuv was returning ENOSPC to us in our usage of the
uv_ipX_name functions. It also turns out that there may be an off-by-one in
libuv. For now just add one to the buffer size and handle the return value
correctly.

Closes #10663
2013-11-26 09:17:58 -08:00
Alex Crichton 7f3501275d Correctly handle libuv errors in addrinfo calls
It turns out that libuv was returning ENOSPC to us in our usage of the
uv_ipX_name functions. It also turns out that there may be an off-by-one in
libuv. For now just add one to the buffer size and handle the return value
correctly.

Closes #10663
2013-11-26 09:10:10 -08:00
Patrick Walton 151b7ed52d libstd: Fix Win32 and other bustage. 2013-11-26 08:25:27 -08:00
Patrick Walton 749ee53c6d librustc: Make `||` lambdas not infer to `proc`s 2013-11-26 08:25:27 -08:00
Patrick Walton 38efa17bb8 test: Remove all remaining non-procedure uses of `do`. 2013-11-26 08:25:27 -08:00
Patrick Walton f571e46ddb test: Remove non-procedure uses of `do` from compiletest, libstd tests,
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26 08:25:27 -08:00
Patrick Walton 8ceb374ab7 librustc: Remove non-procedure uses of `do` from librustc, librustdoc,
and librustpkg.
2013-11-26 08:25:00 -08:00
Patrick Walton efc512362b libsyntax: Remove all non-`proc` `do` syntax. 2013-11-26 08:24:18 -08:00
Patrick Walton a61a3678eb librustuv: Remove all non-`proc` uses of `do` from `libextra` and
`librustuv`.
2013-11-26 08:24:18 -08:00
Patrick Walton 1eca34de7d libstd: Remove all non-`proc` uses of `do` from libstd 2013-11-26 08:23:57 -08:00
Patrick Walton 6801bc8f55 libsyntax: Remove the old-style borrowed closure type syntax from the
language.
2013-11-26 08:20:59 -08:00
Patrick Walton 9e610573ba librustc: Remove remaining uses of `&fn()` in favor of `||`. 2013-11-26 08:20:58 -08:00
Patrick Walton 406813957b test: Remove most uses of `&fn()` from the tests. 2013-11-26 08:19:00 -08:00
bors ef70b7666e auto merge of #10668 : vky/rust/closure-doc-update, r=alexcrichton 2013-11-26 04:56:49 -08:00
klutzy 5b429622be Turn off attribute_usage warning on check-fast 2013-11-26 20:57:26 +09:00
bors 4fe1296511 auto merge of #10660 : alexcrichton/rust/little-scope, r=pcwalton
This moves the locking/waiting methods to returning an RAII struct instead of
relying on closures. Additionally, this changes the methods to all take
'&mut self' to discourage recursive locking. The new method to block is to call
`wait` on the returned RAII structure instead of calling it on the lock itself
(this enforces that the lock is held).

At the same time, this improves the Mutex interface a bit by allowing
destruction of non-initialized members and by allowing construction of an empty
mutex (nothing initialized inside).
2013-11-26 02:52:04 -08:00
bors 21990cdda6 auto merge of #10622 : Kimundi/rust/str_de_iter, r=alexcrichton
This PR removes almost all `_iter` suffixes in various APIs of the codebase that return Iterators, as discussed in #9440.

As a summarize for the intend behind this PR:

- Iterators are the recommended way to provide a potentially lazy list of values, no need to name them painfully verbose. If anything, functions that return a specific container type should have more verbose names.
- We have a static type system, so no need to encode the return value of a constructor function into its name.

Following is a possibly incomplete list of all renamings I performed in the codebase. For a few of them I'm a bit unsure whether the new name still properly expresses their functionality, so feedback would be welcome:

~~~
&str : word_iter()             -> words()
       line_iter()             -> lines()
       any_line_iter()         -> lines_any()
       iter()                  -> chars()
       char_offset_iter()      -> char_indices()
       byte_iter()             -> bytes()
       split_iter()            -> split()
       splitn_iter()           -> splitn()
       split_str_iter()        -> split_str()
       split_terminator_iter() -> split_terminator()
       matches_index_iter()    -> match_indices()
       nfd_iter()              -> nfd_chars()
       nfkd_iter()             -> nfkd_chars()
      
&[T] : split_iter()        -> split()
       splitn_iter()       -> splitn()
       window_iter()       -> windows()
       chunk_iter()        -> chunks()
       permutations_iter() -> permutations()
      
extra:bitv::Bitv :  rev_liter()    -> rev_iter()
                    common_iter()  -> commons()
                    outlier_iter() -> outliers()

extra::treemap::{...} : lower_bound_iter() -> lower_bound()
                        upper_bound_iter() -> upper_bound()
                       
std::trie::{...} : bound_iter()       -> bound()
                   lower_bound_iter() -> lower_bound()
                   upper_bound_iter() -> upper_bound()

rustpkg::package_id::{...} : prefixes_iter() -> prefixes()

std::hashmap::{...} : difference_iter()           -> difference()
                      symmetric_difference_iter() -> symmetric_difference()
                      intersection_iter()         -> intersection()
                      union_iter()                -> union()
                     
std::path::{posix, windows} : component_iter()     -> components()
                              str_component_iter() -> str_components()

... not showing all identical renamings for reverse versions
~~~

---

I'm also planning a few more changes, like removing all unnecessary `_rev` constructors (#9391), or reducing the `split` variants on `&str` to a more versatile and concise system.
2013-11-26 01:07:40 -08:00
Marvin Löbel 24b316a3b9 Removed unneccessary `_iter` suffixes from various APIs 2013-11-26 10:02:26 +01:00
Vijay Korapaty 9c6bba91a8 Updating docs with updated closure syntax, `&fn` -> `||` 2013-11-26 00:35:55 -08:00
bors b42c438892 auto merge of #10631 : klutzy/rust/win-fixes, r=alexcrichton
This patchset fixes some parts broken on Win64.

This also adds `--disable-pthreads` flags to llvm on mingw-w64 archs (both 32-bit and 64-bit, not mingw) due to bad performance. See #8996 for discussion.
2013-11-25 23:02:29 -08:00
bors c6a87c2721 auto merge of #10316 : klutzy/rust/attr-lint, r=cmr
This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes.

Closes #3348
2013-11-25 21:47:16 -08:00
klutzy fa2077af99 rustc: Add crate-level attribute lint 2013-11-26 14:07:48 +09:00
klutzy 9432e2a25d rustc: Update obsolete attribute list 2013-11-26 14:06:52 +09:00
klutzy b4ad3363f3 Add test for unknown attribute lint 2013-11-26 14:05:53 +09:00
klutzy 37f2f7173b rustc: Add lint for unknown attributes 2013-11-26 14:05:50 +09:00
bors 720bcd81de auto merge of #10652 : jld/rust/enum-unstruct, r=thestinger
This is needed so that the FFI works as expected on platforms that don't
flatten aggregates the way the AMD64 ABI does, especially for `#[repr(C)]`.

This moves more of `type_of` into `trans::adt`, because the type might
or might not be an LLVM struct.

Closes #10308.
2013-11-25 20:32:22 -08:00
klutzy 365c44cb2d Add tests for attribute lint 2013-11-26 13:24:11 +09:00
klutzy 87b166d94a std: Remove unused attributes
This also enables two tests properly.
2013-11-26 13:24:11 +09:00
klutzy 1f7bfac9d2 rustc: Add lint for obsolete attributes
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
2013-11-26 13:13:17 +09:00
klutzy 6ff697d393 rustc: Add lint for misplaced crate attributes 2013-11-26 13:13:17 +09:00
Jed Davis 0c04a26b3f Fix the usual check-fast scoping mistake. 2013-11-25 19:42:57 -08:00
Alex Crichton ac59888d8f Move LittleLock to using RAII
This moves the locking/waiting methods to returning an RAII struct instead of
relying on closures. Additionally, this changes the methods to all take
'&mut self' to discourage recursive locking. The new method to block is to call
`wait` on the returned RAII structure instead of calling it on the lock itself
(this enforces that the lock is held).

At the same time, this improves the Mutex interface a bit by allowing
destruction of non-initialized members and by allowing construction of an empty
mutex (nothing initialized inside).
2013-11-25 17:55:41 -08:00
bors ffaee0fd96 auto merge of #10650 : andreasots/rust/ipv6-is-in-hex, r=alexcrichton
Without this the assert in <tt>rust_malloc_ip6_addr</tt> is triggered as it expects a correctly formatted IPv6 address.
2013-11-25 17:46:32 -08:00
bors e632c440f8 auto merge of #10658 : LeoTestard/rust/serialize-rc, r=cmr
Implement various traits (IterBytes and extra's Encodable and Decodable) for Rc<T> when T alreay implements the trait.
2013-11-25 13:11:43 -08:00
bors 6fe6a6f9df auto merge of #10657 : sanxiyn/rust/pat, r=cmr 2013-11-25 11:56:40 -08:00
Léo Testard ae836c1e44 Implement IterBytes for Rc<T>. 2013-11-25 19:47:09 +01:00
Léo Testard b6ab4f2485 Add an implementation of Encodable and Decodable for Rc. This will be needed to use Rc in place of @ in libsyntax. 2013-11-25 19:45:51 +01:00