Commit Graph

19291 Commits

Author SHA1 Message Date
gifnksm
8edb8f6d39 iterator: Add IteratorUtil::max_by/min_by method 2013-06-27 06:55:22 +09:00
bors
23fb2278c7 auto merge of #7356 : msullivan/rust/default-methods, r=bblum
r?
2013-06-26 12:08:33 -07:00
bors
3433851a37 auto merge of #7345 : blake2-ppc/rust/iterator-flat-map, r=thestinger
flat_map_ produces an iterator that maps each element to an iterator,
and yields the elements of the produced iterators.

This is the monadic bind :: M a -> (a -> M b) -> M b  for iterators.

Named just like the vec method, but with a trailing underline until the
method resolution bug is resolved.

We discussed the name chain_map, but I decided to go with flat_map_ for consistency with vec.

Since it.map(f).flatten()  would be the same as it.flat_map(f), we could choose
to just implement a flatten method instead. Either way the possibilities are the same but flat_map is more convenient.
2013-06-26 09:47:16 -07:00
bors
4e5b4807a5 auto merge of #7297 : huonw/rust/strip-expand-strip, r=cmr
This allows macros to both be conditionally defined, and expand
to items with #[cfg]'s.

This seems to have a performance improvement, e.g. for `std`:

```
# Before 
time: 1.660 s   expansion
time: 0.125 s   configuration
# After
time: 0.080 s   configuration 1
time: 1.127 s   expansion
time: 0.132 s   configuration 2
```

And for `extra`:

```
# Before
time: 0.593 s   expansion
time: 0.062 s   configuration
# After
time: 0.047 s   configuration 1
time: 0.147 s   expansion
time: 0.058 s   configuration 2
```

(This seems a little peculiar, but it is possibly because the expansion AST traversal is very slow, so removing as much as possible as early as possible has big benefits.)
2013-06-26 07:32:14 -07:00
Huon Wilson
73e3dbf9c0 driver: perform stripping before and after macro expansion.
This allows macros to both be conditionally defined, and expand
to items with #[cfg]'s.
2013-06-26 23:02:14 +10:00
bors
a30ab764e1 auto merge of #7255 : michaelwoerister/rust/debuginfo, r=jdm
This PR contains no real code changes. Just some documentation additions in the form of comments and some internal reordering of functions within debuginfo.rs.
2013-06-26 05:20:06 -07:00
bors
4ec05e02fa auto merge of #7216 : kballard/rust/task_rng, r=brson 2013-06-26 03:08:04 -07:00
bors
09b4525f84 auto merge of #7113 : alexcrichton/rust/banned-warnings, r=cmr
Reopening of #7031, Closes #6963

