]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoAdd test for repeat expr in statics.
Luqman Aden [Tue, 13 Aug 2013 01:15:19 +0000 (21:15 -0400)]
Add test for repeat expr in statics.

10 years agolibrustc: Allow vector repeat exprs in statics.
Luqman Aden [Tue, 13 Aug 2013 01:10:29 +0000 (21:10 -0400)]
librustc: Allow vector repeat exprs in statics.

10 years agoauto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr
bors [Mon, 12 Aug 2013 18:53:18 +0000 (11:53 -0700)]
auto merge of #8400 : blake2-ppc/rust/seq-ord, r=cmr

Use Eq + Ord for lexicographical ordering of sequences.

For each of <, <=, >= or > as R, use::

    [x, ..xs] R [y, ..ys]  =  if x != y { x R y } else { xs R ys }

Previous code using `a < b` and then `!(b < a)` for short-circuiting
fails on cases such as  [1.0, 2.0] < [0.0/0.0, 3.0], where the first
element was effectively considered equal.

Containers like &[T] did also implement only one comparison operator `<`,
and derived the comparison results from this. This isn't correct either for
Ord.

Implement functions in `std::iterator::order::{lt,le,gt,ge,equal,cmp}` that all
iterable containers can use for lexical order.

We also visit tuple ordering, having the same problem and same solution
(but differing implementation).

10 years agoauto merge of #8429 : catamorphism/rust/rustpkg-docs, r=catamorphism
bors [Mon, 12 Aug 2013 15:17:14 +0000 (08:17 -0700)]
auto merge of #8429 : catamorphism/rust/rustpkg-docs, r=catamorphism

10 years agoauto merge of #8428 : blake2-ppc/rust/peekable-iterators, r=thestinger
bors [Mon, 12 Aug 2013 11:29:11 +0000 (04:29 -0700)]
auto merge of #8428 : blake2-ppc/rust/peekable-iterators, r=thestinger

Peekable changes by @SimonSapin and original PR is #8396

10 years agoauto merge of #8418 : pnkfelix/rust/fsk-issue3192-improve-parse-error-for-empty-struc...
bors [Mon, 12 Aug 2013 07:32:11 +0000 (00:32 -0700)]
auto merge of #8418 : pnkfelix/rust/fsk-issue3192-improve-parse-error-for-empty-struct-init, r=pcwalton,me

Fix #3192.  r? anyone

There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.

10 years agoauto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn
bors [Mon, 12 Aug 2013 03:50:14 +0000 (20:50 -0700)]
auto merge of #8410 : luqmana/rust/mcpu, r=sanxiyn

Adds `--target-cpu` flag which lets you choose a more specific target cpu instead of just passing the default, `generic`. It's more or less akin to `-mcpu`/`-mtune` in clang/gcc.

10 years agoauto merge of #8427 : brson/rust/rustc-stack, r=thestinger
bors [Mon, 12 Aug 2013 00:38:09 +0000 (17:38 -0700)]
auto merge of #8427 : brson/rust/rustc-stack, r=thestinger

A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.

10 years agoauto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
bors [Sun, 11 Aug 2013 21:17:09 +0000 (14:17 -0700)]
auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon

Fix #5762 and various other aspects of object invocation.

r? @graydon

10 years agoConvert from transform to map
Niko Matsakis [Sun, 11 Aug 2013 18:56:43 +0000 (14:56 -0400)]
Convert from transform to map

10 years agotests: Add new tests for borrowck/objects and update some existing tests
Niko Matsakis [Sun, 11 Aug 2013 17:58:48 +0000 (13:58 -0400)]
tests: Add new tests for borrowck/objects and update some existing tests

10 years agoUpdate type visitor to use &Visitor and not @Visitor
Niko Matsakis [Sun, 11 Aug 2013 17:58:01 +0000 (13:58 -0400)]
Update type visitor to use &Visitor and not @Visitor

10 years agoborrowck: Integrate AutoBorrowObj into borrowck / mem_categorization
Niko Matsakis [Sun, 11 Aug 2013 17:56:30 +0000 (13:56 -0400)]
borrowck: Integrate AutoBorrowObj into borrowck / mem_categorization

