Commit Graph

2029 Commits

Author SHA1 Message Date
Sangeun Kim
a76943be47 Move EnumSet into libextra 2013-08-06 14:45:02 +09:00
Marvin Löbel
0ac7a219f0 Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
bors
2d1eb1916e auto merge of #8292 : thestinger/rust/fix_loop_warning, r=brson 2013-08-05 09:49:56 -07:00
bors
dbaca98d78 auto merge of #8279 : pcwalton/rust/no-main, r=brson
Useful for SDL and possibly Android too.

r? @brson
2013-08-05 04:37:58 -07:00
Luqman Aden
9c39992021 Add support for vanilla linux on arm. 2013-08-04 19:28:06 -04:00
Daniel Micay
c327835a44 fix warning still mentioning the again keyword 2013-08-04 18:21:29 -04:00
bors
3d14470be4 auto merge of #7115 : alexcrichton/rust/llvm-upgrades, r=thestinger
This is a reopening of #6713

This is still blocked on windows failures. I'll re-push try once the existing crisis has passed.
2013-08-04 12:49:53 -07:00
Alex Crichton
60e9507086 Integrate new arm patch and fix an LLVM bug
Thanks @luqama!
2013-08-04 10:58:23 -07:00
Alex Crichton
bb93930575 Add a workaround for 8199 for now 2013-08-04 10:58:23 -07:00
Alex Crichton
4ace3b7434 Fix setting the fixed stack segment attribute on LLVM functions
At the same time create a more robust wrapper to try to prevent this type of
issue from cropping up in the future.
2013-08-04 10:58:23 -07:00
Alex Crichton
8d29367650 Fix build issues once LLVM has been upgraded
* LLVM now has a C interface to LLVMBuildAtomicRMW
* The exception handling support for the JIT seems to have been dropped
* Various interfaces have been added or headers have changed
2013-08-04 10:58:23 -07:00
bors
8495ee52b2 auto merge of #8262 : dotdash/rust/no_rval_copies, r=pcwalton
rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?
2013-08-04 10:55:53 -07:00
bors
fbeeeebf47 auto merge of #8264 : thestinger/rust/snapshot, r=Aatch 2013-08-03 23:25:55 -07:00
Daniel Micay
e7bb33aed8 rm obsolete for support from the compiler 2013-08-04 00:39:48 -04:00
Patrick Walton
9c08db58ab librustc: Implement #[no_main], which omits the entry point entirely.
Useful for SDL and possibly Android too.
2013-08-03 20:01:00 -07:00
Daniel Micay
1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00
bors
b5d77d20ec auto merge of #8223 : davidhalperin/rust/master, r=Aatch
Closes #7907

This is my first pull request so let me know if I've done anything wrong.  I tried to pick off a nice easy one.
2013-08-03 11:52:50 -07:00
Björn Steinbrink
a51e3e46ef trans_arg_expr: Omit extra copies for rvalues
rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?
2013-08-03 15:03:58 +02:00
OGINO Masanori
afaca4c822 Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:45 -04:00
Kevin Ballard
54e685d4fd option: mutate() and mutate_default() should return bool
Fixes #8047.
2013-08-03 03:11:11 -04:00
Daniel Micay
b41d04763e make for parse as foreach does
Closes #6997
2013-08-03 03:00:42 -04:00
Daniel Micay
b3ad685f7f replace all remaining for with foreach or do 2013-08-03 03:00:42 -04:00
Patrick Walton
9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
Patrick Walton
887c656970 librustc: Introduce a new visitor type based on traits and port syntax to it.
This is preparation for removing `@fn`.

This does *not* use default methods yet, because I don't know
whether they work. If they do, a forthcoming PR will use them.

This also changes the precedence of `as`.
2013-08-02 21:57:58 -07:00
David Halperin
fe8ad14c87 Add backticks around trait name in conflicting implementations error message 2013-08-02 17:54:54 -04:00
David Halperin
77adec9c9b Add trait name to conflicting implementation error message 2013-08-02 17:54:53 -04:00
bors
bbcce8d95c auto merge of #8216 : thestinger/rust/range, r=huonw 2013-08-01 22:10:45 -07:00
Daniel Micay
234acad404 replace range with an external iterator 2013-08-02 00:51:14 -04:00
bors
ecefeb03cc auto merge of #8185 : alexcrichton/rust/issue-8179, r=pcwalton
* All globals marked as `pub` won't have the `internal` linkage type set
* All global references across crates are forced to use the address of the
  global in the other crate via an external reference.

r? @graydon

Closes #8179
2013-08-01 19:46:47 -07:00
Huon Wilson
7c21ccc483 rustc: add a lint for for, suggesting foreach or do.
This is just to aid the transistion to the new `for` loop, by
pointing at each location where the old one occurs.
2013-08-01 15:07:19 -04:00
blake2-ppc
78cde5b9fb std: Change Times trait to use do instead of for
Change the former repetition::

    for 5.times { }

to::

    do 5.times { }

