about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2015-07-13Auto merge of #26750 - nrc:refactor-submod, r=sfacklerbors-68/+108
This makes the functionality usable from outside the parser
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-1/+1
2015-07-09Fix a span bug for qualified pathsNick Cameron-4/+2
2015-07-03Refactor how the parser looks for sub-modulesNick Cameron-68/+108
This makes the functionality usable from outside the parser
2015-06-11Auto merge of #26190 - Veedrac:no-iter, r=alexcrichtonbors-5/+5
Pull request for #26188.
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-5/+5
2015-06-09Exise 'unsafe pointer' in favor of 'raw pointer'Steve Klabnik-1/+1
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2015-06-08Auto merge of #26091 - chellmuth:pub-struct-field-span, r=nrcbors-1/+4
Issue: #26083 Re-submitting https://github.com/rust-lang/rust/pull/26084 r? @nrc
2015-06-07StructField span should include `pub`Chris Hellmuth-1/+4
2015-06-04Fix span for ExprPath variantsMarcus Klaas-2/+1
2015-05-26Fix typo.Nick Hamann-1/+1
2015-05-21Make various fixes:Niko Matsakis-27/+41
- add feature gate - add basic tests - adjust parser to eliminate conflict between `const fn` and associated constants - allow `const fn` in traits/trait-impls, but forbid later in type check - correct some merge conflicts
2015-05-21syntax: parse `const fn` for free functions and inherent methods.Eduard Burtescu-12/+39
2015-05-17Auto merge of #25387 - eddyb:syn-file-loader, r=nikomatsakisbors-5/+3
This allows compiling entire crates from memory or preprocessing source files before they are tokenized. Minor API refactoring included, which is a [breaking-change] for libsyntax users: * `ParseSess::{next_node_id, reserve_node_ids}` moved to rustc's `Session` * `new_parse_sess` -> `ParseSess::new` * `new_parse_sess_special_handler` -> `ParseSess::with_span_handler` * `mk_span_handler` -> `SpanHandler::new` * `default_handler` -> `Handler::new` * `mk_handler` -> `Handler::with_emitter` * `string_to_filemap(sess source, path)` -> `sess.codemap().new_filemap(path, source)`
2015-05-16Auto merge of #25487 - P1start:extern-crate-unexpected-error, r=huonwbors-5/+1
Closes #25468.
2015-05-16Clarify the error message for malformed `extern crate` statementsP1start-5/+1
Closes #25468.
2015-05-16Fix the spans of `move` closuresP1start-4/+5
Closes #24986.
2015-05-15syntax: Add unquoting ast::{Generics,WhereClause}Erick Tryzelaar-0/+4
2015-05-14syntax: abstract over the file loading mechanism.Eduard Burtescu-3/+2
2015-05-14syntax: replace sess.span_diagnostic.cm with sess.codemap().Eduard Burtescu-2/+1
2015-05-12Auto merge of #25171 - quantheory:associated_time_long_paths, r=nikomatsakisbors-35/+15
It is currently broken to use syntax such as `<T as Foo>::U::static_method()` where `<T as Foo>::U` is an associated type. I was able to fix this and simplify the parser a bit at the same time. This also fixes the corresponding issue with associated types (#22139), but that's somewhat irrelevant because #22519 is still open, so this syntax still causes an error in type checking. Similarly, although this fix applies to associated consts, #25046 forbids associated constants from using type parameters or `Self`, while #19559 means that associated types have to always have one of those two. Therefore, I think that you can't use an associated const from an associated type anyway.
2015-05-07Fix use of UFCS syntax to call methods on associated types.Sean Patrick Santos-35/+15
2015-05-05Use `empty()` instead of a special constTamir Duberstein-3/+2
2015-05-01Rollup merge of #24981 - carols10cents:remove-more-priv, r=alexcrichtonManish Goregaokar-1/+1
Hi! While researching stuff for the reference and the grammar, I came across a few mentions of using the `priv` keyword that was removed in 0.11.0 (#13547, #8122, rust-lang/rfcs#26, [RFC 0026](https://github.com/rust-lang/rfcs/blob/master/text/0026-remove-priv.md)). One occurrence is a mention in the reference, a few are in comments, and a few are marking test functions. I left the test that makes sure you can't name an ident `priv` since it's still a reserved keyword. I did a little grepping around for `priv `, priv in backticks, `Private` etc and I think the remaining instances are fine, but if anyone knows anywhere in particular I should check for any other lingering mentions of `priv`, please let me know and I would be happy to! :fallen_leaf: :ocean:
2015-04-29Remove mention of 'priv'; visibility is either PUB or nothingCarol Nichols-1/+1
2015-04-29FalloutTamir Duberstein-17/+20
2015-04-27Auto merge of #23606 - quantheory:associated_const, r=nikomatsakisbors-81/+134
Closes #17841. The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough. There is still some significant functionality missing from this commit: - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~ - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet. - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865. - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~ Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-25Interpolate AST nodes in quasiquote.Geoffry Song-1/+6
This changes the `ToTokens` implementations for expressions, statements, etc. with almost-trivial ones that produce `Interpolated(*Nt(...))` pseudo-tokens. In this way, quasiquote now works the same way as macros do: already-parsed AST fragments are used as-is, not reparsed. The `ToSource` trait is removed. Quasiquote no longer involves pretty-printing at all, which removes the need for the `encode_with_hygiene` hack. All associated machinery is removed. A new `Nonterminal` is added, NtArm, which the parser now interpolates. This is just for quasiquote, not macros (although it could be in the future). `ToTokens` is no longer implemented for `Arg` (although this could be added again) and `Generics` (which I don't think makes sense). This breaks any compiler extensions that relied on the ability of `ToTokens` to turn AST fragments back into inspectable token trees. For this reason, this closes #16987. As such, this is a [breaking-change]. Fixes #16472. Fixes #15962. Fixes #17397. Fixes #16617.
2015-04-25Fix #20616York Xiang-1/+32
2015-04-23Get associated consts working in match patterns.Sean Patrick Santos-79/+110
2015-04-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-2/+24
constants is not yet working.
2015-04-24Do not include attributes in trait item spans.Nick Cameron-5/+4
(And other kinds of items).
2015-04-23Auto merge of #24683 - P1start:help-suggestions, r=nrcbors-3/+8
This PR uses the inline error suggestions introduced in #24242 to modify a few existing `help` messages. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-22Auto merge of #24685 - nrc:span-pred, r=huonwbors-3/+3
2015-04-22Fix spans for predicates in where clausesNick Cameron-3/+3
2015-04-21syntax: Remove #[feature(path_ext)]Erick Tryzelaar-2/+3
Replace Path::exists with stable metadata call.
2015-04-21syntax: replace Vec::push_all with stable Vec::extendErick Tryzelaar-9/+14
2015-04-21syntax: Replace String::from_str with the stable String::fromErick Tryzelaar-1/+1
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-3/+3
2015-04-21Change a few error messages to give code suggestionsP1start-3/+8
PR #24242 added the ability to the compiler to directly give suggestions about how to modify code to fix an error. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
2015-04-16Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichtonbors-9/+9
r? @alexcrichton
2015-04-15Rollup merge of #24438 - nrc:tuple-span, r=sfacklerSteve Klabnik-1/+1
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-2/+2
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-7/+7
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-15Fix the span for tuple expressionsNick Cameron-1/+1
2015-04-13syntax: Publically expose printing where clauses, and add attr_to_stringErick Tryzelaar-1/+1
2015-04-12Fix spans for macrosNick Cameron-9/+11
2015-04-09Fix the span for `for` expressionsNick Cameron-1/+1
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-1219/+1275
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-04-02Fix parsing of patterns in macrosVadim Petrochenkov-1/+3