Commit Graph

16248 Commits

Author SHA1 Message Date
Patrick Walton
b0bea10898 libsyntax: Accept the new [T, ..N] style for vec. 2013-03-19 15:40:04 -07:00
Patrick Walton
049e1f9a1f libsyntax: Accept static instead of const for globals 2013-03-19 14:46:27 -07:00
Patrick Walton
2e7ec80bcc librustc: Enforce privacy for static methods.
This starts moving a bunch of privacy checks into the privacy
checking phase and out of resolve.
2013-03-19 13:40:48 -07:00
bors
a14ec73cd2 auto merge of #5356 : jld/rust/enum-less-magic, r=graydon
Fixes #1645.
2013-03-19 11:43:10 -07:00
bors
58209910bd auto merge of #5433 : lucab/rust/lucab/cfgspec, r=graydon
All current meta items types (word, name-value, list) are now
properly parsed by rustc --cfg command line. Fixes #2399
2013-03-19 10:43:24 -07:00
bors
3c84bac946 auto merge of #5112 : luqmana/rust/3469, r=graydon
So this is a partial fix for #3469. Partial because it only works for simple constant expressions like `32/2` and `2+2` and not for any actual constants.

For example:
```
const FOO: uint = 2+2;
let v: [int * FOO];
```

results in:
```
error: expected constant expr for vector length: Non-constant path in constant expr
```

This seems to be because at the point of error (`typeck::astconv`) the def_map doesn't contain the constant and thus it can't lookup the actual expression (`2+2` in this case).

So, feedback on what I have so far and suggestions for how to address the constant issue?
2013-03-19 09:52:17 -07:00
Luca Bruno
0a34a3f0f5 Make driver::driver::parse_cfgspecs parse any variety of meta_item
All current meta items types (word, name-value, list) are now
properly parsed by rustc --cfg command line. Fixes #2399

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-03-19 14:02:59 +01:00
Luqman Aden
d7d17dc14e Add tests for const exprs in fixed vec length type and vec repeat. 2013-03-18 17:31:42 -07:00
Luqman Aden
da64994f18 Fix pretty printer for fixed length vectors. 2013-03-18 17:31:42 -07:00
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
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