Also cleanup the treatment of mutability in mem_categorization, which still
included the concept of interior mutability. At some point, we should
refactor the types to exclude the possibility of interior mutability rather
than just ignoring the mutability value in those cases.

10 years agotypeck: Modify method resolution to use new object adjustments, and
Niko Matsakis [Sun, 11 Aug 2013 17:44:26 +0000 (13:44 -0400)]
typeck: Modify method resolution to use new object adjustments, and
to favor inherent methods over extension methods.

The reason to favor inherent methods is that otherwise an impl
like

    impl Foo for @Foo { fn method(&self) { self.method() } }

causes infinite recursion.  The current change to favor inherent methods is
rather hacky; the method resolution code is in need of a refactoring.

10 years agotrans: Rely on new AutoBorrowObj adjustment to match up object receivers
Niko Matsakis [Sun, 11 Aug 2013 17:42:26 +0000 (13:42 -0400)]
trans: Rely on new AutoBorrowObj adjustment to match up object receivers

Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)

10 years agoty: Add (but do not yet use) AutoBorrowObject option to adjustments
Niko Matsakis [Sun, 11 Aug 2013 17:39:05 +0000 (13:39 -0400)]
ty: Add (but do not yet use) AutoBorrowObject option to adjustments

Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)

10 years agotypeck/check/method: Remove `pub` from most methods
Niko Matsakis [Sun, 11 Aug 2013 17:36:36 +0000 (13:36 -0400)]
typeck/check/method: Remove `pub` from most methods

10 years agoMisc small cleanups
Niko Matsakis [Sun, 11 Aug 2013 17:34:18 +0000 (13:34 -0400)]
Misc small cleanups

10 years agoAdd a field `borrow_offset` to the type descriptor indicating
Niko Matsakis [Sun, 11 Aug 2013 17:29:14 +0000 (13:29 -0400)]
Add a field `borrow_offset` to the type descriptor indicating
what amount a T* pointer must be adjusted to reach the contents
of the box. For `~T` types, this requires knowing the type `T`,
which is not known in the case of objects.

10 years agoauto merge of #8420 : blake2-ppc/rust/shrink-token, r=cmr
bors [Sun, 11 Aug 2013 17:50:10 +0000 (10:50 -0700)]
auto merge of #8420 : blake2-ppc/rust/shrink-token, r=cmr

`enum Token` was 192 bytes (64-bit), as pointed out by pnkfelix; the only
bloating variant being `INTERPOLATED(nonterminal)`.

Updating `enum nonterminal` to use ~ where variants included big types,
shrunk size_of(Token) to 32 bytes (64-bit).

I am unsure if the `nt_ident` variant should have an indirection, with
ast::ident being only 16 bytes (64-bit), but without this, enum Token
would be 40 bytes.

A dumb benchmark says that compilation time is unchanged, while peak
memory usage for compiling std.rs is down 3%

Before::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.00user 0.39system 0:19.41elapsed 99%CPU (0avgtext+0avgdata 627820maxresident)k
    0inputs+28896outputs (0major+228665minor)pagefaults 0swaps
    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.64user 0.34system 0:32.02elapsed 99%CPU (0avgtext+0avgdata 629876maxresident)k
    0inputs+22432outputs (0major+229411minor)pagefaults 0swaps

After::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.07user 0.45system 0:19.55elapsed 99%CPU (0avgtext+0avgdata 609384maxresident)k
    0inputs+28896outputs (0major+221997minor)pagefaults 0swaps

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.90user 0.34system 0:32.28elapsed 99%CPU (0avgtext+0avgdata 612080maxresident)k
    0inputs+22432outputs (0major+223726minor)pagefaults 0swaps

10 years agolibrustc: Convert from `@Object` to `@mut Object` as needed
Niko Matsakis [Sun, 11 Aug 2013 17:26:59 +0000 (13:26 -0400)]
librustc: Convert from `@Object` to `@mut Object` as needed