I imagine though that this will bounce in bors once or twice... Because attributes can't be cfg(stage0)'d off, there's temporarily a lot of new stage0/stage1+ code.
2013-06-26 00:56:04 -07:00
bors
ebed4d00d0 auto merge of #7393 : alexcrichton/rust/enable-threads, r=catamorphism
Closes #7071
2013-06-25 22:26:05 -07:00
bors
22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
bors
e9ac7194ff auto merge of #7365 : cmr/rust/syntax_cleanup, r=Aatch
Sets the stage for further cleanup (especially mass-slaughter of `@`)
2013-06-25 18:02:02 -07:00
Alex Crichton
7f61b31f5f Stop passing --disable-threads to LLVM 2013-06-25 17:42:28 -07:00
Alex Crichton
c109bed15b Deny common lints by default for lib{std,extra} 2013-06-25 17:39:43 -07:00
Corey Richardson
a616531ebb Remove extra 2013-06-25 20:25:56 -04:00
bors
efd1438770 auto merge of #7373 : thestinger/rust/iterator, r=huonw 2013-06-25 15:22:55 -07:00
Daniel Micay
e44e33dfa9 xfail test hitting a codegen bug (issue #7385) 2013-06-25 16:31:17 -04:00
Daniel Micay
e67c48a591 remove each from vec, HashMap and HashSet 2013-06-25 16:28:02 -04:00
Daniel Micay
64ee9668a2 container: remove internal iterators from Map
the maps are being migrated to external iterators
2013-06-25 16:26:23 -04:00
Daniel Micay
5242e8d2ba remove the redundant each method from OptVec 2013-06-25 16:26:23 -04:00
Corey Richardson
0d471d310d great renaming propagation: syntax 2013-06-25 16:15:07 -04:00
bors
4967bd0508 auto merge of #7325 : artagnon/rust/resolve-module, r=cmr
Fix #7322.

I started out with a band-aid approach to special-case the duplicate module error using `is_duplicate_module`, but thought this would be better in the long term.
2013-06-25 13:11:11 -07:00
Ramkumar Ramachandra
f982f42f3c resolve: make error message strings more consistent
The "first definition of ..." error string reported by add_child() looks
different from similar messages reported by other functions.  Fix this.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-25 23:58:48 +05:30
Ramkumar Ramachandra
9f80591d84 resolve: report duplicate module definitions
add_child() is responsible for reporting errors about type, value, and
module duplicate definitions.  Although it checks for all three, it uses
namespace_to_str() to convert a Namespace value into a string before
printing an error like:

  error: duplicate definition of type `foo`
                                 ^^^^
  note: first definition of type foo here:
                            ^^^^

Unfortunately, this string can only be one of "type" or
"value" (corresponding to TypeNS and ValueNS respectively), and it
reports duplicate modules as duplicate types.

To alleviate the problem, define a special NamespaceError enum to define
more specialized errors, and use it instead of attempting to reuse the
Namespace enum.

Reported-by: Corey Richardson <corey@octayn.net>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-25 23:58:48 +05:30
Michael Sullivan
276463f064 Fix another generics bug with default methods. Closes #7295. 2013-06-25 11:20:02 -07:00
bors
032dcc57e8 auto merge of #7371 : alexcrichton/rust/trying, r=cmr
This is an attempt at a smaller request than #7113, it's just the first two commits
2013-06-25 10:47:01 -07:00
Alex Crichton
92424f0670 Add the warnings lint attribute 2013-06-25 08:55:15 -07:00
Alex Crichton
42b44b21b1 Rename all files with the 'rc' extension 2013-06-25 08:55:15 -07:00
bors
d161e630d8 auto merge of #7317 : Aatch/rust/no-drop-flag, r=thestinger
This adds a `#[no_drop_flag]` attribute. This attribute tells the compiler to omit the drop flag from the struct, if it has a destructor. When the destructor is run, instead of setting the drop flag, it instead zeroes-out the struct. This means the destructor can run multiple times and therefore it is up to the developer to use it safely.

The primary usage case for this is smart-pointer types like `Rc<T>` as the extra flag caused the struct to be 1 word larger because of alignment.

This closes #7271 and #7138
2013-06-25 07:23:06 -07:00
bors
7aee5da08d auto merge of #7254 : Blei/rust/intrinsic-overhaul, r=cmr
This sets the `get_tydesc()` return type correctly and removes the intrinsic module. See #3730, #3475.

Update: this now also removes the unused shape fields in tydescs.
2013-06-25 04:38:06 -07:00
bors
b11346bb5d auto merge of #7291 : alexcrichton/rust/static-mut, r=huonw
This adds both `static mut` items and `static mut` foreign items. This involved changing far less code than I thought it was going to, but the tests seem to pass and the variables seem functional.

I'm more than willing to write more tests, so suggestions are welcome!

Closes #553
2013-06-25 01:59:05 -07:00
bors
5a089c252e auto merge of #7370 : Aatch/rust/snapshot, r=huonw
I also cleaned up the warnings.
2013-06-24 23:14:01 -07:00
James Miller
122f25dd5e Add missing import to tests 2013-06-25 18:02:56 +12:00
James Miller
6ad31ffb53 Warning police 2013-06-25 17:13:52 +12:00
James Miller
caa50ce15d Remove stage0 cfgs 2013-06-25 17:08:26 +12:00
James Miller
2afdf0d6a1 Update snapshots file 2013-06-25 16:43:58 +12:00
James Miller
721164d5ec Zero the struct in the take glue, not the drop glue 2013-06-25 16:39:56 +12:00
James Miller
d9f6dd263c Set #[no_drop_flag] on Rc<T> and AtomicOption. Add Test 2013-06-25 16:11:34 +12:00
James Miller
0cca08a21a Add support for #[no_drop_flag] attribute 2013-06-25 16:11:33 +12:00
bors
237ca7dc58 auto merge of #7257 : indutny/rust/feature/libc-mman, r=cmr
Add functions and constants required to be able to use `mmap` and friends.
2013-06-24 21:01:56 -07:00
Fedor Indutny
bc70edbb25 libc: (u)int => c_(u)int for consts 2013-06-24 21:06:51 +02:00
Philipp Brueschweiler
f8ae3cdcaa Fix test failure on windows
This patch ensures that the multiple extern definitions of `free` in the
run-pass tests have the same declaration, working around #7352.
2013-06-24 19:14:20 +02:00
Fedor Indutny
ddd6f59283 libc: add POSIX-compatible sysconf consts
Because its part of POSIX. Values are taken from FreeBSD, linux
and OSX header files.
2013-06-24 19:04:00 +02:00
Fedor Indutny
079b07df55 libc: support functions from sys/mman.h
Because its part of POSIX. Values are taken from FreeBSD, linux
and OSX header files.
2013-06-24 19:04:00 +02:00
Alex Crichton
b94f89fffc Fix 'static mut' tests 2013-06-24 07:42:32 -07:00
bors
c6515ee6a7 auto merge of #7193 : Thiez/rust/fixbench, r=cmr
This PR fixes a few problems with the benchmark, mentioned in #2913. Since I do not have a 4GB RAM machine (I run rust on a puny 2GB RAM VM) I can't test binarytrees with N=20. If it works we can close #2913.

Fixes: 1) binarytrees prints "long lived trees of depth" instead of "long lived tree of depth"
Fixes: 2) chameneosredux -- the whitespace printed by show_number should be the same as printed by show_color
Already fixed: 3) spectralnorm prints an extra 

