Commit Graph

21453 Commits

Author SHA1 Message Date
Felix S. Klock II
a5a5432f98 Switch metadata::encoder to <V:Visitor> trait.
placate make tidy.  Remove dead code.
2013-08-15 04:06:17 +02:00
Felix S. Klock II
54ee3d03ff Port check_match from oldvisit to <V:Visitor> trait API. 2013-08-15 04:06:17 +02:00
Felix S. Klock II
3d83010648 Switch to new <V:Visitor> visitor (rather than @Visitor).
Alpha-renamed top-level visit_* functions to walk_*.
(Motivation: Distinguish visit action and recursive traversal.)

Abstract over `&mut self` rather than over `@mut self`.

This required some acrobatics, notably the

  `impl<E> Visitor<E> for @mut Visitor<E>`

and corresponding introduction of `@mut Visitor` and some local `let
mut` bindings.

Remove oldvisit reference.

Added default implementations for all of the Visitor trait methods.

Note that both `visit_expr_post` and `visit_ty` are no-op's by
default, just like they are in `oldvisit::default_visitor`.

Refactoring: extract logic to ease swapping visit for oldvisit (hopefully).
2013-08-15 04:06:17 +02:00
Felix S. Klock II
356341192f Ported check_loop from oldvisit to <V:Visit> trait API. 2013-08-15 04:06:17 +02:00
Felix S. Klock II
4127c67406 Ported check_const from oldvisit to <V:Visitor> trait API. 2013-08-15 04:06:17 +02:00
Graydon Hoare
3411846d58 register new snapshots 2013-08-14 18:45:51 -07:00
bors
3dde8e0f29 auto merge of #8480 : cmr/rust/tutorial, r=metajack 2013-08-14 18:29:09 -07:00
Graydon Hoare
9b9250052c Merge pull request #8479 from catamorphism/derived-errors
rustc: Eliminate a derived error in check::_match
2013-08-14 18:23:55 -07:00
blake2-ppc
88c149195a std: Replace map_vec, map_vec2, iter_vec2 in std::result
Replace these with three functions based on iterators: collect, fold,
and fold_. The mapping part is replaced by iterator .map(), so the part
that these functions do is to accumulate the final Result<,> value.

* `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>`
* `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>`
* `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
2013-08-15 02:52:55 +02:00
blake2-ppc
6fe4c871f1 Update either::partition
Remove the only use of either::partition since it was better
accomplished with vector methods.

Update either::partition so that it sizes the vectors correctly before
it starts.
2013-08-15 02:52:55 +02:00
blake2-ppc
a5f9494199 std: Change either::{lefts, rights} to return an iterator 2013-08-15 02:52:55 +02:00
Tim Chevalier
5be4408ef2 testsuite: Add xfailed test for #8498 2013-08-14 16:52:05 -07:00
Tim Chevalier
cf4694e73b std: Change ProcessOptions struct to have an option of a ~ vector
This is a workaround for #8498
2013-08-14 16:52:05 -07:00
Tim Chevalier
63083ee767 rustc: Eliminate a derived error in check::_match 2013-08-14 13:42:58 -07:00
bors
e7b572952c auto merge of #8469 : gifnksm/rust/tutorial-ja, r=graydon
This PR adds an Japanese translated version of `doc/tutorial.md`.
Other tutorials have not yet translated.
2013-08-14 13:05:22 -07:00
Kevin Ballard
15159a5638 Rewrite Saturating in terms of CheckedAdd/CheckedSub 2013-08-14 13:02:20 -07:00
bors
0a677bcf6e auto merge of #8462 : thestinger/rust/loop-cleanup, r=cmr
I missed some of this in e7bb33aed8. Hopefully it's all gone now :).
2013-08-14 10:35:12 -07:00
bors
927aff1724 auto merge of #8452 : Kimundi/rust/stuff02, r=bstrie
- Methodyfied the string ascii extionsion functions - They got added recently, I wrapped them in a trait.
- Added `into_owned()` method for vectors - similar to `Str`'s `into_owned()` function, allows to convert to a owned vector without making a copy if the source is a owned vector.
- Added `or_some` method to option - similar to `unwrap_or_default`, but keeps the values wrapped in an `Option`. Useful for `Option` chains, eg Iterator impls.
- Added `DoubleEndedIterator` impl to `Option` - Just for compatibility with generic Iterator functions.
- Renamed nil.rs to unit.rs - the type got renamed ages ago, it's time the source file is as well.
2013-08-14 08:35:15 -07:00
Huon Wilson
53487a0246 std: Move the iterator param on FromIterator and Extendable to the method.
If they are on the trait then it is extremely annoying to use them as
generic parameters to a function, e.g. with the iterator param on the trait
itself, if one was to pass an Extendable<int> to a function that filled it
either from a Range or a Map<VecIterator>, one needs to write something
like:

    fn foo<E: Extendable<int, Range<int>> +
              Extendable<int, Map<&'self int, int, VecIterator<int>>>
          (e: &mut E, ...) { ... }

since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>`
means that `foo` takes 2 type parameters, and the caller has to specify them
(which doesn't work anyway, as they'll mismatch with the iterators used in
`foo` itself).