10 years agolibsyntax: Update from `@Object` to `@mut Object` as required
Niko Matsakis [Sun, 11 Aug 2013 17:23:40 +0000 (13:23 -0400)]
libsyntax: Update from `@Object` to `@mut Object` as required

10 years agoauto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger
bors [Sun, 11 Aug 2013 14:29:07 +0000 (07:29 -0700)]
auto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger

This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

```
fmt           310k
ifmt (before) 529k
ifmt (after)  202k
```

This now means that ifmt! is both faster and smaller than fmt!, yay!

10 years agoauto merge of #8412 : thestinger/rust/vector-add, r=alexcrichton
bors [Sun, 11 Aug 2013 11:11:08 +0000 (04:11 -0700)]
auto merge of #8412 : thestinger/rust/vector-add, r=alexcrichton

10 years agoauto merge of #8408 : thestinger/rust/checked, r=Aatch
bors [Sun, 11 Aug 2013 07:47:07 +0000 (00:47 -0700)]
auto merge of #8408 : thestinger/rust/checked, r=Aatch

10 years agofix unused imports
Daniel Micay [Sun, 11 Aug 2013 07:17:01 +0000 (03:17 -0400)]
fix unused imports

10 years agomove `strdup_uniq` lang item to std::str
Daniel Micay [Sat, 10 Aug 2013 17:42:53 +0000 (13:42 -0400)]
move `strdup_uniq` lang item to std::str

10 years agostr: optimize `with_capacity`
Daniel Micay [Sat, 10 Aug 2013 17:32:05 +0000 (13:32 -0400)]
str: optimize `with_capacity`

before:

test bench_with_capacity ... bench: 104 ns/iter (+/- 4)

after:

test bench_with_capacity ... bench: 56 ns/iter (+/- 1)

10 years agovec: optimize the Add implementation
Daniel Micay [Fri, 9 Aug 2013 03:49:49 +0000 (23:49 -0400)]
vec: optimize the Add implementation

before:

test add ... bench: 164 ns/iter (+/- 1)

after:

test add ... bench: 113 ns/iter (+/- 2)

10 years agodisable 64-bit CheckedMul on 32-bit
Daniel Micay [Sun, 11 Aug 2013 06:58:52 +0000 (02:58 -0400)]
disable 64-bit CheckedMul on 32-bit

code generation problem reported as issue #8449

10 years agoadd intrinsics for checked overflow add/sub/mul
Daniel Micay [Wed, 7 Aug 2013 19:40:09 +0000 (15:40 -0400)]
add intrinsics for checked overflow add/sub/mul

10 years agosyntax: Shrink enum Token and enum nonterminal
blake2-ppc [Fri, 9 Aug 2013 17:55:15 +0000 (19:55 +0200)]
syntax: Shrink enum Token and enum nonterminal

`enum Token` was 192 bytes (64-bit), as pointed out by pnkfelix; the only
bloating variant being `INTERPOLATED(nonterminal)`.

Updating `enum nonterminal` to use ~ where variants included big types,
shrunk size_of(Token) to 32 bytes (64-bit).

I am unsure if the `nt_ident` variant should have an indirection, with
ast::ident being only 16 bytes (64-bit), but without this, enum Token
would be 40 bytes.

A dumb benchmark says that compilation time is unchanged, while peak
memory usage for compiling std.rs is down 3%

Before::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.00user 0.39system 0:19.41elapsed 99%CPU (0avgtext+0avgdata 627820maxresident)k
    0inputs+28896outputs (0major+228665minor)pagefaults 0swaps
    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.64user 0.34system 0:32.02elapsed 99%CPU (0avgtext+0avgdata 629876maxresident)k
    0inputs+22432outputs (0major+229411minor)pagefaults 0swaps

After::

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc --cfg stage1 src/libstd/std.rs
    19.07user 0.45system 0:19.55elapsed 99%CPU (0avgtext+0avgdata 609384maxresident)k
    0inputs+28896outputs (0major+221997minor)pagefaults 0swaps

    $ time ./x86_64-unknown-linux-gnu/stage1/bin/rustc -O --cfg stage1 src/libstd/std.rs
    31.90user 0.34system 0:32.28elapsed 99%CPU (0avgtext+0avgdata 612080maxresident)k
    0inputs+22432outputs (0major+223726minor)pagefaults 0swaps

