about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
AgeCommit message (Collapse)AuthorLines
2015-01-08Store deprecated status of i/u-suffixed literals.Huon Wilson-4/+4
2015-01-07use slicing sugarJorge Aparicio-24/+24
2015-01-06More test fixesAlex Crichton-4/+4
2015-01-06rollup merge of #19430: pczarn/interp_tt-cleanupAlex Crichton-1/+3
Conflicts: src/libsyntax/parse/parser.rs
2015-01-07Cleanup and followup to PR #17830: parsing changesPiotr Czarnecki-1/+3
Prevents breaking down `$name` tokens into separate `$` and `name`. Reports unknown macro variables. Fixes #18775 Fixes #18839 Fixes #15640
2015-01-06Register new snapshotsAlex Crichton-2/+1
Conflicts: src/librbml/lib.rs src/libserialize/json_stage0.rs src/libserialize/serialize_stage0.rs src/libsyntax/ast.rs src/libsyntax/ext/deriving/generic/mod.rs src/libsyntax/parse/token.rs
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-7/+7
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-06rollup merge of #20609: cmr/memAlex Crichton-2/+4
2015-01-07falloutNick Cameron-3/+3
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-7/+7
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-23/+23
2015-01-06syntax/rustc: implement isize/usizeCorey Richardson-2/+4
2015-01-05Reformat metadata for exported macrosKeegan McAllister-0/+4
Instead of copy-pasting the whole macro_rules! item from the original .rs file, we serialize a separate name, attributes list, and body, the latter as pretty-printed TTs. The compilation of macro_rules! macros is decoupled somewhat from the expansion of macros in item position. This filters out comments, and facilitates selective imports.
2015-01-05Rename macro_escape to macro_useKeegan McAllister-1/+2
In the future we want to support #[macro_use(foo, bar)] mod macros; but it's not an essential part of macro reform. Reserve the syntax for now.
2015-01-05Stop using macro_escape as an inner attributeKeegan McAllister-1/+3
In preparation for the rename.
2015-01-05Add a special macro nonterminal $crateKeegan McAllister-1/+1
2015-01-03syntax: fix falloutJorge Aparicio-1/+1
2014-12-31syntax: unbox closures used in let bindingsJorge Aparicio-5/+5
2014-12-21Fallout of std::str stabilizationAlex Crichton-27/+27
2014-12-20Fix fallout of removing import_shadowing in tests.Eduard Burtescu-4/+3
2014-12-14Rename FnStyle trait to Unsafety.Niko Matsakis-1/+1
2014-12-13libsyntax: use tuple indexingJorge Aparicio-8/+8
2014-12-06libsyntax: remove unnecessary `to_string()` callsJorge Aparicio-1/+1
2014-12-03syntax: support ES6-style unicode escapesCorey Richardson-5/+17
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-11-26Implement the new parsing rules for types in the parser, modifying the AST ↵Niko Matsakis-1/+1
appropriately.
2014-11-19rollup merge of #19103: huonw/literal-suffixesJakub Bukaj-69/+76
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-20Switch numeric suffix parsing to use the new system.Huon Wilson-69/+76
This moves errors and all handling of numeric suffixes into the parser rather than the lexer.
2014-11-17libsyntax: Add tests for `parse_view_item`Murarth-1/+26
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-4/+3
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
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-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-1/+1
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-16/+8
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-10-30Use common variants for open and close delimitersBrendan Zabarauskas-43/+27
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-16/+16
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-28Use an enum rather than a bool in token::IdentBrendan Zabarauskas-9/+9
2014-10-28Use PascalCase for token variantsBrendan Zabarauskas-26/+26
2014-10-26Update parse::test::string_to_tts_1 testBrendan Zabarauskas-113/+100
2014-10-26Use standard capitalisation for TokenTree variantsBrendan Zabarauskas-25/+25
2014-10-26Rename TokenTree variants for clarityBrendan Zabarauskas-25/+25
This should be clearer, and fits in better with the `TTNonterminal` variant. Renames: - `TTTok` -> `TTToken` - `TTDelim` -> `TTDelimited` - `TTSeq` -> `TTSequence`
2014-10-26Add Span and separate open/close delims to TTDelimBrendan Zabarauskas-19/+18
This came up when working [on the gl-rs generator extension](https://github.com/bjz/gl-rs/blob/990383de801bd2e233159d5be07c9b5622827620/src/gl_generator/lib.rs#L135-L146). The new definition of `TTDelim` adds an associated `Span` that covers the whole token tree and enforces the invariant that a delimited sequence of token trees must have an opening and closing delimiter. A `get_span` method has also been added to `TokenTree` type to make it easier to implement better error messages for syntax extensions.
2014-10-22auto merge of #18141 : phildawes/rust/master, r=brsonbors-1/+41
Hello! I noticed spans are wrong for the PatIdents of self args. (I use spans a lot in racer)
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-5/+5
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-18Parser: Fix spans of explicit self arg identsPhil Dawes-1/+41
2014-10-16libsyntax: Remove all uses of {:?}.Luqman Aden-3/+3
2014-09-18Fix fallout in tests from removing the use of Gc in ExpnInfo.Eduard Burtescu-2/+2
2014-09-17rebasing fixesNick Cameron-1/+1
2014-09-17move most of front to libsyntaxNick Cameron-0/+19
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-29/+29
2014-08-26DST coercions and DST structsNick Cameron-1/+2
[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.