]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #9096 : huonw/rust/linenoise, r=brson
bors [Thu, 12 Sep 2013 11:36:06 +0000 (04:36 -0700)]
auto merge of #9096 : huonw/rust/linenoise, r=brson

- Wrap calls into linenoise in a mutex so that the functions don't have to be `unsafe` any more (fixes #3921)
- Stop leaking every line that linenoise reads.
- Handle the situation of `rl::complete(some_function); do spawn { rl::read(""); }` which would crash (`fail!` that turned into an abort, possibly due to failing with the lock locked) when the user attempted to tab-complete anything.
- Add a test for the various functions; it has to be run by hand to verify anything works, but it won't bitrot.

10 years agoauto merge of #9012 : alexcrichton/rust/format-args, r=huonw
bors [Thu, 12 Sep 2013 10:21:08 +0000 (03:21 -0700)]
auto merge of #9012 : alexcrichton/rust/format-args, r=huonw

The purpose of this macro is to further reduce the number of allocations which
occur when dealing with formatting strings. This macro will perform all of the
static analysis necessary to validate that a format string is safe, and then it
will wrap up the "format string" into an opaque struct which can then be passed
around.

Two safe functions are added (write/format) which take this opaque argument
structure, unwrap it, and then call the unsafe version of write/format (in an
unsafe block). Other than these two functions, it is not intended for anyone to
ever look inside this opaque struct.

The macro looks a bit odd, but mostly because of rvalue lifetimes this is the
only way for it to be safe that I know of.

Example use-cases of this are:

* third-party libraries can use the default formatting syntax without any
  forced allocations
* the fail!() macro can avoid allocating the format string
* the logging macros can avoid allocation any strings

I plan on transitioning the standard logging/failing to using these macros soon. This is currently blocking on inner statics being usable in cross-crate situations (still tracking down bugs there), but this will hopefully be coming soon!

Additionally, I'd rather settle on a name now than later, so if anyone has a better suggestion other than `format_args`, I'm not attached to the name at all :)

10 years agoauto merge of #9138 : alexcrichton/rust/dynamic-lib-not-threadsafe, r=thestinger
bors [Thu, 12 Sep 2013 08:16:08 +0000 (01:16 -0700)]
auto merge of #9138 : alexcrichton/rust/dynamic-lib-not-threadsafe, r=thestinger

The library isn't thread-safe, cc #9137

10 years agoImplement a format_args!() macro
Alex Crichton [Wed, 28 Aug 2013 09:22:45 +0000 (02:22 -0700)]
Implement a format_args!() macro

The purpose of this macro is to further reduce the number of allocations which
occur when dealing with formatting strings. This macro will perform all of the
static analysis necessary to validate that a format string is safe, and then it
will wrap up the "format string" into an opaque struct which can then be passed
around.

Two safe functions are added (write/format) which take this opaque argument
structure, unwrap it, and then call the unsafe version of write/format (in an
unsafe block). Other than these two functions, it is not intended for anyone to
ever look inside this opaque struct.

The macro looks a bit odd, but mostly because of rvalue lifetimes this is the
only way for it to be safe that I know of.

Example use-cases of this are:

* third-party libraries can use the default formatting syntax without any
  forced allocations
* the fail!() macro can avoid allocating the format string
* the logging macros can avoid allocation any strings

10 years agoAdd linenoise lock helpers to rustrt.def.in.
Huon Wilson [Thu, 12 Sep 2013 07:07:24 +0000 (17:07 +1000)]
Add linenoise lock helpers to rustrt.def.in.

10 years agoFlag the dynamic_lib tests as ignored
Alex Crichton [Thu, 12 Sep 2013 06:22:52 +0000 (23:22 -0700)]
Flag the dynamic_lib tests as ignored

The library isn't thread-safe, cc #9137

10 years agoauto merge of #9114 : sfackler/rust/flush-fix, r=brson
bors [Thu, 12 Sep 2013 06:11:04 +0000 (23:11 -0700)]
auto merge of #9114 : sfackler/rust/flush-fix, r=brson

10 years agoauto merge of #9061 : jakub-/rust/pretty-print-empty-impl, r=huonw
bors [Thu, 12 Sep 2013 02:16:00 +0000 (19:16 -0700)]
auto merge of #9061 : jakub-/rust/pretty-print-empty-impl, r=huonw

10 years agoFix the empty-impl tests
Jakub [Wed, 11 Sep 2013 23:58:30 +0000 (23:58 +0000)]
Fix the empty-impl tests

Use an existing type so that it compiles.