10 years agoauto merge of #8404 : stepancheg/rust/zero-unit-inline, r=alexcrichton
bors [Sun, 11 Aug 2013 02:53:06 +0000 (19:53 -0700)]
auto merge of #8404 : stepancheg/rust/zero-unit-inline, r=alexcrichton

Follow-up to #8155

10 years agoextra::treemap: Use IteratorUtil::peekable
blake2-ppc [Fri, 9 Aug 2013 21:31:57 +0000 (23:31 +0200)]
extra::treemap: Use IteratorUtil::peekable

Replace the previous equivalent iterator adaptor with .peekable().
Refactor the set operation iterators so that they are easier to read.

10 years agoAdd a "peekable" iterator adaptor, with a peek() method that returns the next element.
Simon Sapin [Thu, 8 Aug 2013 19:46:36 +0000 (20:46 +0100)]
Add a "peekable" iterator adaptor, with a peek() method that returns the next element.

10 years agostd::iterator: Rename .peek() to .inspect()
blake2-ppc [Sat, 10 Aug 2013 23:55:34 +0000 (01:55 +0200)]
std::iterator: Rename .peek() to .inspect()

10 years agoauto merge of #8444 : erickt/rust/rollup, r=cmr
bors [Sat, 10 Aug 2013 23:32:18 +0000 (16:32 -0700)]
auto merge of #8444 : erickt/rust/rollup, r=cmr

This merges these PR together:

#8430: r=thestinger
#8370: r=thestinger
#8386: r=bstrie
#8388: r=thestinger
#8390: r=graydon
#8394: r=graydon
#8402: r=thestinger
#8403: r=catamorphism

10 years agorustc: Add --target-cpu flag to select a more specific processor instead of the defau...
Luqman Aden [Fri, 9 Aug 2013 02:16:00 +0000 (22:16 -0400)]
rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'.

10 years agoauto merge of #8430 : erickt/rust/cleanup-iterators, r=erickt
bors [Sat, 10 Aug 2013 20:17:19 +0000 (13:17 -0700)]
auto merge of #8430 : erickt/rust/cleanup-iterators, r=erickt

This PR does a bunch of cleaning up of various APIs. The major one is that it merges `Iterator` and `IteratorUtil`, and renames functions like `transform` into `map`. I also merged `DoubleEndedIterator` and `DoubleEndedIteratorUtil`, as well as I renamed various .consume* functions to .move_iter(). This helps to implement part of #7887.

10 years agoMerge branch 'match' of https://github.com/msullivan/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:04:16 +0000 (13:04 -0700)]
Merge branch 'match' of https://github.com/msullivan/rust into rollup

10 years agoMerge branch 'master' of https://github.com/MAnyKey/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:03:34 +0000 (13:03 -0700)]
Merge branch 'master' of https://github.com/MAnyKey/rust into rollup

10 years agoMerge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis...
Erick Tryzelaar [Sat, 10 Aug 2013 20:03:19 +0000 (13:03 -0700)]
Merge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis/rust into rollup

10 years agoMerge branch 'master' of https://github.com/p2j4d2c/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:02:44 +0000 (13:02 -0700)]
Merge branch 'master' of https://github.com/p2j4d2c/rust into rollup

10 years agoMerge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:01:20 +0000 (13:01 -0700)]
Merge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup

10 years agoMerge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup
Erick Tryzelaar [Sat, 10 Aug 2013 20:00:20 +0000 (13:00 -0700)]
Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup

10 years agoMerge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into...
Erick Tryzelaar [Sat, 10 Aug 2013 19:59:52 +0000 (12:59 -0700)]
Merge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into rollup

Conflicts:
src/libsyntax/opt_vec.rs

10 years agoMerge remote-tracking branch 'remotes/origin/master' into cleanup-iterators
Erick Tryzelaar [Sat, 10 Aug 2013 19:04:40 +0000 (12:04 -0700)]
Merge remote-tracking branch 'remotes/origin/master' into cleanup-iterators