Fixes: 4) threadring prints an extra 

Fixes: 5) fasta -- strangely, output stops half-way through line 169 -- with another 8166 lines still to do.
Could not test: 6) the latest binarytrees fails with input N=20 on a 4GB machine.

r?
2013-06-24 04:43:51 -07:00
blake2-ppc
6291702cf3 iterator: Add IteratorUtil::flat_map_ method
flat_map_ produces an iterator that maps each element to an iterator,
and yields the elements of the produced iterators.

This is the monadic bind :: M a -> (a -> M b) -> M b  for iterators.

Named just like the vec method, but with a trailing underline until the
method resolution bug is resolved.
2013-06-24 12:50:41 +02:00
bors
dfb7de8e0e auto merge of #7334 : thestinger/rust/old_iter, r=Aatch
the `test/run-pass/class-trait-bounded-param.rs` test was xfailed and
written in an ancient dialect of Rust so I've just removed it

this also removes `to_vec` from DList because it's provided by
`std::iter::to_vec`

an Iterator implementation is added for OptVec but some transitional
internal iterator methods are still left
2013-06-24 00:52:53 -07:00
Daniel Micay
da1a9a30fd work around ICE from default method
issue #7341
2013-06-24 01:58:10 -04:00
Daniel Micay
1e7ca8dd24 xfail-pretty on un-xfailed test 2013-06-24 01:45:06 -04:00