Commit graph

16235 commits

Author SHA1 Message Date
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
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
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
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
Daniel Micay
98900d55e7 add constructor to TrieSet (was missing) 2013-03-15 21:03:29 -04:00
bors
4ad9e5c0c2 auto merge of #5396 : ILyoan/rust/fix_rt_tls, r=graydon
Add a conditional compile option for android
2013-03-15 17:18:44 -07:00
bors
6859a6d9a3 auto merge of #5391 : brson/rust/to-bytes, r=graydon
r?

I want to use this function as a method. There's probably a better way to design this but the existing `ToBytes` trait is not what I am looking for (it has a parameter to indicate the byte order).
2013-03-15 16:15:47 -07:00
Ben Striegel
ee5842494a Clonify some of run-pass 2013-03-15 18:27:15 -04:00
Ben Striegel
748c2c9ebc impl Clone for ~T, ~[T], ~str 2013-03-15 18:26:59 -04:00
bors
e75a843efa auto merge of #5357 : jbclements/rust/add-nonempty-span-encoding, r=jbclements
r? @nikomatsakis 
r? @erickt 

Before this change, encoding an object containing a codemap::span
using the JSON encodeng produced invalid JSON, for instance:
[{"span":,"global":false,"idents":["abc"]}]
Since the decoder for codemap::span's ignores its argument, I
conjecture that this will not damage decoding, and should improve
it for many decoders.
2013-03-15 15:06:47 -07:00
bors
2b059c6e56 auto merge of #5354 : ILyoan/rust/normalize_triple, r=graydon
LLVM could not recognize target-os when target-triple was given as like 'arm-linux-androideabi'.
Normalizing target-triple fill the missing elements. 
In the case of 'arm-linux-androideabi', nomalized target-triple will be "arm-unknown-linux-androideabi" and this let llvm recognize the triple correctly. (arch: arm, vendor: unknown, os: linux, environment: android)
2013-03-15 14:15:50 -07:00
Daniel Micay
2b6614f2e6 treemap: use each_mut instead of mutate 2013-03-15 14:14:03 -04:00
Daniel Micay
88278f9c35 treemap: rm old FIXME 2013-03-15 14:12:45 -04:00
Daniel Micay
b3ee49c7e2 deque: add documentation 2013-03-15 14:05:27 -04:00
bors
c724dae7de auto merge of #5395 : thestinger/rust/iter, r=pcwalton 2013-03-15 09:21:56 -07:00
John Clements
4bd26481c4 Update test case to conform to new restrictions on casting 2013-03-15 09:17:49 -07:00
John Clements
b5ace4df45 Test case fixup (old one tested the old bad behavior). 2013-03-15 08:44:21 -07:00
John Clements
fdf8543cf6 add nonempty encoding for spans
Before this change, encoding an object containing a codemap::span
using the JSON encodeng produced invalid JSON, for instance:
[{"span":,"global":false,"idents":["abc"]}]
Since the decoder for codemap::span's ignores its argument, I
conjecture that this will not damage decoding, and should improve
it for many decoders.
2013-03-15 08:44:21 -07:00
ILyoan
10df2ea9db Normalize target triple so that llvm can recognize target os correctly 2013-03-15 15:39:58 +09:00
ILyoan
1a6a37e01a Fix an android compilation fail 2013-03-15 15:35:39 +09:00
bors
19bb16650f auto merge of #5375 : z0w0/rust/rustdoc-private-hide, r=thestinger 2013-03-14 21:48:49 -07:00
Daniel Micay
a49ccee68e MutableIter impl for Option + use it in treemap 2013-03-14 23:44:25 -04:00