about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2017-01-25Auto merge of #35712 - oli-obk:exclusive_range_patterns, r=nikomatsakisbors-12/+31
exclusive range patterns adds `..` patterns to the language under a feature gate (`exclusive_range_pattern`). This allows turning ``` rust match i { 0...9 => {}, 10...19 => {}, 20...29 => {}, _ => {} } ``` into ``` rust match i { 0..10 => {}, 10..20 => {}, 20..30 => {}, _ => {} } ```
2017-01-24parser: Permit trailing +'s in bound listsVadim Petrochenkov-11/+3
2017-01-24Improve some expected/found error messages from parserVadim Petrochenkov-12/+49
2017-01-24Refactor parsing of generic arguments/parameters and where clausesVadim Petrochenkov-433/+271
2017-01-24Auto merge of #39173 - jseyfried:tokenstream, r=nrcbors-19/+10
Refactor `TokenStream` r? @nrc
2017-01-24Add an option to the parser so cfg'ed out modules can still be parsedNick Cameron-1/+5
2017-01-23Remove `open_span` and `close_span` from `Delimited`.Jeffrey Seyfried-18/+9
2017-01-22Refactor `TokenStream`.Jeffrey Seyfried-1/+1
2017-01-20Rollup merge of #39179 - petrochenkov:objparen, r=eddybAlex Crichton-2/+9
Fix regression in parsing of trait object types Fixes https://github.com/rust-lang/rust/issues/39169 Accepting parens in this position is a regression itself, introduced in Rust 1.6 by https://github.com/rust-lang/rust/pull/29870, so I hope to revert this in my next bounds refactoring patch (possibly with a warning, crater run, etc). r? @eddyb
2017-01-20Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrcAlex Crichton-308/+276
Refactor the parser to consume token trees This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers. This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates. r? @nrc
2017-01-19Fix regression in parsing of trait object typesVadim Petrochenkov-2/+9
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-12/+31
2017-01-17Fix fallout in `rustdoc`.Jeffrey Seyfried-3/+3
2017-01-17Remove the lookahead buffer.Jeffrey Seyfried-37/+14
2017-01-17Auto merge of #39110 - petrochenkov:sum, r=eddybbors-58/+110
Merge ObjectSum and PolyTraitRef in AST/HIR + some other refactoring `ObjectSum` and `PolyTraitRef` are the same thing (list of bounds), they exist separately only due to parser quirks. The second commit merges them. The first commit replaces `Path` with `Ty` in (not yet supported) equality predicates. They are parsed as types anyway and arbitrary types can always be disguised as paths using aliases, so this doesn't add any new functionality. The third commit uses `Vec` instead of `P<[T]>` in AST. AST is not immutable like HIR and `Vec`s are more convenient for it, unnecessary conversions are also avoided. The last commit renames `parse_ty_sum` (which is used for parsing types in general) into `parse_ty`, and renames `parse_ty` (which is used restricted contexts where `+` is not permitted due to operator priorities or other reasons) into `parse_ty_no_plus`. This is the first part of https://github.com/rust-lang/rust/issues/39085#issuecomment-272743755 and https://github.com/rust-lang/rust/issues/39080 focused on data changes and mechanical renaming, I'll submit a PR with parser changes a bit later. r? @eddyb
2017-01-17Avoid interpolated token trees.Jeffrey Seyfried-20/+6
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-174/+20
2017-01-17Introduce `string_reader.parse_all_token_trees()`.Jeffrey Seyfried-15/+184
2017-01-17Give the `StringReader` a `sess: &ParseSess`.Jeffrey Seyfried-58/+51
2017-01-17Rename ObjectSum into TraitObject in AST/HIRVadim Petrochenkov-2/+2
2017-01-17Remove field `tokens_consumed` of `Parser`.Jeffrey Seyfried-3/+0
2017-01-17syntax: Rename parse_ty -> parse_ty_no_plus, parse_ty_sum -> parse_tyVadim Petrochenkov-37/+41
2017-01-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-19/+19
2017-01-17AST/HIR: Merge ObjectSum and PolyTraitRefVadim Petrochenkov-4/+52
2017-01-16Rename ExprKind::Vec to Array in HIR and HAIR.Scott Olson-3/+3
This is a clearer name since they represent [a, b, c] array literals.
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-3/+10
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-3/+9
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-24Auto merge of #38268 - withoutboats:parse_where_higher_rank_hack, r=eddybbors-0/+17
Prevent where < ident > from parsing. In order to be forward compatible with `where<'a>` syntax for higher rank parameters, prevent potential conflicts with UFCS from parsing correctly for the near term.
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-14/+12
2016-12-19Optimize `ast::PathSegment`.Jeffrey Seyfried-70/+23
2016-12-17Auto merge of #38279 - KalitaAlexey:issue-8521, r=jseyfriedbors-1/+1
macros: allow a `path` fragment to be parsed as a type parameter bound Allow a `path` fragment to be parsed as a type parameter bound. Fixes #8521.
2016-12-17Auto merge of #38205 - jseyfried:fix_module_directory_regression, r=eddybbors-9/+10
macros: fix the expected paths for a non-inline module matched by an `item` fragment Fixes #38190. r? @nrc
2016-12-16Allow path fragments to be parsed as type parameter bounds in macro expansionKalita Alexey-1/+1
2016-12-12Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichtonbors-1/+1
Rename 'librustc_unicode' crate to 'libstd_unicode'. Fixes https://github.com/rust-lang/rust/issues/26554.
2016-12-09Fix mistake.Without Boats-1/+1
2016-12-09Improve error message.Without Boats-1/+1
2016-12-09Prevent where < ident > from parsing.Without Boats-0/+17
In order to be forward compatible with `where<'a>` syntax for higher rank parameters, prevent potential conflicts with UFCS from parsing correctly for the near term.
2016-12-07macros: fix the expected paths for a non-inline module matched by an `item` ↵Jeffrey Seyfried-9/+10
fragment.
2016-12-06annotate stricter lifetimes on LateLintPass methods to allow them to forward ↵Oliver Schneider-2/+2
to a Visitor
2016-11-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-1/+1
Fixes #26554.
2016-11-25Support `?Sized` in where clausesVadim Petrochenkov-27/+10
2016-11-22Auto merge of #37487 - goffrie:break, r=nikomatsakisbors-5/+15
Implement the `loop_break_value` feature. This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. - ~~I have also changed the loop scoping in MIR-building so that the test of a while loop is not considered to be part of that loop. This makes the rules consistent with #37360. The new loop scopes in typeck also follow this rule. That means that `loop { while (break) {} }` now terminates instead of looping forever. This is technically a breaking change.~~ - ~~On that note, expressions like `while break {}` and `if break {}` no longer parse because `{}` is interpreted as an expression argument to `break`. But no code except compiler test cases should do that anyway because it makes no sense.~~ - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^
2016-11-21Implement the `loop_break_value` feature.Geoffry Song-5/+15
This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, `loop` loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. `while` loops are unchanged. - `break` respects contexts in which expressions may not end with braced blocks. That is, `while break { break-value } { while-body }` is illegal; this preserves backwards compatibility. - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^
2016-11-22Start warning cycle.Jeffrey Seyfried-11/+37
2016-11-22Clean up directory ownership semantics.Jeffrey Seyfried-57/+66
2016-11-21Fix fallout in `rustdoc` and tests.Jeffrey Seyfried-32/+28
2016-11-21Cleanup `InternedString`.Jeffrey Seyfried-1/+1
2016-11-21Use `Symbol` instead of `InternedString` in the AST, HIR, and various other ↵Jeffrey Seyfried-75/+47
places.
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-309/+45
2016-11-20Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.Jeffrey Seyfried-5/+4