about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2014-12-09auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakisbors-0/+20
2014-12-08Revert "Register new snapshots"Alex Crichton-3/+3
This reverts commit 9b443289cf32cbcff16768614340f0c844675340.
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-0/+20
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-23/+21
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-06libsyntax: remove unnecessary `to_string()` callsJorge Aparicio-12/+12
2014-12-06libsyntax: remove unnecessary `as_slice()` callsJorge Aparicio-11/+9
2014-12-05Register new snapshotsAlex Crichton-3/+3
2014-12-05rollup merge of #19494: P1start/better-expectedCorey Richardson-68/+115
As an example of what this changes, the following code: ```rust let x: [int ..4]; ``` Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’. (Thanks to cramer on IRC for pointing out this problem with diagnostics.)
2014-12-05rollup merge of #19480: cmr/es6-escapeCorey Richardson-8/+95
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-05rollup merge of #19413: P1start/more-trailing-commasCorey Richardson-7/+7
The only other place I know of that doesn’t allow trailing commas is closure types (#19414), and those are a bit tricky to fix (I suspect it might be impossible without infinite lookahead) so I didn’t implement that in this patch. There are other issues surrounding closure type parsing anyway, in particular #19410.
2014-12-04Make the parser’s ‘expected <foo>, found <bar>’ errors more accurateP1start-68/+115
As an example of what this changes, the following code: let x: [int ..4]; Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’.
2014-12-03syntax: support ES6-style unicode escapesCorey Richardson-8/+95
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-03Deprecate EquivJorge Aparicio-0/+1
2014-12-03Replace `equiv` method calls with `==` operator sugarJorge Aparicio-1/+1
2014-12-03Overload the `==` operatorJorge Aparicio-0/+22
- String == &str == CowString - Vec == &[T] == &mut [T] == [T, ..N] == CowVec - InternedString == &str
2014-12-02auto merge of #19427 : scialex/rust/doc-attr-macros, r=sfacklerbors-0/+6
this allows one to, for example, use #[doc = $macro_var ] in macros.
2014-12-01auto merge of #19405 : jfager/rust/de-match-pyramid, r=bstriebors-44/+19
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-12-01auto merge of #19418 : P1start/rust/unsafe-extern-trait, r=alexcrichtonbors-7/+8
Fixes #19398.
2014-11-30auto merge of #19415 : P1start/rust/error-message-fixes, r=alexcrichtonbors-2/+2
This is the style followed by most other error messages.
2014-11-30allow macro expansions in attributesAlexander Light-0/+6
2014-11-30Allow trailing commas in array patterns and attributesP1start-7/+7
2014-11-30Fix the ordering of `unsafe` and `extern` in methodsP1start-7/+8
This breaks code that looks like this: trait Foo { extern "C" unsafe fn foo(); } impl Foo for Bar { extern "C" unsafe fn foo() { ... } } Change such code to look like this: trait Foo { unsafe extern "C" fn foo(); } impl Foo for Bar { unsafe extern "C" fn foo() { ... } } Fixes #19398. [breaking-change]
2014-11-30Adjust some error messages to start with a lowercase letter and not finish ↵P1start-2/+2
with a full stop
2014-11-29Replace some verbose match statements with their `if let` equivalent.jfager-44/+19
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-11-29Fix rustc panic on second compile_inputMurarth-0/+6
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-21/+12
2014-11-26/*! -> //!Steve Klabnik-21/+12
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plusAlex Crichton-108/+86
Implements RFC 438. Fixes #19092. This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively. r? @brson
2014-11-26rollup merge of #19288: steveklabnik/doc_style_cleanupAlex Crichton-7/+5
This is considered good convention. This is about half of them in total, I just don't want an impossible to land patch. :smile:
2014-11-26Implement the new parsing rules for types in the parser, modifying the AST ↵Niko Matsakis-108/+86
appropriately.
2014-11-25/** -> ///Steve Klabnik-7/+5
This is considered good convention.
2014-11-25Deprecate MaybeOwned[Vector] in favor of CowJorge Aparicio-6/+6
2014-11-23std: Add a new top-level thread_local moduleAlex Crichton-9/+4
This commit removes the `std::local_data` module in favor of a new `std::thread_local` module providing thread local storage. The module provides two variants of TLS: one which owns its contents and one which is based on scoped references. Each implementation has pros and cons listed in the documentation. Both flavors have accessors through a function called `with` which yield a reference to a closure provided. Both flavors also panic if a reference cannot be yielded and provide a function to test whether an access would panic or not. This is an implementation of [RFC 461][rfc] and full details can be found in that RFC. This is a breaking change due to the removal of the `std::local_data` module. All users can migrate to the new thread local system like so: thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None))) The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as an implementation detail which must now be explicitly stated by users. [rfc]: https://github.com/rust-lang/rfcs/pull/461 [breaking-change]
2014-11-23Remove type parameters from ExprField and ExprTupFieldAdolfo Ochagavía-17/+11
2014-11-23libsyntax: Forbid type parameters in tuple indicesAdolfo Ochagavía-16/+8
This breaks code like ``` let t = (42i, 42i); ... t.0::<int> ...; ``` Change this code to not contain an unused type parameter. For example: ``` let t = (42i, 42i); ... t.0 ...; ``` Closes https://github.com/rust-lang/rust/issues/19096 [breaking-change]
2014-11-21unicode: Rename is_XID_start to is_xid_start, is_XID_continue to is_xid_continueBrian Anderson-3/+3
2014-11-21unicode: Add stability attributes to u_charBrian Anderson-2/+2
Free functions deprecated. UnicodeChar experimental pending final decisions about prelude.
2014-11-21core: Convert Char::escape_default, escape_unicode to iteratorsBrian Anderson-2/+2
[breaking-change]
2014-11-21Fix various deprecation warnings from char changesBrian Anderson-3/+3
2014-11-20auto merge of #19113 : nikomatsakis/rust/unboxed-boxed-closure-unification, ↵bors-18/+8
r=acrichto Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind). This supercedes PR #19089, which was already reviewed by @pcwalton.
2014-11-19rollup merge of #19103: huonw/literal-suffixesJakub Bukaj-218/+283
Futureproof Rust for fancier suffixed literals. The Rust compiler tokenises a literal followed immediately (no whitespace) by an identifier as a single token: (for example) the text sequences `"foo"bar`, `1baz` and `1u1024` are now a single token rather than the pairs `"foo"` `bar`, `1` `baz` and `1u` `1024` respectively. The compiler rejects all such suffixes in the parser, except for the 12 numeric suffixes we have now. I'm fairly sure this will affect very few programs, since it's not currently legal to have `<literal><identifier>` in a Rust program, except in a macro invocation. Any macro invocation relying on this behaviour can simply separate the two tokens with whitespace: `foo!("bar"baz)` becomes `foo!("bar" baz)`. This implements [RFC 463](https://github.com/rust-lang/rfcs/blob/master/text/0463-future-proof-literal-suffixes.md), and so closes https://github.com/rust-lang/rust/issues/19088.
2014-11-19Merge the ExprFnBlock and ExprUnboxedClosure into one ExprClosure with an ↵Niko Matsakis-18/+8
optional unboxed closure kind.
2014-11-20Switch numeric suffix parsing to use the new system.Huon Wilson-145/+99
This moves errors and all handling of numeric suffixes into the parser rather than the lexer.
2014-11-20Parse and store suffixes on literals.Huon Wilson-61/+179
This adds an optional suffix at the end of a literal token: `"foo"bar`. An actual use of a suffix in a expression (or other literal that the compiler reads) is rejected in the parser. This doesn't switch the handling of numbers to this system, and doesn't outlaw illegal suffixes for them yet.
2014-11-19Refactor QPath to take an ast::TraitRefNiko Matsakis-5/+5
2014-11-19Switch to an independent enum for `Lit*` subtokens.Huon Wilson-59/+52
2014-11-18auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichtonbors-1/+34
Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions. Closes #19024
2014-11-18Convert TyPolyTraitRef to accept arbitary bounds, so that things likeNiko Matsakis-3/+14
`Box<for<'a> Foo<&'a T> + 'a>` can be accepted. Also cleanup the visitor/fold in general, exposing more callbacks.
2014-11-17libsyntax: Add tests for `parse_view_item`Murarth-1/+26
2014-11-17libsyntax: Add `parse_view_item` method to ParserMurarth-0/+8