10 years agoauto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblum
bors [Sat, 10 Aug 2013 14:47:14 +0000 (07:47 -0700)]
auto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblum

I'm a bit disappointed that I couldn't figure out how to factor out more of the code implementing `extra::sync` but I feel this is an okay start. Also I added some documentation explaining that `WaitQueue` isn't thread safe, and needs an exclusive lock.

@bblum

10 years agosyntax and rustc: fix some warnings
Erick Tryzelaar [Sat, 10 Aug 2013 14:14:10 +0000 (07:14 -0700)]
syntax and rustc: fix some warnings

10 years agostd: fix the non-stage0 str::raw::slice_bytes which broke in a merge
Erick Tryzelaar [Sat, 10 Aug 2013 14:13:47 +0000 (07:13 -0700)]
std: fix the non-stage0 str::raw::slice_bytes which broke in a merge

10 years agostd: Transform.find_ -> .find
Erick Tryzelaar [Sat, 10 Aug 2013 03:49:29 +0000 (20:49 -0700)]
std: Transform.find_ -> .find

10 years agostd: Iterator.len_ -> .len
Erick Tryzelaar [Sat, 10 Aug 2013 03:30:03 +0000 (20:30 -0700)]
std: Iterator.len_ -> .len

10 years agostd: Iterator.last_ -> .last
Erick Tryzelaar [Sat, 10 Aug 2013 03:25:45 +0000 (20:25 -0700)]
std: Iterator.last_ -> .last

10 years agostd: Iterator.chain_ -> .chain
Erick Tryzelaar [Sat, 10 Aug 2013 03:22:59 +0000 (20:22 -0700)]
std: Iterator.chain_ -> .chain

10 years agostd: Iterator.flat_map_ -> .flat_map
Erick Tryzelaar [Sat, 10 Aug 2013 03:20:05 +0000 (20:20 -0700)]
std: Iterator.flat_map_ -> .flat_map

10 years agostd: Iterator.take_ -> .take
Erick Tryzelaar [Sat, 10 Aug 2013 03:16:07 +0000 (20:16 -0700)]
std: Iterator.take_ -> .take

10 years agostd: Rename Iterator.transform -> .map
Erick Tryzelaar [Sat, 10 Aug 2013 03:09:47 +0000 (20:09 -0700)]
std: Rename Iterator.transform -> .map

cc #5898

10 years agostd: merge Iterator and IteratorUtil
Erick Tryzelaar [Fri, 9 Aug 2013 14:19:23 +0000 (07:19 -0700)]
std: merge Iterator and IteratorUtil

10 years agostd: merge iterator::DoubleEndedIterator and DoubleEndedIteratorUtil
Erick Tryzelaar [Fri, 9 Aug 2013 03:33:28 +0000 (20:33 -0700)]
std: merge iterator::DoubleEndedIterator and DoubleEndedIteratorUtil

10 years agoClean up some unused imports in tests
Erick Tryzelaar [Thu, 8 Aug 2013 13:48:20 +0000 (06:48 -0700)]
Clean up some unused imports in tests

10 years agoMass rename of .consume{,_iter}() to .move_iter()
Erick Tryzelaar [Thu, 8 Aug 2013 02:21:36 +0000 (19:21 -0700)]
Mass rename of .consume{,_iter}() to .move_iter()

cc #7887

10 years agoauto merge of #8270 : dotdash/rust/ret_alloca_elim, r=pcwalton
bors [Sat, 10 Aug 2013 11:44:13 +0000 (04:44 -0700)]
auto merge of #8270 : dotdash/rust/ret_alloca_elim, r=pcwalton

When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238

10 years agoElide unnecessary ret slot allocas
Björn Steinbrink [Sun, 28 Jul 2013 14:40:35 +0000 (16:40 +0200)]
Elide unnecessary ret slot allocas

When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238

10 years agoauto merge of #8425 : dim-an/rust/increase-stack-size, r=brson
bors [Sat, 10 Aug 2013 08:20:14 +0000 (01:20 -0700)]
auto merge of #8425 : dim-an/rust/increase-stack-size, r=brson

