Commit Graph

16855 Commits

Author SHA1 Message Date
Luqman Aden
8b66578e66 Allow expressions that are not just a single value for repeated fixed length vector syntax. 2013-03-18 17:31:41 -07:00
Luqman Aden
787f5bb0db Now actually allow using constants in those constant expressions for [T * n]. 2013-03-18 17:31:41 -07:00
Luqman Aden
42f95d055c Allow constant expressions in [Type * n]. 2013-03-18 17:31:41 -07:00
bors
e67448d397 auto merge of #5412 : pcwalton/rust/purity, r=pcwalton
librustc: Make the compiler ignore purity. …

For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.

r? @nikomatsakis
2013-03-18 17:24:50 -07:00
Patrick Walton
e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00
Patrick Walton
c4db4faefa libsyntax: Stop parsing old lifetimes, except for the ones on data type declarations. 2013-03-18 17:21:15 -07:00
Patrick Walton
352c070365 librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming 2013-03-18 17:21:14 -07:00
Luqman Aden
7352d919f6 Update rust.vim
Column limit 78 -> 100.
2013-03-18 17:19:40 -07:00
Brian Anderson
5af5766512 core: Initialize global state lazily in the Scheduler ctor
I don't want any global one-time initalization functions because
that will make embedding harder.
2013-03-18 17:00:35 -07:00
Brian Anderson
044703435b Add a way to run the test suite with the new scheduler
TESTARGS=--newrt make check-stage1-rpass

Conflicts:
	src/rt/rustrt.def.in
2013-03-18 17:00:35 -07:00
Brian Anderson
a882554a78 core: Refactor uv bindings
I can already see these are going to get massive. Putting them into multiple
files.
2013-03-18 16:59:37 -07:00
Brian Anderson
7ef54c7ecd core: Begin uv file system bindings 2013-03-18 16:59:37 -07:00
Brian Anderson
57e85b5f94 core: Add rt::io and start sketching the API 2013-03-18 16:59:37 -07:00
Brian Anderson
5e6dacf32e mk: If NO_REBUILD is set then don't rebuild core/std before testing
Can make turnaround of testing changes to core/std/syntax much faster.
2013-03-18 16:59:37 -07:00
Brian Anderson
9a075f264a core: Rename rt::io to rt::rtio
This is an internal interface. I want to use rt::io for public interfaces.
2013-03-18 16:59:37 -07:00
Brian Anderson
42cba98509 core: Convert some multiline statements to single-line 2013-03-18 16:59:37 -07:00
Brian Anderson
54bb7226e1 core: Simplify uvll bindings and strip out currently-unused bits
No more mapping uv structs to Rust structs
2013-03-18 16:59:37 -07:00
Brian Anderson
723d2247c1 core: Don't use printf in rtdebug!
The bots were showing a segfault that I can't reproduce. Assuming it's
varargs related so let's not use printf
2013-03-18 16:59:11 -07:00
Brian Anderson
d30c758974 Give core::rt and std::net their own uvll bindings
I intend to do some big refactoring and don't want to deal w/ std just now
2013-03-18 16:59:11 -07:00
Brian Anderson
e8ddef93da core: Cleanup rt::context 2013-03-18 16:59:10 -07:00
Patrick Walton
dc69018495 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 13:21:25 -07:00
Niko Matsakis
a6187c62e9 Make &self permit explicit lifetimes, but don't really use them
(this will be needed for snapshotting at some point).
2013-03-18 15:03:37 -04:00
Patrick Walton
fc8c808908 libsyntax: Stop parsing old lifetimes, except for the ones on data type declarations. 2013-03-18 11:46:00 -07:00
Patrick Walton
299995c2b6 librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming 2013-03-18 11:45:59 -07:00
bors
087a015a72 auto merge of #5420 : boggle/rust/sudoku-with-traits, r=graydon
Came back to look at rust and found out that this had been broken by some refactoring work. Fixed and now has tests.
2013-03-18 10:46:21 -07:00
Luqman Aden
a692777224 rt: Inline get_sp_limit/set_sp_limit/get_sp for x86. 2013-03-18 00:07:53 -07:00
Luqman Aden
d1778767cc rt: Inline get_sp_limit/set_sp_limit/get_sp for x86_64. 2013-03-17 21:40:59 -07:00
Stefan Plantikow
321a54d26f Refactored sudoku benchmark to use traits and added some tests 2013-03-18 00:42:14 +01:00
bors
f54adca7c9 auto merge of #5374 : z0w0/rust/rustdoc-explicit-self, r=z0w0 2013-03-16 18:57:43 -07:00
Zack Corr
246573d5ae rustdoc: Fix method printing tests 2013-03-17 11:45:22 +10:00
bors
6307d24364 auto merge of #5415 : brson/rust/rustdoc, r=thestinger
r? @thestinger
2013-03-16 16:36:45 -07:00
Brian Anderson
deeeaf0ddb rustdoc: Show all impls of traits. #5406 2013-03-16 16:17:56 -07:00
bors
b53da4b9dd auto merge of #5342 : brson/rust/debug-mem, r=brson
Fixes #5341
2013-03-16 14:27:44 -07:00
Brian Anderson
63d18658c1 rt: Add RUST_DEBUG_MEM to rust_env to avoid races 2013-03-16 14:25:44 -07:00
Zack Corr
d597a19b30 syntax: Fix fun_to_str test 2013-03-16 17:36:39 +10:00
bors
ebba8b4e35 auto merge of #5408 : thestinger/rust/trie, r=pcwalton
The chunk fix is cherry picked from @graydon's `gc` branch.
2013-03-15 22:39:42 -07:00
bors
dc5ad5070d auto merge of #5359 : luqmana/rust/inline-asm, r=pcwalton
Continuation of #5317. Actually use operands properly now, including any number of output operands.

