Commit Graph

1356 Commits

Author SHA1 Message Date
Patrick Walton
db0693ac8d libsyntax: Tighten up expressions in patterns to only allow identifiers or literals (possibly with a minus).
This had very minimal fallout.
2013-05-12 16:35:19 -07:00
Patrick Walton
5d3559e645 librustc: Make self and static into keywords 2013-05-12 16:35:18 -07:00
Patrick Walton
06ef889cdc libsyntax: Remove extern mod foo { ... } from the language. 2013-05-12 16:33:15 -07:00
Corey Richardson
a279d65102 clean up the last bit of warnings 2013-05-11 20:36:47 -07:00
Tim Chevalier
ed41864464 Warning police 2013-05-11 20:36:44 -07:00
bors
957251817b auto merge of #6389 : sonwow/rust/issue-3356, r=bstrie
Fix for #3356
2013-05-11 12:55:49 -07:00
Alex Crichton
63c7e2f991 Remove the '<->' operator from the language 2013-05-10 22:51:06 -04:00
bors
3e0400fb86 auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183.

The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout.

The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!
2013-05-10 17:56:02 -07:00
Youngsoo Son
24ef88cee9 renamed str::from_slice to str::to_owned 2013-05-10 20:08:56 +09:00
bors
6da2c989ba auto merge of #6329 : sonwow/rust/issue-6306, r=ILyoan
Fix for #6306
2013-05-10 03:04:51 -07:00
Youngsoo Son
b7da975049 renamed vec::from_slice to vec::to_owned 2013-05-10 18:38:54 +09:00
bors
e9d0018abf auto merge of #6356 : dotdash/rust/strinterner, r=pcwalton
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-10 01:55:54 -07:00
Alex Crichton
cdc266e47d Fix deriving(IterBytes) to use the new for-loop protocol 2013-05-10 02:46:19 -04:00
Alex Crichton
5eb6d19803 syntax: Use the new for protocol 2013-05-10 02:46:18 -04:00
Youngsoo Son
c8e93edf55 Move core::task::local_data to core::local_data 2013-05-10 11:42:45 +09:00
Lenny222
e3230330b7 back-ticks 2013-05-09 15:46:32 +02:00
Björn Steinbrink
1393c3a3f4 Use a specialized string interner to reduce the need for owned strings
&str can be turned into @~str on demand, using to_owned(), so for
strings, we can create a specialized interner that accepts &str for
intern() and find() but stores and returns @~str.
2013-05-09 14:40:19 +02:00
bors
ca95e7f94e auto merge of #6345 : seanmoon/rust/fix-typos, r=sanxiyn
Hi there,

Really enjoying Rust. Noticed a few typos so I searched around for a few more--here's some fixes.

Ran `make check` and got `summary of 24 test runs: 4868 passed; 0 failed; 330 ignored`.

Thanks!