10 years agoauto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
bors [Sat, 10 Aug 2013 04:56:17 +0000 (21:56 -0700)]
auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt

This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects:

*  No interior nulls
* Ends with a trailing null

10 years agoMerge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
Erick Tryzelaar [Sat, 10 Aug 2013 01:48:01 +0000 (18:48 -0700)]
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls

10 years agoauto merge of #8387 : brson/rust/nooldrt, r=brson
bors [Sat, 10 Aug 2013 01:41:13 +0000 (18:41 -0700)]
auto merge of #8387 : brson/rust/nooldrt, r=brson

10 years agodocs: In rustpkg manual, note future plans about versions
Tim Chevalier [Sat, 10 Aug 2013 01:25:02 +0000 (18:25 -0700)]
docs: In rustpkg manual, note future plans about versions

10 years agoFix interaction between default matches and guards. Closes #3121.
Michael Sullivan [Sat, 10 Aug 2013 00:39:21 +0000 (17:39 -0700)]
Fix interaction between default matches and guards. Closes #3121.

10 years agorustc: Obey RUST_MIN_STACK env var
Brian Anderson [Sat, 10 Aug 2013 00:28:27 +0000 (17:28 -0700)]
rustc: Obey RUST_MIN_STACK env var

A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.

10 years agoRemove the C++ runtime. Sayonara
Brian Anderson [Thu, 1 Aug 2013 06:12:20 +0000 (23:12 -0700)]
Remove the C++ runtime. Sayonara

10 years agoIncrease system stack size.
Dmitry Ermolov [Fri, 9 Aug 2013 23:37:39 +0000 (03:37 +0400)]
Increase system stack size.

10 years agoauto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
bors [Fri, 9 Aug 2013 23:17:10 +0000 (16:17 -0700)]
auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism

r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).

10 years agoFix some warnings.
Michael Sullivan [Fri, 9 Aug 2013 23:07:26 +0000 (16:07 -0700)]
Fix some warnings.

10 years agorustpkg: Simplify the PkgId struct
Tim Chevalier [Fri, 2 Aug 2013 23:59:58 +0000 (16:59 -0700)]
rustpkg: Simplify the PkgId struct

Get rid of special cases for names beginning with "rust-" or
containing hyphens, and just store a Path in a package ID. The Rust-identifier
for the crate is none of rustpkg's business.

10 years agostd/rustc/rustpkg/syntax: Support the `extern mod = ...` form
Tim Chevalier [Wed, 31 Jul 2013 20:47:32 +0000 (13:47 -0700)]
std/rustc/rustpkg/syntax: Support the `extern mod = ...` form

This commit allows you to write:

 extern mod x = "a/b/c";

which means rustc will search in the RUST_PATH for a package with
ID a/b/c, and bind it to the name `x` if it's found.

Incidentally, move get_relative_to from back::rpath into std::path

10 years agorustpkg: another fix for windows
Erick Tryzelaar [Fri, 9 Aug 2013 21:06:03 +0000 (14:06 -0700)]
rustpkg: another fix for windows

10 years agoauto merge of #8415 : brson/rust/newrt-local-heap-perf, r=pcwalton,brson
bors [Fri, 9 Aug 2013 20:53:08 +0000 (13:53 -0700)]
auto merge of #8415 : brson/rust/newrt-local-heap-perf, r=pcwalton,brson

Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.

10 years agoImplement an `address_insignificant` attribute
Alex Crichton [Fri, 9 Aug 2013 20:47:00 +0000 (13:47 -0700)]
Implement an `address_insignificant` attribute

This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

fmt           310k
ifmt (before) 529k
ifmt (after)  202k

This now means that ifmt! is both faster and smaller than fmt!, yay!

10 years agoFix vector pattern matching. Closes #6909.
Michael Sullivan [Thu, 8 Aug 2013 22:19:19 +0000 (15:19 -0700)]
Fix vector pattern matching. Closes #6909.

10 years agoSwitch to using .enumerate() some places in _match.
Michael Sullivan [Tue, 6 Aug 2013 23:50:58 +0000 (16:50 -0700)]
Switch to using .enumerate() some places in _match.