Which means you can do things like call printf:
```Rust
fn main() {
    unsafe {
        do str::as_c_str(~"The answer is %d.\n") |c| {
            let a = 42;
            asm!("mov $0, %rdi\n\t\
                  mov $1, %rsi\n\t\
                  xorl %eax, %eax\n\t\
                  call _printf"
                 :
                 : "r"(c), "r"(a)
                 : "rdi", "rsi", "eax"
                 : "volatile","alignstack"
                 );
        }
    }
}
```

```
% rustc foo.rs
% ./foo
The answer is 42.
```

Or just add 2 numbers:
```Rust
fn add(a: int, b: int) -> int {
    let mut c = 0;
    unsafe {
        asm!("add $2, $0"
             : "=r"(c)
             : "0"(a), "r"(b)
             );
    }
    c
}

fn main() {
    io::println(fmt!("%d", add(1, 2)));
}
```

```
% rustc foo.rs
% ./foo
3
```

Multiple outputs!
```Rust
fn addsub(a: int, b: int) -> (int, int) {
    let mut c = 0;
    let mut d = 0;
    unsafe {
        asm!("add $4, $0\n\t\
              sub $4, $1"
             : "=r"(c), "=r"(d)
             : "0"(a), "1"(a), "r"(b)
             );
    }
    (c, d)
}

fn main() {
    io::println(fmt!("%?", addsub(5, 1)));
}
```
```
% rustc foo.rs
% ./foo
(6, 4)
```

This also classifies inline asm as RvalueStmtExpr instead of the somewhat arbitrary kind I made it initially. There are a few XXX's regarding what to do in the liveness and move passes.
2013-03-15 21:15:46 -07:00
bors
6f1e8ef71a auto merge of #5404 : bstrie/rust/decopy, r=pcwalton
Also turn `copy` into `.clone()` in much of run-pass.
2013-03-15 20:15:44 -07:00
Luqman Aden
83f2d4ab3d Fix type_use for inline asm. 2013-03-15 18:57:19 -07:00
Luqman Aden
d68b98a5bf Don't use by_val for passing asm operands. 2013-03-15 18:55:44 -07:00
Luqman Aden
3d56936be3 Tidy. 2013-03-15 18:55:44 -07:00
Luqman Aden
e182ac4bbd Actually use no or multiple operands properly. 2013-03-15 18:55:44 -07:00
Luqman Aden
9ead7dad93 Implicitly use addr_of for output operands in asm. 2013-03-15 18:55:44 -07:00
Luqman Aden
59dcbd9f1c Initial support for output operands in asm. 2013-03-15 18:55:44 -07:00
Luqman Aden
d8ab47e7f9 Properly handle input operands for inline asm. 2013-03-15 18:55:43 -07:00
Luqman Aden
6d078db952 Actually pass inline asm operands around. 2013-03-15 18:55:43 -07:00
Luqman Aden
471d2b1765 Inline asm exprs should be RvalueStmtExpr. 2013-03-15 18:55:43 -07:00
Daniel Micay
d856215b92 add a test for the chunk function 2013-03-15 21:45:08 -04:00
bors
5a77a10488 auto merge of #5400 : thestinger/rust/misc, r=brson 2013-03-15 18:30:45 -07:00
Graydon Hoare
0942c80272 core: fix trie chunk function 2013-03-15 21:12:17 -04:00