This patch changes it to:

    fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }
2013-08-15 01:10:45 +10:00
Huon Wilson
58021be454 rustc: allow @ as-patterns to move when the sub-pattern contains no bindings.
A pattern like `foo @ Foo(Bar(*), _)` should be legal, even if `foo` moves,
since the subpatterns are purely structural.

Fixes #3761.
2013-08-15 01:05:52 +10:00
bors
836a3d9bdb auto merge of #8453 : dmanescu/rust/8451, r=cmr
I'm not sure that the supplied tests are suitable.
2013-08-14 06:44:18 -07:00
Marvin Löbel
a00becd0eb Methodyfied the string ascii extionsion functions
Added into_owned() method for vectors
Added DoubleEnded Iterator impl to Option
Renamed nil.rs to unit.rs
2013-08-14 14:48:25 +02:00
Seo Sanghyeon
337c406b80 Add sysconf names for Android 2013-08-14 20:51:47 +09:00
bors
ac49e65611 auto merge of #8440 : sfackler/rust/env-fix, r=pcwalton
The type of the result of option_env! was not fully specified in the
None case, leading to type check failures in the case where the variable
was not defined (e.g. option_env!("FOO").is_none()).

Also cleaned up some compilation warnings.
2013-08-14 04:41:20 -07:00
bors
cd656c74f6 auto merge of #8439 : huonw/rust/hashset-clone, r=cmr
Closes #5581.
2013-08-14 02:38:19 -07:00
bors
0efbb25a26 auto merge of #8477 : catamorphism/rust/issue-4096, r=msullivan
r? @msullivan ...e parameters

In this case, it's likely to be that the user forgot the `self` type, so
say so.

Closes #4096
2013-08-13 23:59:18 -07:00
Alex Crichton
783c6a1fbf Add a bunch of tests for closed issues
Closes #3907
Closes #5493
Closes #4464
Closes #4759
Closes #5666
Closes #5884
Closes #5926
Closes #6318
Closes #6557
Closes #6898
Closes #6919
Closes #7222
2013-08-13 21:32:34 -07:00
bors
e86d414f22 auto merge of #8497 : nikomatsakis/rust/improvements-to-object-coercion, r=pcwalton
While looking over the code for object coercion, I realized that it wasn't quite handling freezing and reborrowing correctly. Tweak the code, adding tests for the relevant cases. 

r? @pcwalton
2013-08-13 21:29:20 -07:00
bors
7585b34d31 auto merge of #8446 : alexcrichton/rust/ifmt++, r=graydon
This includes a number of improvements to `ifmt!`