10 years agostd: more windows fixes to os.rs and run.rs
Erick Tryzelaar [Fri, 9 Aug 2013 18:13:26 +0000 (11:13 -0700)]
std: more windows fixes to os.rs and run.rs

10 years agoauto merge of #8369 : yichoi/rust/arm-test, r=sanxiyn
bors [Fri, 9 Aug 2013 17:59:08 +0000 (10:59 -0700)]
auto merge of #8369 : yichoi/rust/arm-test, r=sanxiyn

fix some part of test code to pass make check on ARM Android

10 years agoAdd parse-error recovery for erroneous `struct_id { }` form.
Felix S. Klock II [Mon, 5 Aug 2013 20:18:29 +0000 (22:18 +0200)]
Add parse-error recovery for erroneous `struct_id { }` form.

There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.

10 years agoauto merge of #8352 : stepancheg/rust/ipv6-to-str, r=luqmana
bors [Fri, 9 Aug 2013 15:17:04 +0000 (08:17 -0700)]
auto merge of #8352 : stepancheg/rust/ipv6-to-str, r=luqmana

Reported by @luqmana

10 years agoauto merge of #8362 : sfackler/rust/env, r=alexcrichton
bors [Fri, 9 Aug 2013 12:35:06 +0000 (05:35 -0700)]
auto merge of #8362 : sfackler/rust/env, r=alexcrichton

env! aborts compilation of the specified environment variable is not
defined and takes an optional second argument containing a custom
error message. option_env! creates an Option<&'static str> containing
the value of the environment variable.

There are no run-pass tests that check the behavior when the environment
variable is defined since the test framework doesn't support setting
environment variables at compile time as opposed to runtime. However,
both env! and option_env! are used inside of rustc itself, which should
act as a sufficient test.

Fixes #2248.

10 years agoImplement `lower_bound_iter`/`upper_bound_iter` for TrieMap/TrieSet
Dmitry Ermolov [Wed, 7 Aug 2013 22:37:13 +0000 (02:37 +0400)]
Implement `lower_bound_iter`/`upper_bound_iter` for TrieMap/TrieSet

10 years agoFix Ipv6Addr to_str for ::1:x.x.x.x addresses
Stepan Koltsov [Fri, 9 Aug 2013 09:53:28 +0000 (13:53 +0400)]
Fix Ipv6Addr to_str for ::1:x.x.x.x addresses

Reported by luqmana@

10 years agoauto merge of #8361 : alexcrichton/rust/fix-node-hashes-in-crates, r=thestinger
bors [Fri, 9 Aug 2013 09:53:08 +0000 (02:53 -0700)]
auto merge of #8361 : alexcrichton/rust/fix-node-hashes-in-crates, r=thestinger

When running rusti 32-bit tests from a 64-bit host, these errors came up frequently. My best idea as to what was happening is:

1. First, if you hash the same `int` value on 32-bit and 64-bit, you will get two different hashes.
2. In a cross-compile situation, let's say x86_64 is building an i686 library, all of the hashes will be 64-bit hashes.
3. Then let's say you use the i686 libraries and then attempt to link against the same i686 libraries, because you're calculating hashes with a 32-bit int instead of a 64-bit one, you'll have different hashes and you won't be able to find items in the metadata (the items were generated with a 64-bit int).

This patch changes the items to always be hashed as an `i64` to preserve the hash value across architectures. Here's a nice before/after for this patch of the state of rusti tests

```
host   target  before  after
64     64      yes     yes
64     32      no      no (llvm assertion)
32     64      no      yes
32     32      no      no (llvm assertion)
```

Basically one case started working, but currently when the target is 32-bit LLVM is having a lot of problems generating code. That's another separate issue though.

10 years agostd: Fix perf of local allocations in newsched
Brian Anderson [Fri, 9 Aug 2013 08:15:31 +0000 (01:15 -0700)]
std: Fix perf of local allocations in newsched

Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.

