about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
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-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-30/+92
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-6/+19
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-30/+79
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-14/+14
2014-11-18auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichtonbors-0/+8
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 `parse_view_item` method to ParserMurarth-0/+8
2014-11-18rollup merge of #19020: Gankro/better-warnJakub Bukaj-1/+2
Came up on IRC that this was a bit unhelpful as to what should actually be *done*. I am new to changing compiler messages, please let me know if there's anything else that needs to be done to accomadate this change. (My build system is still constantly crashing [Is bors contagious?], so this hasn't been formally `check`ed. I figure it's a simple enough change that any consequences [like compile-fail expected messages?] can be eyeballed by someone more experienced.)
2014-11-18rollup merge of #19018: tomjakubowski/fix-issue-19003Jakub Bukaj-1/+9
Make struct variant syntax more consistent with struct syntax and fix an assert in middle::typeck. Fix #19003
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+3
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17slightly better deprecation message for fn syntaxAlexis Beingessner-1/+2
2014-11-16Disallow parsing of struct variants with 0 fieldsTom Jakubowski-1/+9
Make struct variant syntax more consistent with struct syntax and fix an assert in middle::typeck. Fix #19003
2014-11-16auto merge of #18994 : sfackler/rust/struct-variants-pt2, r=jakub-bors-4/+8
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change] r? @alexcrichton
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-96/+60
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-15Un-feature gate struct variantsSteven Fackler-4/+8
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change]
2014-11-14auto merge of #18840 : huonw/rust/tweaks, r=alexcrichtonbors-24/+40
Fix some old papercuts with diagnostics, e.g. tweaking spans, rewording messages. See individual commits.
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-0/+1
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-13Use the correct span for out-of-range int literals.Huon Wilson-1/+2
This corrects the error message to point at the literal, not the next token. Closes #17123.
2014-11-13Add more "help: ..."'s to the parser.Huon Wilson-23/+38
Adds a method for printing a fatal error and also a help message to the parser and uses this in a variety of places to improve error messages. Closes #12213.
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-0/+1
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-11libsyntax: Forbid type parameters in field expressions.Patrick Walton-1/+8
This breaks code like: struct Foo { x: int, } let f: Foo = ...; ... f.x::<int> ... Change this code to not contain an unused type parameter. For example: struct Foo { x: int, } let f: Foo = ...; ... f.x ... Closes #18680. [breaking-change]
2014-11-07Update parser with `for` syntaxNiko Matsakis-136/+174
2014-11-07auto merge of #17830 : pczarn/rust/interp_tt, r=pnkfelixbors-68/+28
Closes #14197 Removes the `matchers` nonterminal. If you're using `$foo:matchers` in a macro, write `$foo:tt` instead. [breaking-change]
2014-11-07Add `ast::SequenceRepetition`Piotr Czarnecki-2/+9
2014-11-06Remove the unboxed closure `|:|` notation from types and trait references ↵Niko Matsakis-50/+16
completely.
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-44/+54
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-11-06Restructure parsing of paths, which is quite torturedNiko Matsakis-42/+108
2014-11-05Remove `Matcher`sPiotr Czarnecki-62/+2
2014-11-05Use `TokenTree`s in lhs of macrosPiotr Czarnecki-5/+18
2014-11-05Register snapshots.Eduard Burtescu-11/+0
2014-11-03rollup merge of #18562 : nick29581/dxr-1Alex Crichton-17/+3
2014-11-03rollup merge of #18506 : nikomatsakis/assoc-type-boundsAlex Crichton-7/+4
2014-11-03Restructure AST so that the associated type definition carriesNiko Matsakis-7/+4
bounds like any other "type parameter".
2014-11-03Ignore whitespace tokens when re-computing spans in save_analysisNick Cameron-17/+3
2014-11-02Convert some notes to help messagesP1start-5/+14
Closes #18126.
2014-10-30rollup merge of #18430 : bjz/tokenAlex Crichton-207/+204
Conflicts: src/libsyntax/parse/parser.rs
2014-10-30Add a message for when a `.` follows a macro invocationP1start-0/+10
2014-10-30Improve the error message for parenthesised box expressionsP1start-0/+14
Closes #15386.
2014-10-30Formatting fixesBrendan Zabarauskas-5/+13
2014-10-30Remove Token::get_close_delimiterBrendan Zabarauskas-47/+33
We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-160/+163
This common representation for delimeters should make pattern matching easier. Having a separate `token::DelimToken` enum also allows us to enforce the invariant that the opening and closing delimiters must be the same in `ast::TtDelimited`, removing the need to ensure matched delimiters when working with token trees.
2014-10-29Rename fail! to panic!Steve Klabnik-2/+2
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Move token-to-string functions into print::pprustBrendan Zabarauskas-1/+2
2014-10-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-6/+6
2014-10-28Convert some token functions into methodsBrendan Zabarauskas-109/+81