Commit Graph

21060 Commits

Author SHA1 Message Date
gifnksm
e4cfb1d0f5 doc: Generate .po files for Japanse translations 2013-08-12 22:39:31 +09:00
gifnksm
2bc8a9be77 doc: Update .pot files 2013-08-12 22:39:31 +09:00
gifnksm
7b1b7f3210 doc: Add -M and -L option to po4a 2013-08-12 22:39:31 +09:00
bors
de48274c50 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.
2013-08-12 00:32:11 -07:00
bors
1785841a5b 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.
2013-08-11 20:50:14 -07:00
bors
0679436381 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.
2013-08-11 17:38:09 -07:00
bors
b285f1e6c9 auto merge of #8455 : nikomatsakis/rust/issue-5762-objects-dralston-d, r=graydon
Fix #5762 and various other aspects of object invocation.

r? @graydon
2013-08-11 14:17:09 -07:00
Niko Matsakis
7343478d67 Convert from transform to map 2013-08-11 14:56:43 -04:00
Niko Matsakis
b402e343e4 tests: Add new tests for borrowck/objects and update some existing tests 2013-08-11 14:01:23 -04:00
Niko Matsakis
df016dc4bf Update type visitor to use &Visitor and not @Visitor 2013-08-11 14:01:23 -04:00
Niko Matsakis
66b8ad5867 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.
2013-08-11 14:01:23 -04:00
Niko Matsakis
1bceb98084 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.
2013-08-11 14:01:23 -04:00
Niko Matsakis
006c6b6be4 trans: Rely on new AutoBorrowObj adjustment to match up object receivers
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
6f319812d6 ty: Add (but do not yet use) AutoBorrowObject option to adjustments
Note: some portions of this commit written by @Sodel-the-Vociferous
(Daniel Ralston)
2013-08-11 14:01:19 -04:00
Niko Matsakis
38357ebef4 typeck/check/method: Remove pub from most methods 2013-08-11 13:59:46 -04:00
Niko Matsakis
38b2e2980e Misc small cleanups 2013-08-11 13:59:46 -04:00
Niko Matsakis
6fe59bf877 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.
2013-08-11 13:59:45 -04:00
bors
63c62bea3a 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
2013-08-11 10:50:10 -07:00
Niko Matsakis
3aefb9649d librustc: Convert from @Object to @mut Object as needed 2013-08-11 13:26:59 -04:00
Niko Matsakis
96254b4090 libsyntax: Update from @Object to @mut Object as required 2013-08-11 13:23:40 -04:00
bors
f08851e31a 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!
2013-08-11 07:29:07 -07:00
bors
45da2a5f48 auto merge of #8412 : thestinger/rust/vector-add, r=alexcrichton 2013-08-11 04:11:08 -07:00
bors
cac9affc20 auto merge of #8408 : thestinger/rust/checked, r=Aatch 2013-08-11 00:47:07 -07:00
Daniel Micay
83b3a0eaf1 fix unused imports 2013-08-11 03:17:01 -04:00
Daniel Micay
774c9aebb3 move strdup_uniq lang item to std::str 2013-08-11 03:14:35 -04:00
Daniel Micay
768c9a43ab str: optimize with_capacity
before:

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

after:

test bench_with_capacity ... bench: 56 ns/iter (+/- 1)
2013-08-11 03:14:35 -04:00
Daniel Micay
2afed31ecc vec: optimize the Add implementation
before:

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

after:

test add ... bench: 113 ns/iter (+/- 2)
2013-08-11 03:14:35 -04:00
Daniel Micay
7db605cd15 disable 64-bit CheckedMul on 32-bit
code generation problem reported as issue #8449
2013-08-11 02:58:52 -04:00
Daniel Micay
076b91f8ad add intrinsics for checked overflow add/sub/mul 2013-08-11 02:51:20 -04:00
blake2-ppc
5cfad6fbae 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
2013-08-11 06:56:07 +02:00
bors
eebcff1493 auto merge of #8404 : stepancheg/rust/zero-unit-inline, r=alexcrichton
Follow-up to #8155
2013-08-10 19:53:06 -07:00
bors
bf809768ee 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
2013-08-10 16:32:18 -07:00
Luqman Aden
fcfd6e7c79 rustc: Add --target-cpu flag to select a more specific processor instead of the default, 'generic'. 2013-08-10 17:03:43 -04:00
bors
8b9e1ce75a 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.
2013-08-10 13:17:19 -07:00
Erick Tryzelaar
20953bb1fb Merge branch 'match' of https://github.com/msullivan/rust into rollup 2013-08-10 13:04:16 -07:00
Erick Tryzelaar
f007a46d37 Merge branch 'master' of https://github.com/MAnyKey/rust into rollup 2013-08-10 13:03:34 -07:00
Erick Tryzelaar
fb00463feb Merge branch 'issue-8393-attributes-in-macros' of https://github.com/nikomatsakis/rust into rollup 2013-08-10 13:03:19 -07:00
Erick Tryzelaar
b19c2ed8f3 Merge branch 'master' of https://github.com/p2j4d2c/rust into rollup 2013-08-10 13:02:44 -07:00
Erick Tryzelaar
4e92faad13 Merge branch 'trie-bound-iters' of https://github.com/dim-an/rust into rollup 2013-08-10 13:01:20 -07:00
Erick Tryzelaar
5e1ca23a65 Merge branch 'vec-exh' of https://github.com/stepancheg/rust into rollup 2013-08-10 13:00:20 -07:00
Erick Tryzelaar
09f4c9af13 Merge branch 'enum-method-privacy' of https://github.com/michaelwoerister/rust into rollup
Conflicts:
	src/libsyntax/opt_vec.rs
2013-08-10 12:59:52 -07:00
Erick Tryzelaar
c8a93efdae Merge remote-tracking branch 'remotes/origin/master' into cleanup-iterators 2013-08-10 12:04:40 -07:00
bors
2ba36ec629 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
2013-08-10 07:47:14 -07:00
Erick Tryzelaar
5b2c1c543f syntax and rustc: fix some warnings 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
e48ca19bc5 std: fix the non-stage0 str::raw::slice_bytes which broke in a merge 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
6fcf2ee8e3 std: Transform.find_ -> .find 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
f9dee04aaa std: Iterator.len_ -> .len 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
74d2552b0a std: Iterator.last_ -> .last 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
1db62d8311 std: Iterator.chain_ -> .chain 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
60c2661684 std: Iterator.flat_map_ -> .flat_map 2013-08-10 07:33:21 -07:00