summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2014-09-17librustc: Implement associated types behind a feature gate.Patrick Walton-94/+150
The implementation essentially desugars during type collection and AST type conversion time into the parameter scheme we have now. Only fully qualified names--e.g. `<T as Foo>::Bar`--are supported.
2014-09-17auto merge of #17343 : alexcrichton/rust/rollup, r=alexcrichtonbors-34/+31
2014-09-17auto merge of #16836 : P1start/rust/closure_ret_bang, r=alexcrichtonbors-10/+10
Fixes #13490.
2014-09-17rollup merge of #17290 : bkoropoff/issue-17283Alex Crichton-34/+31
2014-09-17rebasing fixesNick Cameron-1/+1
2014-09-17move most of front to libsyntaxNick Cameron-0/+19
2014-09-16Propagate restrictions against struct literals to the RHS of assignmentsBrian Koropoff-2/+3
This prevents confusing errors when accidentally using an assignment in an `if` expression. For example: ```rust fn main() { let x = 1u; if x = x { println!("{}", x); } } ``` Previously, this yielded: ``` test.rs:4:16: 4:17 error: expected `:`, found `!` test.rs:4 println!("{}", x); ^ ``` With this change, it now yields: ``` test.rs:3:8: 3:13 error: mismatched types: expected `bool`, found `()` (expected bool, found ()) test.rs:3 if x = x { ^~~~~ ``` Closes issue #17283
2014-09-16Convert restriction enum into bitflagsBrian Koropoff-32/+28
This makes having multiple restrictions at once cleaner. Also drop NO_DOUBLEBAR restriction since it is never used.
2014-09-17auto merge of #17223 : retep998/rust/into_string, r=huonwbors-41/+41
Replaces some usage of `.to_string()` with `.into_string()`
2014-09-16Fallout from renamingAaron Turon-11/+11
2014-09-14auto merge of #17163 : pcwalton/rust/impls-next-to-struct, r=alexcrichtonbors-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Closes #17059. RFC #155. [breaking-change] r? @brson
2014-09-14Add help diagnostic messagesP1start-0/+3
This adds ‘help’ diagnostic messages to rustc. This is used for anything that provides help to the user, particularly the `--explain` messages that were previously integrated into the relevant error message.
2014-09-14syntax: tests: fix fallout from using ptr::P.Eduard Burtescu-8/+8
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-304/+323
2014-09-13librustc: Forbid inherent implementations that aren't adjacent to thePatrick Walton-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Additionally, if you used the I/O path extension methods `stat`, `lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have been moved to the the `std::io::fs::PathExtensions` trait. This breaks code like: fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Change this code to: use std::io::fs::PathExtensions; fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Closes #17059. RFC #155. [breaking-change]
2014-09-13Improve memory usage of libsyntaxPeter Atashian-41/+41
Replaces some usage of `.to_string()` with `.into_string()` Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-09-11auto merge of #16866 : P1start/rust/tuple-indexing, r=brsonbors-1/+41
This allows code to access the fields of tuples and tuple structs behind the feature gate `tuple_indexing`: ```rust #![feature(tuple_indexing)] let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0); ``` Implements [RFC 53](https://github.com/rust-lang/rfcs/blob/master/active/0053-tuple-accessors.md). Closes #16950.
2014-09-09librustc: Obsolete the old external crate renaming syntax.Patrick Walton-5/+6
Instead of `extern crate foo = bar`, write `extern crate bar as foo`. Instead of `extern crate baz = "quux"`, write `extern crate "quux" as baz`. Closes #16461. [breaking-change]
2014-09-10Implement tuple and tuple struct indexingP1start-1/+41
This allows code to access the fields of tuples and tuple structs: let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0);
2014-09-08librustc: Change the syntax of subslice matching to use postfix `..`Patrick Walton-31/+42
instead of prefix `..`. This breaks code that looked like: match foo { [ first, ..middle, last ] => { ... } } Change this code to: match foo { [ first, middle.., last ] => { ... } } RFC #55. Closes #16967. [breaking-change]
2014-09-07Fix deprecate warning "extern crate ... as ..."Sebastien Martini-1/+1
Its arguments were inverted.
2014-09-05Fix documentation typo.jamesluke-1/+1
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-1/+1
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-04auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichtonbors-3/+8
Changed occurances of: extern crate foo = "bar"; to: extern crate "bar" as foo; Added warning for old deprecated syntax
2014-09-03Fix spelling errors and capitalization.Joseph Crail-1/+1
2014-09-03Remove cross-borrowing for traits.Nick Cameron-3/+3
Closes #15349 [breaking-change] Trait objects are no longer implicitly coerced from Box<T> to &T. You must make an explicit coercion using `&*`.
2014-09-01Updated to new extern crate syntax.wickerwaka-3/+8
Added warning for old deprecated syntax
2014-08-31auto merge of #16809 : nick29581/rust/dst-bug-3, r=alexcrichtonbors-13/+6
This corrects a rebasing error. Also adds a test so it won't happen again. r?
2014-08-30rollup merge of #16839 : treeman/issue-15358Alex Crichton-1/+1
2014-08-29Add support for labeled while loops.Pythoner6-4/+7
2014-08-29Tweak error message for use of a keyword in ident position.Jonas Hietala-1/+1
Closes #15358
2014-08-29Allow `!` as the return type of proc/closure literalsP1start-10/+10
Fixes #13490.
2014-08-28Forbid ~str and ~[]Nick Cameron-13/+6
This corrects a rebasing error. Also adds a test so it won't happen again.
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-113/+71
2014-08-27auto merge of #16689 : wickerwaka/rust/crate-as, r=pcwaltonbors-2/+12
For review. Not sure about the link_attrs stuff. Will work on converting all the tests. extern crate "foobar" as foo; extern crate foobar as foo; Implements remaining part of RFC #47. Addresses issue #16461. Removed link_attrs from rust.md, they don't appear to be supported by the parser.
2014-08-26Rebasing changesNick Cameron-14/+17
2014-08-26DST coercions and DST structsNick Cameron-54/+27
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-25auto merge of #16699 : treeman/rust/issue-8492, r=alexcrichtonbors-11/+11
Closes #8492. I did not find this suggestion in the [guidelines][] but it's mentioned in the [old style guide][]. [guidelines]: https://github.com/rust-lang/rust-guidelines [old style guide]: https://github.com/rust-lang/rust/wiki/Note-style-guide/73c864a10a8e231e2a6630e5a3461f1d3022a20a
2014-08-24auto merge of #16646 : P1start/rust/trailing-commas, r=alexcrichtonbors-18/+25
This lets the parser understand trailing commas in method calls, method definitions, enum variants, and type parameters. Closes #14240. Closes #15887.
2014-08-24Adjust the error messages to match the pattern "expected foo, found bar"Jonas Hietala-11/+11
Closes #8492
2014-08-23extern crate foobar as foo;wickerwaka-2/+12
Implements remaining part of RFC #47. Addresses issue #16461. Removed link_attrs from rust.md, they don't appear to be supported by the parser. Changed all the tests to use the new extern crate syntax Change pretty printer to use 'as' syntax
2014-08-23Add support for trailing commas in more placesP1start-18/+25
This lets the parser understand trailing commas in method calls, method definitions, enum variants, and type parameters. Closes #14240. Closes #15887.
2014-08-21syntax: Fix complexity of string parsing. Closes #16624.Brian Anderson-5/+16
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-3/+9
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-45/+46
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-15auto merge of #16424 : pcwalton/rust/where-clauses, r=nikomatsakisbors-34/+107
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change] r? @nikomatsakis (or whoever)
2014-08-14librustc: Implement simple `where` clauses.Patrick Walton-34/+107
These `where` clauses are accepted everywhere generics are currently accepted and desugar during type collection to the type parameter bounds we have today. A new keyword, `where`, has been added. Therefore, this is a breaking change. Change uses of `where` to other identifiers. [breaking-change]
2014-08-14auto merge of #16468 : pcwalton/rust/as-renaming-import, r=alexcrichtonbors-2/+6
The old syntax will be removed after a snapshot. RFC #47. Issue #16461. r? @brson
2014-08-14libsyntax: Accept `use foo as bar;` in lieu of `use bar as foo;`Patrick Walton-2/+6
The old syntax will be removed after a snapshot. RFC #47. Issue #16461.
2014-08-14librustc: Stop assuming that implementations and traits only containPatrick Walton-16/+24
methods. This paves the way to associated items by introducing an extra level of abstraction ("impl-or-trait item") between traits/implementations and methods. This new abstraction is encoded in the metadata and used throughout the compiler where appropriate. There are no functional changes; this is purely a refactoring.