Commit graph

19303 commits

Author SHA1 Message Date
Jed Estep
35314c93fa Moving implementation details to a macro 2013-06-26 18:08:56 -04:00
Jed Estep
096fb795de A few iterator tests 2013-06-26 18:08:56 -04:00
Jed Estep
dfc9392c38 iterators use deque ordering 2013-06-26 18:08:56 -04:00
Jed Estep
4f7a742a06 deque iterator 2013-06-26 18:08:56 -04:00
Ramkumar Ramachandra
f4621cab68 priority_queue: implement simple iterator
Remove PriorityQueue::each and replace it with PriorityQueue::iter,
which ultimately calls into vec::VecIterator via PriorityQueueIterator.
Implement iterator::Iterator for PriorityQueueIterator.  Now you should
be able to do:

  extern mod extra;
  let mut pq = extra::priority_queue::PriorityQueue::new();
  pq.push(5);
  pq.push(6);
  pq.push(3);
  for pq.iter().advance |el| {
      println(fmt!("%d", *el));
  }

just like you iterate over vectors, hashmaps, hashsets etc.  Note that
the iteration order is arbitrary (as before with PriorityQueue::each),
and _not_ the order you get when you pop() repeatedly.

Add an in-file test to guard this.

Reported-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-26 18:08:43 -04:00
Tim Chevalier
2b17e4775c rustc: Eliminate extra failing case in metadata::loader::crate_from_metas
Closes #2406
2013-06-26 18:08:34 -04:00
Philipp Brüschweiler
2234f61038 Remove the last traces of shapes 2013-06-26 18:08:23 -04:00
Philipp Brüschweiler
87c1b59e8b Fix some warnings in the check-fast tests 2013-06-26 18:08:23 -04:00
Alex Crichton
8a4d359ffc Fix a formatting bug in rusti 2013-06-26 18:08:13 -04:00
Brian Anderson
9423850fc3 More 0.7 release notes 2013-06-26 18:08:04 -04:00
Kevin Ballard
0ae203a779 Refactor extra::term a bit
Move all the colors into a nested mod named color instead of prefixing
with "color_".

Define a new type color::Color, and make this a u16 instead of a u8 (to
allow for easy comparisons against num_colors, which is a u16).

Remove color_supported and replace it with num_colors.

Teach fg() and bg() to "dim" bright colors down to the normal intensity
if num_colors isn't high enough.

Remove unnecessary copies, and fix a bug where a terminfo parse failure
would try to use the wrong error and end up failing.
2013-06-26 18:07:17 -04:00
Ben Blum
00b4138857 Make ^~~~~ colour dependent on error/warning/note level. Also correct spelling of squigglies. 2013-06-26 18:00:11 -04:00
Ramkumar Ramachandra
41f953af2e .gitmodules: specify submodule.<path>.branch
So --remote can work.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
2013-06-26 17:59:19 -04: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