* Implements formatting arguments -- `{:0.5x}` works now
* Formatting now works on all integer widths, not just `int` and `uint`
* Added a large doc block to `std::fmt` which should help explain what `ifmt!` is all about
* Added floating point formatters, although they have the same pitfalls from before (they're just proof-of-concept now)

Closed a couple of issues along the way, yay! Once this gets into a snapshot, I'll start looking into removing all of `fmt`
2013-08-13 19:23:21 -07:00
Alex Crichton
36882b3d54 Add f formats to ifmt!
Currently the work just the same as the old `extfmt` versions
2013-08-13 19:16:40 -07:00
Luqman Aden
a2ed09a006 Add test for repeat expr in statics. 2013-08-13 20:57:05 -04:00
Nick Desaulniers
0932ab336f Remove unused automatic cfg bindings Fixes #7169 2013-08-13 17:06:27 -07:00
bors
433fbe8fcf auto merge of #8329 : michaelwoerister/rust/lexical_scopes_alt, r=graydon
This pull request re-implements handling of visibility scopes and source code positions in debug info. It should now be very stable and properly handle

+ variable shadowing
+ expanded code (macros and the new for-loop de-sugaring, for example)
+ variables in the middle of nested scopes
+ bindings declared in the head of match statement arms. 

all of which did not work at all or did not work reliably before. Those interested in a more detailed description of the problems at hand, I kindly refer to http://michaelwoerister.github.io/2013/08/03/visibility-scopes.html

Why doesn't the `populate_scope_map()` function use `syntax::visit`?
Because it would not improve this particular AST walker (see: 69dc790849 (commitcomment-3781426))

Cheers,
Michael
2013-08-13 16:53:14 -07:00
bors
9f379329db auto merge of #8475 : kmcallister/rust/stack_segment, r=brson,brson
Servo needs to tell SpiderMonkey about the stack bounds.

r? @brson
2013-08-13 14:57:24 -07:00
Graydon Hoare
26fd428fae Merge pull request #8432 from chris-morgan/remove-assert-eq-macro-fail-binary
Remove in-tree test binary.
2013-08-13 14:51:36 -07:00
Niko Matsakis
bf2d3c840b Reborrow even when passing &Object to &Object, so as to permit freezing 2013-08-13 15:52:05 -04:00
Niko Matsakis
afb20775d1 Fix freezing of @mut Objects when passing as argument 2013-08-13 15:52:04 -04:00
Keegan McAllister
4fd5318594 Make rt::stack public
Fixes #8478.
2013-08-13 09:10:07 -07:00
bors
0d817ee869 auto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie
Closes #5495
2013-08-13 07:26:23 -07:00
Robert Knight
11b3d76fb6 Add RngUtils::sample() method for reservoir sampling from iterators 2013-08-13 13:26:05 +01:00
bors
f02cc6bf0a auto merge of #8411 : bblum/rust/assorted-fixes, r=brson
Each commit is pretty much what it says on the tin. r anybody.
2013-08-13 04:59:20 -07:00
bors
c99b2b932f auto merge of #7866 : sstewartgallus/rust/clean, r=cmr
Mostly I did simple transformations from imperative style loops to
more functional iterator based transformations.
2013-08-13 02:14:24 -07:00
Michael Woerister
983cc777c5 debuginfo: Add some tests for visibiliy scopes within closures. 2013-08-13 11:13:49 +02:00
Michael Woerister
9c7d9eb6fd debuginfo: Add support for argument shadowing. 2013-08-13 11:13:49 +02:00
Michael Woerister
33e7d95e9c debuginfo: Implemented proper handling of lexical scopes and variable shadowing. 2013-08-13 11:13:49 +02:00
Luqman Aden
ccc85b1ac7 librustc: Allow vector repeat exprs in statics. 2013-08-13 03:36:21 -04:00
bors
4601ea65f8 auto merge of #8487 : brson/rust/local-opts, r=brson
I did this once but acciddentally undid it in a later patch.
2013-08-12 23:56:26 -07:00
Alex Crichton
930885d5e5 Forbid pub/priv where it has no effect
Closes #5495
2013-08-12 23:20:46 -07:00
Alex Crichton
27b4d104c8 Explain what ifmt! is all about 2013-08-12 23:18:51 -07:00
Alex Crichton
1f6afa887b Correct the padding on integer types for formatting 2013-08-12 23:18:51 -07:00