10 years agoauto merge of #9014 : dcrewi/rust/convert-between-bigints, r=anasazi
bors [Wed, 11 Sep 2013 23:46:00 +0000 (16:46 -0700)]
auto merge of #9014 : dcrewi/rust/convert-between-bigints, r=anasazi

10 years agoauto merge of #9064 : SiegeLord/rust/external_struct_variants, r=luqmana
bors [Wed, 11 Sep 2013 21:56:00 +0000 (14:56 -0700)]
auto merge of #9064 : SiegeLord/rust/external_struct_variants, r=luqmana

Fixes issues #5557 and #8746.

This patch adds an additional family for struct-like variants, and encodes some struct-like aspects of such variants that can then be properly decoded by resolve.

Note that I am not 100% sure how this fix works, but it fixes the issue without breaking any of the tests on my machine.

10 years agoauto merge of #9038 : singingboyo/rust/with-mem-writer, r=anasazi
bors [Wed, 11 Sep 2013 19:16:01 +0000 (12:16 -0700)]
auto merge of #9038 : singingboyo/rust/with-mem-writer, r=anasazi

This is in many ways a replacement for the current std::io::with_str_writer.

10 years agoxfail-fast the new test for windows compatibility
SiegeLord [Wed, 11 Sep 2013 18:51:27 +0000 (14:51 -0400)]
xfail-fast the new test for windows compatibility

10 years agoFix whitespace in tests
SiegeLord [Tue, 10 Sep 2013 03:22:54 +0000 (23:22 -0400)]
Fix whitespace in tests

10 years agoReplace dashes in the filenames of the new tests with underscores to avoid issues...
SiegeLord [Tue, 10 Sep 2013 03:21:36 +0000 (23:21 -0400)]
Replace dashes in the filenames of the new tests with underscores to avoid issues with Windows

10 years agoAdd a test for cross-crate struct variants
SiegeLord [Mon, 9 Sep 2013 22:44:31 +0000 (18:44 -0400)]
Add a test for cross-crate struct variants

10 years agoRename encode_struct_field_names to encode_struct_fields to reflect what it actually...
SiegeLord [Mon, 9 Sep 2013 22:33:35 +0000 (18:33 -0400)]
Rename encode_struct_field_names to encode_struct_fields to reflect what it actually does

10 years agoProperly encode/decode structural variants.
SiegeLord [Mon, 9 Sep 2013 00:36:01 +0000 (20:36 -0400)]
Properly encode/decode structural variants.

10 years agoauto merge of #8999 : anasazi/rust/multi-threaded-io-tests, r=brson
bors [Wed, 11 Sep 2013 17:21:02 +0000 (10:21 -0700)]
auto merge of #8999 : anasazi/rust/multi-threaded-io-tests, r=brson

Resolves #8685

10 years agoauto merge of #9039 : singingboyo/rust/update-for-expr-docs, r=thestinger
bors [Wed, 11 Sep 2013 14:46:04 +0000 (07:46 -0700)]
auto merge of #9039 : singingboyo/rust/update-for-expr-docs, r=thestinger

The old documentation for for loops/expressions has been quite wrong since the change to iterators.  This updates the docs to make them relevant to how for loops work now, if not very in-depth.  There may be a need for updates giving more depth on how they work, such as detailing what method calls they make, but I don't know enough about the implementation to include that.

10 years agoauto merge of #9097 : michaelwoerister/rust/namespaces, r=jdm
bors [Wed, 11 Sep 2013 13:26:05 +0000 (06:26 -0700)]
auto merge of #9097 : michaelwoerister/rust/namespaces, r=jdm

Who would have thought that namespaces are such a can of worms `:P` This is mostly because of some GDB idiosyncrasies (does not use namespace information but linkage-name attributes for displaying items contained in namespaces, also cannot handle functions lexically nested within functions), monomorphization, and information about external items only available from metadata.

This pull request tries to tackle the problem anyway:
* The `DW_AT_linkage_name` for functions is generated just to make GDB display a proper namespace-enabled function name. To this end, a pseudo-mangled name is generated, not corresponding to the real linkage name. This approach shows some success and could be extended to make GDB also show proper parameter types.
* As GDB won't accept subprogram DIEs nested within other subprogram DIEs, the `debuginfo` module now generates a *companion namespace* for each functions (iff needed). A function `fn abc()` will get a companion namespace with name `abc()`, which contains all items (modules, types, functions) declared within the functions scope. The real, proper solution, in my opinion, would be to faithfully reflect the program's lexical structure within DWARF (which allows arbitrary nesting of DIEs, afaik), but I am not sure LLVM's source level debugging implementation would like that and I am pretty sure GDB won't support this in the foreseeable future.
* Monomorphization leads to functions and companion namespaces like `somelib::some_func<int, float>()::some_other_function<bool, bool, bool>()`, which I think is the desired behaviour. There is some design space here, however. Maybe you people prefer `somelib::some_func()::some_other_function<bool, bool, bool>()` or `somelib::some_func()::some_other_function::<int, float, bool, bool, bool>()`.