Sean
2013-05-09 03:51:32 -07:00
Youngmin Yoo
841f4ceaf4 libsyntax: rename vec::each(var) to var.each 2013-05-09 14:20:04 +09:00
Patrick Walton
72868450df libcore: Fix more merge fallout. 2013-05-08 17:04:03 -07:00
Patrick Walton
3affc6ed40 librustc: Fix merge fallout. 2013-05-08 17:04:02 -07:00
Patrick Walton
49a66a5c5a librustc: Stop parsing modes and remove them entirely from the language 2013-05-08 17:04:01 -07:00
Patrick Walton
278b487cab test: Fix tests and the pipe compiler 2013-05-08 17:04:00 -07:00
Patrick Walton
db4573a776 librustc: Remove mutable fields from the language.
They're still parsed though, to get through bootstrapping.
2013-05-08 17:04:00 -07:00
Sean Moon
bd4ee7c7d2 Fix typos 2013-05-09 02:34:47 +09:00
bors
8f94ac6118 auto merge of #6267 : huonw/rust/syntax-deriving-generaliseder, r=nikomatsakis
This "finishes" the generic deriving code (which I started in #5640), in the sense it supports everything that I can think of being useful. (Including lifetimes and type parameters on methods and traits, arguments and return values of (almost) any type, static methods.)

It closes #6149, but met with #6257, so the following doesn't work:
```rust
#[deriving(TotalEq)]
struct Foo<'self>(&'self int);
```
(It only fails for `TotalOrd`, `TotalEq` and `Clone`, since they are the only ones that call a method directly on sub-elements of the type, which means that the auto-deref interferes with the pointer.)

It also makes `Rand` (chooses a random variant, fills the fields with random values, including recursively for recursive types) and `ToStr` (`x.to_str()` is the same as `fmt!("%?", x)`) derivable, as well as converting IterBytes to the generic code (which made the code 2.5x shorter, more robust and added support for tuple structs).

({En,De}codable are trickier, so I'll convert them over later.)
2013-05-08 07:24:39 -07:00
bors
154f3b00e0 auto merge of #6271 : pnkfelix/rust/issue6009-condition-pub-priv-variants, r=graydon
@brson: r?  [please ignore the other one that was accidentally based off master due to back-button-bugs in github.com]

My goal is to resolve the question of whether we want to encourage (by example) consistent use of pub to make identifiers publicly-accessible, even in syntax extensions. (If people don't want that, then we can just let this pull request die.)

This is part one of two. Part two, whose contents should be clear from the FIXME's in this commit, would land after this gets incorporated into a snapshot.

(The eventual goal is to address issue #6009 , which was implied by my choice of branch name, but not mentioned in the pull request, so github did not notice it.)
2013-05-07 05:06:39 -07:00
bors
7b2020f2c3 auto merge of #6245 : youknowone/rust/match-range-static, r=graydon
Fix unintended error problem of:
````
static s: int = 1;
static e: int = 42;

fn main() {
    match 7 {
        s..e => (),
         ^~                 error: expected `=>` but found `..`
        _ => (),
    }
}
````
2013-05-07 00:18:37 -07:00
Niko Matsakis
2e4790ca06 Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 16:10:31 -04:00
Felix S. Klock II
1cbf0a84dc Step one for 'proper' pub condition: support pub keyword in form. 2013-05-06 19:05:36 +02:00
Huon Wilson
5e1d6c2c80 libsyntax: add #[deriving(Rand, ToStr)].
The former fills each field of a struct or enum variant with a random
value (and picks a random enum variant). The latter makes the .to_str
method have the same output as fmt!("%?", ..).
2013-05-07 01:33:54 +10:00
Huon Wilson
1cf2108a2b libsyntax: convert #[deriving(IterBytes)] to generic deriving 2013-05-07 01:33:54 +10:00
Huon Wilson
b20eb970e1 libsyntax: extend generic deriving code to handle almost all possible traits.
This adds support for static methods, and arguments of most types, traits with
type parameters, methods with type parameters (and lifetimes for both), as well
as making the code more robust to support deriving on types with lifetimes (i.e.
'self).
2013-05-07 01:33:54 +10:00
Niko Matsakis
6c0c3a44bd Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 09:00:50 -04:00
Niko Matsakis
2ea52a38e5 refinement to technique used to not run regionck 2013-05-06 09:00:37 -04:00
Brendan Zabarauskas
0e2242f6d6 Add assert_approx_eq! macro 2013-05-06 21:51:48 +10:00
Niko Matsakis
7b36e34c89 Fix two more write guard failures 2013-05-05 21:05:37 -04:00
Niko Matsakis
4300d4d2fa Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
2013-05-05 15:11:04 -04:00
bors
6e6a4be19d auto merge of #6208 : sanxiyn/rust/accurate-span, r=sanxiyn 2013-05-05 11:12:37 -07:00
Seo Sanghyeon
aca2a00fb4 Fix span tests 2013-05-06 03:09:19 +09:00
Jeong YunWon
cb918e1a83 Allow non-literal static range pattern for match arms
Fix unintended error problem of:

static s: int = 1;
static e: int = 42;

fn main() {
    match 7 {
        s..e => (),
         ^~                 error: expected `=>` but found `..`
        _ => (),
    }
}
2013-05-05 11:05:06 +09:00
Brian Anderson
8081e8debf Register snapshots 2013-05-04 15:43:51 -07:00
bors
1f65e4a1d5 auto merge of #6230 : thestinger/rust/whitespace, r=catamorphism
I just had `git apply` fix most of them and then did a quick skim over the diff to fix a few cases where it did the wrong thing (mostly replacing tabs with 4 spaces, when someone's editor had them at 8 spaces).
2013-05-04 00:48:37 -07:00
bors
a47e4cb22f auto merge of #6229 : catamorphism/rust/warning-police, r=catamorphism 2013-05-03 23:48:36 -07:00
bors
821979f928 auto merge of #6219 : dotdash/rust/fmt, r=graydon
Only the first portion has to be owned, as it acts as the buffer for the
constructed string. The remaining strings can be static.
2013-05-03 20:48:37 -07:00
Daniel Micay
86efd97a10 add gitattributes and fix whitespace issues 2013-05-03 20:01:42 -04:00
Tim Chevalier
1a5f11a11b syntax: Warning police 2013-05-03 16:56:34 -07:00
Tim Chevalier
13df2ea69c rustc: Handle struct patterns where the expected type is an enum
Previously, rustc would ICE if you matched on an enum-typed thing
with a structure pattern. Error out correctly.
2013-05-03 13:03:53 -07:00
bors
79aeb529d5 auto merge of #6046 : brson/rust/io, r=graydon
r? @pcwalton

Sorry this is so big, and sorry the first commit is just titled 'wip'.

Some interesting bits

* [LocalServices](f9069baa70) - This is the set of runtime capabilities that *all* Rust code should expect access to, including the local heap, GC, logging, unwinding.
* [impl Reader, etc. for Option](5fbb0949a5) - Constructors like `File::open` return Option<FileStream>. This lets you write I/O code without ever unwrapping an option.

This series adds a lot of [documentation](https://github.com/brson/rust/blob/io/src/libcore/rt/io/mod.rs#L11) to `core::rt::io`.
2013-05-03 09:09:40 -07:00
Björn Steinbrink
2e3e0c0892 Avoid needless creation of unique strings in fmt!()
Only the first portion has to be owned, as it acts as the buffer for the
constructed string. The remaining strings can be static.
2013-05-03 12:26:45 +02:00