10 years agoauto merge of #8357 : omasanori/rust/cleanup, r=alexcrichton
bors [Fri, 9 Aug 2013 07:17:06 +0000 (00:17 -0700)]
auto merge of #8357 : omasanori/rust/cleanup, r=alexcrichton

I feel it's time to eliminate them (and add some testcases.)

10 years agoRemove redundant Ord method impls.
OGINO Masanori [Thu, 8 Aug 2013 01:03:34 +0000 (10:03 +0900)]
Remove redundant Ord method impls.

Basically, generic containers should not use the default methods since a
type of elements may not guarantees total order. str could use them
since u8's Ord guarantees total order. Floating point numbers are also
broken with the default methods because of NaN. Thanks for @thestinger.

Timespec also guarantees total order AIUI. I'm unsure whether
extra::semver::Identifier does so I left it alone. Proof needed.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoauto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton
bors [Fri, 9 Aug 2013 04:41:05 +0000 (21:41 -0700)]
auto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton

Code that collects fields in struct-like patterns used to ignore
wildcard patterns like `Foo{_}`. But `enter_defaults` considered
struct-like patterns as default in order to overcome this
(accoring to my understanding of situation).

However such behaviour caused code like this:
```
enum E {
    Foo{f: int},
    Bar
}
let e = Bar;
match e {
    Foo{f: _f} => { /* do something (1) */ }
    _ => { /* do something (2) */ }
}
```
consider pattern `Foo{f: _f}` as default. That caused inproper behaviour
and even segfaults while trying to destruct `Bar` as `Foo{f: _f}`.
Issues: #5625 , #5530.

This patch fixes `collect_record_or_struct_fields` to split cases of
single wildcard struct-like pattern and no struct-like pattern at all.
Former case resolved with `enter_rec_or_struct` (and not with
`enter_defaults`).

Closes #5625.
Closes #5530.

10 years agostd::tuple: Use != properly in Eq::ne for tuples
blake2-ppc [Fri, 9 Aug 2013 03:54:49 +0000 (05:54 +0200)]
std::tuple: Use != properly in Eq::ne for tuples

Just like the Ord methods, Eq::ne needs to be implemented in terms of
the same operation on the elements.

10 years agoIsolate common wait_end logic
Steven Stewart-Gallus [Fri, 9 Aug 2013 02:33:34 +0000 (19:33 -0700)]
Isolate common wait_end logic

10 years agoMerge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
Erick Tryzelaar [Fri, 9 Aug 2013 02:27:03 +0000 (19:27 -0700)]
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls

10 years agoauto merge of #8336 : stepancheg/rust/socket-addr-from-str, r=brson
bors [Fri, 9 Aug 2013 02:08:02 +0000 (19:08 -0700)]
auto merge of #8336 : stepancheg/rust/socket-addr-from-str, r=brson

FromStr implemented from scratch.

It is overengineered a bit, however.

Old implementation handles errors by fail!()-ing. And it has bugs, like it accepts `127.0.0.1::127.0.0.1` as IPv6 address, and does not handle all ipv4-in-ipv6 schemes. So I decided to implement parser from scratch.

10 years agoAllow attributes to appear as macro arguments
Niko Matsakis [Thu, 8 Aug 2013 17:28:06 +0000 (13:28 -0400)]
Allow attributes to appear as macro arguments

Fixes #8393

10 years agoauto merge of #8356 : toddaaro/rust/ws, r=brson
bors [Thu, 8 Aug 2013 23:32:02 +0000 (16:32 -0700)]
auto merge of #8356 : toddaaro/rust/ws, r=brson

This pull request converts the scheduler from a naive shared queue scheduler to a naive workstealing scheduler. The deque is still a queue inside a lock, but there is still a substantial performance gain. Fiddling with the messaging benchmark I got a ~10x speedup and observed massively reduced memory usage.

There are still *many* locations for optimization, but based on my experience so far it is a clear performance win as it is now.

10 years agoAdd #[inline] to impl Zero for ()
Stepan Koltsov [Thu, 8 Aug 2013 22:19:50 +0000 (02:19 +0400)]
Add #[inline] to impl Zero for ()

Follow-up to #8155