The solution will work for now but there are a few things on my 'far future wish list':
* A real specification somewhere, what language constructs are mapped to what DWARF structures.
* Proper tests that directly compare the generated DWARF information to the expected results (possibly using something like [pyelftools](https://github.com/eliben/pyelftools) or llvm-dwarfdump)
* A unified implementation for crate-local and crate-external items (which would possibly involve beefing up `ast_map::path` and metadata a bit)

Any comments are welcome!

Closes #1541
Closes #1542 (there might be other issues with function name prettiness, but this specific issue should be fixed)
Closes #7715 (source locations for structs and enums are now read correctly from the AST)

10 years agoAdd a test for extra::rl.
Huon Wilson [Wed, 11 Sep 2013 11:34:58 +0000 (21:34 +1000)]
Add a test for extra::rl.

This test has to be run by a human, to check inputs etc. Fortunately, it
won't bitrot (syntactically, or type-check-ly; it might bitrot
semantically), as it is designed so that the test runner compiles it with
`--cfg robot_mode`, which is used to disable the actual running of code.

10 years agoextra: improvements & bug fixes to rl.
Huon Wilson [Wed, 11 Sep 2013 11:31:14 +0000 (21:31 +1000)]
extra: improvements & bug fixes to rl.

- Removes a layer of indirection in the storage of the completion
  callback.
- Handles user tab completion in a task in which `complete` hasn't been
  properly. Previously, if `complete` was called in one task, and `read`
  called in another, attempting to get completions would crash. This
  makes the completion handlers non-ambiguously task-local only.
- Fix a mismatch in return values between the Rust code and linenoise.

10 years agoextra: stop rl from leaking each line that is read.
Huon Wilson [Tue, 10 Sep 2013 15:04:13 +0000 (01:04 +1000)]
extra: stop rl from leaking each line that is read.

10 years agoextra: use a mutex to wrap linenoise calls and make them threadsafe.
Huon Wilson [Tue, 10 Sep 2013 14:50:47 +0000 (00:50 +1000)]
extra: use a mutex to wrap linenoise calls and make them threadsafe.

Fixes #3921.

10 years agodebuginfo: Renamed NamespaceTree to NamespaceTreeNode.
Michael Woerister [Wed, 11 Sep 2013 12:19:56 +0000 (14:19 +0200)]
debuginfo: Renamed NamespaceTree to NamespaceTreeNode.

10 years agoauto merge of #9107 : catamorphism/rust/rustpkg-command-line-flags, r=brson
bors [Wed, 11 Sep 2013 12:16:04 +0000 (05:16 -0700)]
auto merge of #9107 : catamorphism/rust/rustpkg-command-line-flags, r=brson

r? @brson rustpkg now accepts most of rustc's command-line arguments and passes
them along to rustc when building or installing.

A few rarely-used arguments aren't implemented yet.

rustpkg doesn't support flags that don't make sense with rustpkg
(for example, --bin and --lib, which get inferred from crate file names).

Closes #8522

10 years agoauto merge of #9007 : dcrewi/rust/random-bigints, r=huonw
bors [Wed, 11 Sep 2013 10:11:05 +0000 (03:11 -0700)]
auto merge of #9007 : dcrewi/rust/random-bigints, r=huonw

10 years agoauto merge of #9093 : pnkfelix/rust/fsk-remove-oldvisit, r=alexcrichton
bors [Wed, 11 Sep 2013 08:46:07 +0000 (01:46 -0700)]
auto merge of #9093 : pnkfelix/rust/fsk-remove-oldvisit, r=alexcrichton

10 years agoauto merge of #9013 : alexcrichton/rust/generated-unsafe-blocks, r=sanxiyn
bors [Wed, 11 Sep 2013 07:36:07 +0000 (00:36 -0700)]
auto merge of #9013 : alexcrichton/rust/generated-unsafe-blocks, r=sanxiyn

This way syntax extensions can generate unsafe blocks without worrying about them generating unnecessary unsafe warnings. Perhaps a special keyword could be added to be used in macros, but I don't think that's the best solution.

Currently if you use `format!` and friends in an `unsafe` block you're guaranteed to get some unused-unsafe warnings which is unfortunate. We normally do want these warnings, but I'm ok ignoring them in the case of compiler-generated unsafe blocks. I tried to do this in the least intrusive way possible, but others may have better ideas about how to do this.

10 years agoFlag unsafe blocks from format! as compiler-generated
Alex Crichton [Fri, 6 Sep 2013 03:50:10 +0000 (20:50 -0700)]
Flag unsafe blocks from format! as compiler-generated

10 years agoImplement the notion of a "generated unsafe block"
Alex Crichton [Thu, 29 Aug 2013 06:47:26 +0000 (23:47 -0700)]
Implement the notion of a "generated unsafe block"

This way syntax extensions can generate unsafe blocks without worrying about
them generating unnecessary unsafe warnings. Perhaps a special keyword could be
added to be used in macros, but I don't think that's the best solution.

10 years agoDon't fail in TcpStream.flush
Steven Fackler [Wed, 11 Sep 2013 04:43:47 +0000 (21:43 -0700)]
Don't fail in TcpStream.flush

10 years agoauto merge of #9091 : sfackler/rust/buffered, r=alexcrichton
bors [Wed, 11 Sep 2013 04:36:06 +0000 (21:36 -0700)]
auto merge of #9091 : sfackler/rust/buffered, r=alexcrichton

The default buffer size is the same as the one in Java's BufferedWriter.

We may want BufferedWriter to have a Drop impl that flushes, but that
isn't possible right now due to #4252/#4430. This would be a bit
awkward due to the possibility of the inner flush failing. For what it's
worth, Java's BufferedReader doesn't have a flushing finalizer, but that
may just be because Java's finalizer support is awful.

The current implementation of BufferedStream is weird in my opinion, but
it's what the discussion in #8953 settled on.

I wrote a custom copy function since vec::copy_from doesn't optimize as
well as I would like.

Closes #8953

10 years agoBuffered I/O wrappers
Steven Fackler [Tue, 10 Sep 2013 05:38:43 +0000 (22:38 -0700)]
Buffered I/O wrappers

The default buffer size is the same as the one in Java's BufferedWriter.

We may want BufferedWriter to have a Drop impl that flushes, but that
isn't possible right now due to #4252/#4430. This would be a bit
awkward due to the possibility of the inner flush failing. For what it's
worth, Java's BufferedReader doesn't have a flushing finalizer, but that
may just be because Java's finalizer support is awful.

Closes #8953

10 years agoauto merge of #9111 : thestinger/rust/tycat, r=cmr
bors [Wed, 11 Sep 2013 02:41:14 +0000 (19:41 -0700)]
auto merge of #9111 : thestinger/rust/tycat, r=cmr

The line marked as being for `bot` was actually for `tycat_struct`, and
can be replaced with `tycat_other`.

10 years agoremove redundant tycat line from the binop table
Daniel Micay [Wed, 11 Sep 2013 02:36:26 +0000 (22:36 -0400)]
remove redundant tycat line from the binop table

The line marked as being for `bot` was actually for `tycat_struct`, and
can be replaced with `tycat_other`.

10 years agorustpkg: Pass command-line arguments to rustc
Tim Chevalier [Tue, 10 Sep 2013 18:41:05 +0000 (11:41 -0700)]
rustpkg: Pass command-line arguments to rustc

rustpkg now accepts most of rustc's command-line arguments and passes
them along to rustc when building or installing.

A few rarely-used arguments aren't implemented yet.

rustpkg doesn't support flags that don't make sense with rustpkg
(for example, --bin and --lib, which get inferred from crate file names).

Closes #8522

10 years agoauto merge of #9103 : jbclements/rust/let-var-hygiene, r=erickt
bors [Tue, 10 Sep 2013 22:16:04 +0000 (15:16 -0700)]
auto merge of #9103 : jbclements/rust/let-var-hygiene, r=erickt

update AST so that ExprBreak and ExprCont expressions contain names, not idents. Fixes #9047 and makes progress on #6993. Simplifies the compiler very slightly, should make it (infinitesimally) faster.

10 years agoadded test case
John Clements [Tue, 10 Sep 2013 20:52:27 +0000 (13:52 -0700)]
added test case

10 years agochange type of ExprLoop and ExprBreak elts from ident->name.
John Clements [Tue, 10 Sep 2013 19:01:44 +0000 (12:01 -0700)]
change type of ExprLoop and ExprBreak elts from ident->name.

Lots of downstream changes in librustc, should be infinitesimally faster.

10 years agodebuginfo: Support for namespaces for types
Michael Woerister [Mon, 9 Sep 2013 15:58:58 +0000 (17:58 +0200)]
debuginfo: Support for namespaces for types

10 years agodebuginfo: Support for namespaces (functions only)
Michael Woerister [Fri, 6 Sep 2013 14:00:08 +0000 (16:00 +0200)]
debuginfo: Support for namespaces (functions only)

10 years agodebuginfo: Wrapped namespace facilities of llvm::DIBuilder
Michael Woerister [Thu, 5 Sep 2013 11:29:30 +0000 (13:29 +0200)]
debuginfo: Wrapped namespace facilities of llvm::DIBuilder

10 years agoauto merge of #9094 : pnkfelix/rust/fsk-visitor-ports, r=huonw
bors [Tue, 10 Sep 2013 11:26:01 +0000 (04:26 -0700)]
auto merge of #9094 : pnkfelix/rust/fsk-visitor-ports, r=huonw

r? anyone

Remove some trivial Visitor structs, using their non-trivial Contexts as the Visitor implementation instead.

Removed a little bit of `@boxing` as well.

Part of ongoing work on #7081.

10 years agoauto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, r=catamorphism
bors [Tue, 10 Sep 2013 10:10:59 +0000 (03:10 -0700)]
auto merge of #9088 : nikomatsakis/rust/issue-6304-AST-tree-not-DAG, r=catamorphism

Ensures that each AST node has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654

10 years agoDelay assignment of node ids until after expansion. Ensures that each AST node
Niko Matsakis [Sat, 7 Sep 2013 02:11:55 +0000 (22:11 -0400)]
Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654

10 years agomiddle/entry.rs Visitor refactoring (#7081): unify Entry{Context,Visitor}.
Felix S. Klock II [Tue, 10 Sep 2013 09:24:04 +0000 (11:24 +0200)]
middle/entry.rs Visitor refactoring (#7081): unify Entry{Context,Visitor}.

10 years agogather_loans/mod.rs Visitor refactoring (#7081): unify GatherLoan{Ctxt,Visitor}.
Felix S. Klock II [Tue, 10 Sep 2013 09:04:11 +0000 (11:04 +0200)]
gather_loans/mod.rs Visitor refactoring (#7081): unify GatherLoan{Ctxt,Visitor}.

10 years agocheck_loans.rs Visitor refactoring (#7081): unify CheckLoan{Ctxt,Visitor}.
Felix S. Klock II [Tue, 10 Sep 2013 08:50:41 +0000 (10:50 +0200)]
check_loans.rs Visitor refactoring (#7081): unify CheckLoan{Ctxt,Visitor}.

10 years agoauto merge of #9090 : jbclements/rust/let-var-hygiene, r=luqmana
bors [Tue, 10 Sep 2013 08:06:00 +0000 (01:06 -0700)]
auto merge of #9090 : jbclements/rust/let-var-hygiene, r=luqmana

This appears to fix issue #9049. It also re-enables the ICE check on comparing idents for equality; it appears that ICEs are better than seg faults.

10 years agoRemove oldvisit.rs (yay!); part of #7081 refactoring.
Felix S. Klock II [Tue, 10 Sep 2013 07:00:53 +0000 (09:00 +0200)]
Remove oldvisit.rs (yay!); part of #7081 refactoring.

10 years agoauto merge of #9076 : blake2-ppc/rust/test-for-8585, r=huonw
bors [Tue, 10 Sep 2013 05:41:03 +0000 (22:41 -0700)]
auto merge of #9076 : blake2-ppc/rust/test-for-8585, r=huonw

The issue #8587 is fixed (the original testcase now passes); add that testcase to the suite.

Fixes #8587.

10 years agoadded run-pass test for issue #9049
John Clements [Tue, 10 Sep 2013 04:32:10 +0000 (21:32 -0700)]
added run-pass test for issue #9049

10 years agoauto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichton
bors [Tue, 10 Sep 2013 04:31:03 +0000 (21:31 -0700)]
auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichton

Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations.

Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument.

Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end.

Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`.

Remove `equal_sizes`

10 years agoundo cowardly hiding of eq-check
John Clements [Tue, 10 Sep 2013 03:50:41 +0000 (20:50 -0700)]
undo cowardly hiding of eq-check

I've reversed my thinking on this restrictive definition of eq after
two separate bugs were hidden by commenting it out; it's better to
get ICEs than SIGSEGV's, any day.

RE-ENABLING ICE MACHINE!

10 years agostd::at_vec and vec: Unify build_sized, build_sized_opt into build
blake2-ppc [Tue, 10 Sep 2013 03:50:11 +0000 (05:50 +0200)]
std::at_vec and vec: Unify build_sized, build_sized_opt into build

These functions have very few users since they are mostly replaced by
iterator-based constructions.

Convert a few remaining users in-tree, and reduce the number of
functions by basically renaming build_sized_opt to build, and removing
the other two. This for both the vec and the at_vec versions.

10 years agostd::vec: Remove the function same_length
blake2-ppc [Tue, 10 Sep 2013 01:55:34 +0000 (03:55 +0200)]
std::vec: Remove the function same_length

The basic construct x.len() == y.len() is just as simple.

This function used to be a precondition (not sure about the
terminology), so it had to be a function. This is not relevant any more.

10 years agostd::vec: Update module doc text
blake2-ppc [Mon, 9 Sep 2013 16:32:35 +0000 (18:32 +0200)]
std::vec: Update module doc text

Update for a lot of changes (not many free functions left), add examples
of the important methods `slice` and `push`, and write a short bit about
iteration.

10 years agostd::vec: Replace each_permutation with a new Permutations iterator
blake2-ppc [Sun, 8 Sep 2013 23:29:07 +0000 (01:29 +0200)]
std::vec: Replace each_permutation with a new Permutations iterator

Introduce ElementSwaps and Permutations. ElementSwaps is an iterator
that for a given sequence length yields the element swaps needed
to visit each possible permutation of the sequence in turn.

We use an algorithm that generates a sequence such that each permutation
is only one swap apart.

    let mut v = [1, 2, 3];
    for perm in v.permutations_iter() {
        // yields 1 2 3 | 1 3 2 | 3 1 2 | 3 2 1 | 2 3 1 | 2 1 3
    }

The `.permutations_iter()` yields clones of the input vector for each
permutation.

If a copyless traversal is needed, it can be constructed with
`ElementSwaps`:

    for (a, b) in ElementSwaps::new(3) {
        // yields (2, 1), (1, 0), (2, 1) ...
        v.swap(a, b);
        // ..
    }

10 years agoident->name in middle
John Clements [Mon, 9 Sep 2013 23:43:27 +0000 (16:43 -0700)]
ident->name in middle

10 years agostd::vec: Change fn unzip to take an iterator argument
blake2-ppc [Mon, 9 Sep 2013 02:46:32 +0000 (04:46 +0200)]
std::vec: Change fn unzip to take an iterator argument

Remove unzip_slice since it's redundant. Old unzip is equivalent to the
`|x| unzip(x.move_iter())`

10 years agoauto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajack
bors [Tue, 10 Sep 2013 03:16:02 +0000 (20:16 -0700)]
auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajack

r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.

10 years agoauto merge of #9086 : pcwalton/rust/writeback-port, r=brson
bors [Tue, 10 Sep 2013 02:06:02 +0000 (19:06 -0700)]
auto merge of #9086 : pcwalton/rust/writeback-port, r=brson

r? @brson or @pnkfelix

10 years agoauto merge of #9089 : anasazi/rust/fix-acceptor-iterator, r=cmr
bors [Mon, 9 Sep 2013 23:26:03 +0000 (16:26 -0700)]
auto merge of #9089 : anasazi/rust/fix-acceptor-iterator, r=cmr

The iterator over incoming connections has no natural end, so it should always return Some(_).
Currently, if an incoming connection fails, the iterator returns None.
Trying to accept another connection afterwards enters the realm of undefined behavior (due to the iterator protocol being silent on the issue).

This PR changes wraps the underlying accept call in Some, so the iterator never finishes.

10 years agoauto merge of #9083 : dcrewi/rust/biguint-bit-ops, r=brson
bors [Mon, 9 Sep 2013 21:10:58 +0000 (14:10 -0700)]
auto merge of #9083 : dcrewi/rust/biguint-bit-ops, r=brson

10 years agolibrustc: Port writeback to the new API.
Patrick Walton [Mon, 9 Sep 2013 21:10:58 +0000 (14:10 -0700)]
librustc: Port writeback to the new API.

10 years agoauto merge of #9071 : thestinger/rust/noalias, r=alexcrichton
bors [Mon, 9 Sep 2013 20:01:02 +0000 (13:01 -0700)]
auto merge of #9071 : thestinger/rust/noalias, r=alexcrichton

This also removes a FIXME I added referring to a now closed issue.

10 years agoauto merge of #9033 : alexcrichton/rust/libuv-makefile-dep, r=brson
bors [Mon, 9 Sep 2013 18:51:03 +0000 (11:51 -0700)]
auto merge of #9033 : alexcrichton/rust/libuv-makefile-dep, r=brson

This way the rule isn't always built whenever you fire off a new build

10 years agoadd `noalias` attribute to ~ return values
Daniel Micay [Mon, 9 Sep 2013 06:32:30 +0000 (02:32 -0400)]
add `noalias` attribute to ~ return values

10 years agoauto merge of #9005 : alexcrichton/rust/rusty-log, r=brson
bors [Mon, 9 Sep 2013 17:41:05 +0000 (10:41 -0700)]
auto merge of #9005 : alexcrichton/rust/rusty-log, r=brson

Also redefine all of the standard logging macros to use more rust code instead
of custom LLVM translation code. This makes them a bit easier to understand, but
also more flexibile for future types of logging.

Additionally, this commit removes the LogType language item in preparation for
changing how logging is performed.

10 years agoImplement bitwise operations on BigUint
David Creswick [Sat, 7 Sep 2013 01:47:54 +0000 (20:47 -0500)]
Implement bitwise operations on BigUint

10 years agoMerge RandBigUint and RandBigInt into single trait
David Creswick [Mon, 9 Sep 2013 16:31:40 +0000 (11:31 -0500)]
Merge RandBigUint and RandBigInt into single trait

10 years agoConvert between BigInts, BigUints, ints, and uints
David Creswick [Mon, 9 Sep 2013 16:15:03 +0000 (11:15 -0500)]
Convert between BigInts, BigUints, ints, and uints

Previously, conversion to ints, uints, and BigUints clamped the value
within the range of that datatype. With this commit, conversion
overflows fail the task. To handle overflows gracefully, use the new
to_*_opt() methods.

10 years agoAdd test for issue #8587, about calling nested functions of the same name
blake2-ppc [Mon, 9 Sep 2013 14:01:42 +0000 (16:01 +0200)]
Add test for issue #8587, about calling nested functions of the same name

10 years agoauto merge of #9051 : bjz/rust/master, r=huonw
bors [Mon, 9 Sep 2013 13:06:04 +0000 (06:06 -0700)]
auto merge of #9051 : bjz/rust/master, r=huonw

10 years agoauto merge of #9059 : Kimundi/rust/master, r=huonw
bors [Mon, 9 Sep 2013 11:51:05 +0000 (04:51 -0700)]
auto merge of #9059 : Kimundi/rust/master, r=huonw

- Marked a unsafe helper function as unsafe, added a second helper function
- Added moving implementations

10 years agoSome work on std::ascii: Marked unsafe function unsafe, added moving implementations
Marvin Löbel [Sun, 8 Sep 2013 23:45:14 +0000 (01:45 +0200)]
Some work on std::ascii: Marked unsafe function unsafe, added moving implementations

10 years agoauto merge of #9073 : alexcrichton/rust/remove-local-data-hax, r=huonw
bors [Mon, 9 Sep 2013 09:36:06 +0000 (02:36 -0700)]
auto merge of #9073 : alexcrichton/rust/remove-local-data-hax, r=huonw

These compiler bugs have since been fixed (one less layer of indirection)

10 years agoRemove hacks around issues in local_data
Alex Crichton [Mon, 9 Sep 2013 08:01:23 +0000 (01:01 -0700)]
Remove hacks around issues in local_data

These compiler bugs have since been fixed (one less layer of indirection)

10 years agoauto merge of #9065 : thestinger/rust/iter, r=alexcrichton
bors [Mon, 9 Sep 2013 07:26:07 +0000 (00:26 -0700)]
auto merge of #9065 : thestinger/rust/iter, r=alexcrichton

The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.

10 years agorename `std::iterator` to `std::iter`
Daniel Micay [Sun, 8 Sep 2013 15:01:16 +0000 (11:01 -0400)]
rename `std::iterator` to `std::iter`

The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.

10 years agoauto merge of #9066 : thestinger/rust/repr, r=alexcrichton
bors [Mon, 9 Sep 2013 05:16:07 +0000 (22:16 -0700)]
auto merge of #9066 : thestinger/rust/repr, r=alexcrichton

10 years agorustpkg: Address review comments from Jack
Tim Chevalier [Mon, 9 Sep 2013 05:00:49 +0000 (22:00 -0700)]
rustpkg: Address review comments from Jack

10 years agoextra: Address review comments from Jack
Tim Chevalier [Mon, 9 Sep 2013 05:00:13 +0000 (22:00 -0700)]
extra: Address review comments from Jack

10 years agorepr: update for removal of const
Daniel Micay [Mon, 9 Sep 2013 03:16:49 +0000 (23:16 -0400)]
repr: update for removal of const

10 years agorepr: write the mutability qualifier for slices
Daniel Micay [Mon, 9 Sep 2013 03:13:31 +0000 (23:13 -0400)]
repr: write the mutability qualifier for slices

10 years agorustpkg: Use workcache
Tim Chevalier [Sat, 7 Sep 2013 03:29:16 +0000 (20:29 -0700)]
rustpkg: Use workcache

rustpkg now uses the workcache library to avoid recompilation.
Hooray!

10 years agoworkcache: Add the ability to save and load the database...
Tim Chevalier [Sat, 7 Sep 2013 01:59:29 +0000 (18:59 -0700)]
workcache: Add the ability to save and load the database...

...as well as the ability to discover inputs and outputs.

10 years agoFix pretty-printing of empty impl items
Jakub [Sun, 8 Sep 2013 22:43:58 +0000 (22:43 +0000)]
Fix pretty-printing of empty impl items

10 years agoauto merge of #8988 : cmr/rust/fromstr_fn, r=brson
bors [Sun, 8 Sep 2013 19:05:55 +0000 (12:05 -0700)]
auto merge of #8988 : cmr/rust/fromstr_fn, r=brson

It just calls out to the associated function on the trait.

10 years agoFix import order which caused the wrong from_str to be in scope
Corey Richardson [Sun, 8 Sep 2013 19:00:00 +0000 (15:00 -0400)]
Fix import order which caused the wrong from_str to be in scope

10 years agoFix unused import warnings on 32bit systems
Brendan Zabarauskas [Sun, 8 Sep 2013 17:51:29 +0000 (03:51 +1000)]
Fix unused import warnings on 32bit systems

10 years agoauto merge of #9054 : huonw/rust/labelled-for, r=thestinger
bors [Sun, 8 Sep 2013 14:45:57 +0000 (07:45 -0700)]
auto merge of #9054 : huonw/rust/labelled-for, r=thestinger

The following parses and works as expected with this change:

```rust
'foo: for i in range(0, 10) {
    for j in range(0, 10) {
        if i + j == 15 { break 'foo; }
    }
}
```

10 years agosyntax: aesthetic improvements to the `for` desugaring.
Huon Wilson [Sun, 8 Sep 2013 12:46:20 +0000 (22:46 +1000)]
syntax: aesthetic improvements to the `for` desugaring.

10 years agosyntax: implement labelled breaks for `for`.
Huon Wilson [Sun, 8 Sep 2013 12:08:01 +0000 (22:08 +1000)]
syntax: implement labelled breaks for `for`.

`for` desugars to `loop` so it is trivial to just desugar to `loop` while
retaining any label.

10 years agoauto merge of #9035 : alexcrichton/rust/fewer-clownshoes, r=huonw
bors [Sun, 8 Sep 2013 08:05:59 +0000 (01:05 -0700)]
auto merge of #9035 : alexcrichton/rust/fewer-clownshoes, r=huonw

This removes another large chunk of this odd 'clownshoes' identifier showing up
in symbol names. These all originated from external crates because the encoded
items were encoded independently of the paths calculated in ast_map. The
encoding of these paths now uses the helper function in ast_map to calculate the
"pretty name" for an impl block.

Unfortunately there is still no information about generics in the symbol name,
but it's certainly vastly better than before

    hash::__extensions__::write::_version::v0.8

becomes

    hash::Writer$SipState::write::hversion::v0.8

This also fixes bugs in which lots of methods would show up as `meth_XXX`, they
now only show up as `meth` and throw some extra characters onto the version
string.

10 years agoAdd Clone and DeepClone constraints to Primitive trait
Brendan Zabarauskas [Sat, 7 Sep 2013 07:16:56 +0000 (17:16 +1000)]
Add Clone and DeepClone constraints to Primitive trait

10 years agoMoved checked trait impls out of std::num
Brendan Zabarauskas [Sat, 7 Sep 2013 07:15:35 +0000 (17:15 +1000)]
Moved checked trait impls out of std::num

This follows the same pattern as the other numeric trait impls, and reduces the clutter in std::num.

10 years agoauto merge of #9050 : huonw/rust/unfoldnor, r=thestinger
bors [Sun, 8 Sep 2013 01:10:59 +0000 (18:10 -0700)]
auto merge of #9050 : huonw/rust/unfoldnor, r=thestinger

The `r` is not relevant, since there is only one direction of folding
(unlike Haskell).