.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
bors
5c6069c7a9 auto merge of #8184 : thestinger/rust/retreat, r=huonw 2013-08-01 02:37:36 -07:00
Daniel Micay
1fc4db2d08 migrate many for loops to foreach 2013-08-01 05:34:55 -04:00
Alex Crichton
ea5f829307 Resolve globals having different addresses across crates
* All globals marked as `pub` won't have the `internal` linkage type set
* All global references across crates are forced to use the address of the
  global in the other crate via an external reference.
2013-08-01 01:54:34 -07:00
bors
1b018dd9ba auto merge of #8149 : omasanori/rust/cleanup, r=alexcrichton
Fixed a warning.
2013-08-01 00:40:33 -07:00
Daniel Micay
dabd476203 make in and foreach get treated as keywords 2013-08-01 00:21:13 -04:00
bors
389aba0952 auto merge of #8146 : dotdash/rust/simple_take_glue, r=thestinger
These glue function just return void, no point in having a copy for each
type.
2013-07-31 09:22:21 -07:00
OGINO Masanori
6a69d27a0f Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-07-31 23:22:57 +09:00
Björn Steinbrink
fac18c1cb8 Unify the take glue functions for unique pointer types
These glue function just return void, no point in having a copy for each
type.
2013-07-31 08:21:26 +02:00
Graydon Hoare
62b6fa0943 rustc: silence unused-var warning. 2013-07-30 18:50:28 -07:00
Graydon Hoare
c29e9fb60b syntax: implement foreach .. in .. { .. } via desugaring. 2013-07-30 18:50:28 -07:00
bors
576f395ddf auto merge of #8121 : thestinger/rust/offset, r=alexcrichton
Closes #8118, #7136

~~~rust
extern mod extra;

use std::vec;
use std::ptr;

fn bench_from_elem(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = vec::from_elem(1024, 0u8);
    }
}

fn bench_set_memory(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let mut v: ~[u8] = vec::with_capacity(1024);
        unsafe {
            let vp = vec::raw::to_mut_ptr(v);
            ptr::set_memory(vp, 0, 1024);
            vec::raw::set_len(&mut v, 1024);
        }
    }
}

fn bench_vec_repeat(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = ~[0u8, ..1024];
    }
}
~~~

Before:

    test bench_from_elem ... bench: 415 ns/iter (+/- 17)
    test bench_set_memory ... bench: 85 ns/iter (+/- 4)
    test bench_vec_repeat ... bench: 83 ns/iter (+/- 3)

After:

    test bench_from_elem ... bench: 84 ns/iter (+/- 2)
    test bench_set_memory ... bench: 84 ns/iter (+/- 5)
    test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30 07:01:19 -07:00
Daniel Micay
ef870d37a5 implement pointer arithmetic with GEP
Closes #8118, #7136

~~~rust
extern mod extra;

use std::vec;
use std::ptr;

fn bench_from_elem(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = vec::from_elem(1024, 0u8);
    }
}

fn bench_set_memory(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let mut v: ~[u8] = vec::with_capacity(1024);
        unsafe {
            let vp = vec::raw::to_mut_ptr(v);
            ptr::set_memory(vp, 0, 1024);
            vec::raw::set_len(&mut v, 1024);
        }
    }
}

fn bench_vec_repeat(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = ~[0u8, ..1024];
    }
}
~~~

Before:

    test bench_from_elem ... bench: 415 ns/iter (+/- 17)
    test bench_set_memory ... bench: 85 ns/iter (+/- 4)
    test bench_vec_repeat ... bench: 83 ns/iter (+/- 3)

After:

    test bench_from_elem ... bench: 84 ns/iter (+/- 2)
    test bench_set_memory ... bench: 84 ns/iter (+/- 5)
    test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30 02:50:31 -04:00
Michael Woerister
8a329770b6 New naming convention for ast::{node_id, local_crate, crate_node_id, blk_check_mode, ty_field, ty_method} 2013-07-29 16:16:48 +02:00
Kevin Mehall
1493141bfd Add support for ..base on static struct initializers. 2013-07-28 22:07:27 -04:00
Björn Steinbrink
075560a9f2 Free intermediate translation results as soon as possible
This fixes the recently introduced peak memory usage regression by
freeing the intermediate results as soon as they're not required
anymore instead of keeping them around for the whole compilation
process.

Refs #8077
2013-07-28 20:02:31 +02:00
bors
5842ab36b8 auto merge of #8087 : Aatch/rust/atomics, r=huonw
Adds a fence operation to close #8061

Also adds static initializers to for atomic types. Since the fields are private, you aren't able to have `static mut` variables that are an atomic type. Each atomic type's initializer starts at a 0-value (so unset for `AtomicFlag` and false for `AtomicBool`).
2013-07-28 03:55:22 -07:00
James Miller
4a1a0fbed5 Add an atomic fence intrinsic 2013-07-28 20:26:49 +12:00
maikklein
f6bcf5d5f1 cleanup .chain and .chain_err + fixing other files 2013-07-27 23:41:09 -07:00
bors
3078e83c3f auto merge of #8076 : omasanori/rust/cleanup, r=huonw
A cleanup suggested on #7922.
2013-07-27 20:13:22 -07:00