Commit Graph

24071 Commits

Author SHA1 Message Date
bors
d2c405eeff auto merge of #10642 : cmr/rust/strict_doccomment, r=alexcrichton
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 15:32:18 -08:00
Corey Richardson
b50b162884 Be more strict about doc comments
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 18:00:50 -05:00
bors
d662820b29 auto merge of #10680 : alexcrichton/rust/relax-feature-gate, r=thestinger
Instead of forcibly always aborting compilation, allow usage of
 #[warn(unknown_features)] and related lint attributes to selectively abort
 compilation. By default, this lint is deny.
2013-11-27 14:17:41 -08:00
bors
e147a090a5 auto merge of #10685 : ebiggers/rust/ascii_fixes, r=alexcrichton
is_digit() incorrectly returned false for '0'.
is_control() incorrectly returned true for ' ' (space).
2013-11-27 11:52:09 -08:00
bors
e4136bd552 auto merge of #10662 : alexcrichton/rust/thread-detach, r=pcwalton
This has one commit from a separate pull request (because these commits depend on that one), but otherwise the extra details can be found in the commit messages. The `rt::thread` module has been generally cleaned up for everyday safe usage (and it's a bug if it's not safe).
2013-11-27 09:57:05 -08:00
Alex Crichton
a9bd049fc0 Relax restrictions on unknown feature directives
Instead of forcibly always aborting compilation, allow usage of
 #[warn(unknown_features)] and related lint attributes to selectively abort
 compilation. By default, this lint is deny.
2013-11-27 09:54:30 -08:00
Alex Crichton
5d6dbf3f26 Improve the rt::thread module
* Added doc comments explaining what all public functionality does.
* Added the ability to spawn a detached thread
* Added the ability for the procs to return a value in 'join'
2013-11-27 09:53:48 -08:00
bors
a6fc577ab5 auto merge of #10693 : eddyb/rust/freeze-ast, r=thestinger
It's truly immutable now, which will allow us to remove some cloning in the parser and box parts of the AST in `Rc<T>` (if desired).
2013-11-27 08:07:56 -08:00
Eric Biggers
64883242eb std::ascii: Add tests for is_digit() and is_control() 2013-11-27 09:54:54 -06:00
Eduard Burtescu
f09b7b0ecd Freeze the AST by removing a couple of unused @mut ~[T] from token_tree. 2013-11-27 17:48:58 +02:00
bors
23674be0b1 auto merge of #10684 : jld/rust/unstruct-unhack-typekind, r=alexcrichton 2013-11-27 06:17:40 -08:00
bors
17af6f7d0c auto merge of #10688 : bjz/rust/recv_iter, r=brson
I've noticed I use this pattern quite a bit:

~~~rust
do spawn {
    loop {
        match port.try_recv() {
            Some(x) => ...,
            None => ...,
        }
    }
}
~~~

The `RecvIterator`, returned from a default `recv_iter` method on the `GenericPort` trait, allows you to reduce this down to:

~~~rust
do spawn {
    for x in port.recv_iter() {
        ...
    }
}
~~~

As demonstrated in the tests, you can also access the port from within the `for` block for further `recv`ing and `peek`ing with no borrow errors, which is quite nice.
2013-11-27 01:52:10 -08:00
bors
faf4c939fb auto merge of #10670 : eddyb/rust/node-u32, r=alexcrichton
### Rationale
There is no reason to support more than 2³² nodes or names at this moment, as compiling something that big (even without considering the quadratic space usage of some analysis passes) would take at least **64GB**.
Meanwhile, some can't (or barely can) compile rustc because it requires almost **1.5GB**.

### Potential problems
Can someone confirm this doesn't affect metadata (de)serialization? I can't tell myself, I know nothing about it.

### Results
Some structures have a size reduction of 25% to 50%: [before](https://gist.github.com/luqmana/3a82a51fa9c86d9191fa) - [after](https://gist.github.com/eddyb/5a75f8973d3d8018afd3).
Sadly, there isn't a massive change in the memory used for compiling stage2 librustc (it doesn't go over **1.4GB** as [before](http://huonw.github.io/isrustfastyet/mem/), but I can barely see the difference).
However, my own testcase (previously peaking at **1.6GB** in typeck) shows a reduction of **200**-**400MB**.
2013-11-26 22:07:44 -08:00
Alex Crichton
ed86b48cc9 Clean up statically initialized data on shutdown
Whenever the runtime is shut down, add a few hooks to clean up some of the
statically initialized data of the runtime. Note that this is an unsafe
operation because there's no guarantee on behalf of the runtime that there's no
other code running which is using the runtime.

This helps turn down the noise a bit in the valgrind output related to
statically initialized mutexes. It doesn't turn the noise down to 0 because
there are still statically initialized mutexes in dynamic_lib and
os::with_env_lock, but I believe that it would be easy enough to add exceptions
for those cases and I don't think that it's the runtime's job to go and clean up
that data.
2013-11-26 21:11:17 -08:00
Brendan Zabarauskas
31da6b7698 Add an iterator for receiving messages from GenericPorts 2013-11-27 15:10:12 +10:00
Eduard Burtescu
7ed27b5531 Shink NodeId, CrateNum, Name and Mrk down to 32 bits on x64. 2013-11-27 07:02:25 +02:00
bors
82d9033b67 auto merge of #10679 : alexcrichton/rust/no-routine, r=pcwalton 2013-11-26 19:37:38 -08:00
Eric Biggers
7b96f13d7d std::ascii: Fix is_digit() and is_control()
is_digit() incorrectly returned false for '0'.
is_control() incorrectly returned true for ' ' (space).
2013-11-26 20:13:25 -06:00
Jed Davis
57c1a01a93 Remove enum struct return workaround from LLVM bindings. 2013-11-26 17:47:49 -08:00
bors
fb52956fe4 auto merge of #10677 : jld/rust/type-enum-discrim-rm, r=alexcrichton 2013-11-26 17:32:45 -08:00
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 procs 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