about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2019-05-27Avoid some re-interning in `to_lit_token`.Nicholas Nethercote-5/+8
2019-05-27Add `to_symbol` methods.Nicholas Nethercote-3/+3
2019-05-27Pre-intern "0", "1", ..., "9", and use where appropriate.Nicholas Nethercote-3/+3
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-1/+1
Most involving `Symbol::intern` on string literals.
2019-05-25review comments: move back some methods and clean up wordingEsteban Küber-172/+176
2019-05-25Move some methods to `diagnostics.rs` away from `parser.rs`Esteban Küber-413/+462
Move a bunch of error recovery methods to `diagnostics.rs` away from `parser.rs`.
2019-05-25Tweak `self` arg not as first argument of a method diagnosticEsteban Küber-37/+55
Mention that `self` is only valid on "associated functions" ``` error: unexpected `self` argument in function --> $DIR/self-in-function-arg.rs:1:15 | LL | fn foo(x:i32, self: i32) -> i32 { self } | ^^^^ not valid as function argument | = note: `self` is only valid as the first argument of an associated function ``` When it is a method, mention it must be first ``` error: unexpected `self` argument in function --> $DIR/trait-fn.rs:4:20 | LL | fn c(foo: u32, self) {} | ^^^^ must be the first associated function argument ```
2019-05-24Revert changes that belong to separate PREsteban Küber-1/+1
2019-05-24Move diagnostic logic out of parserEsteban Küber-19/+20
2019-05-24Fix rebaseEsteban Küber-4/+6
2019-05-24review commentsEsteban Küber-55/+64
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-37/+66
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-24Auto merge of #60803 - varkor:remove-in-place-syntax, r=petrochenkovbors-16/+0
Remove `ObsoleteInPlace` The in place syntax has been deprecated for over a year. As it is, this is accumulated cruft: the error messages are unlikely to be helpful any more and it conflicts with some useful syntax (e.g. const generics in some instances). It may be that removing `Token::LArrow` is backwards-incompatible. We should do a crater run to check. cc @eddyb
2019-05-24Auto merge of #60984 - matthewjasper:borrowck-error-reporting-cleanup, ↵bors-4/+5
r=pnkfelix Borrowck error reporting cleanup * Don't show variables created by desugarings in borrowck errors * Move "conflict error" reporting to it's own module, so that `error_reporting` contains only common error reporting methods. * Remove unused `ScopeTree` parameter. r? @pnkfelix
2019-05-24Remove `ObsoleteInPlace`varkor-16/+0
2019-05-24Rollup merge of #61056 - euclio:custom-discriminant-error, r=estebankMazdak Farrokhzad-16/+45
tweak discriminant on non-nullary enum diagnostic Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference. Fixes #61039. r? @estebank
2019-05-23tweak discriminant on non-nullary enum diagnosticAndy Russell-16/+45
Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference.
2019-05-23syntax: Some code cleanupVadim Petrochenkov-211/+155
2019-05-23syntax: Turn `token::Lit` into a structVadim Petrochenkov-175/+196
2019-05-23syntax: Remove an obsolete hack from literal comparisonsVadim Petrochenkov-9/+1
2019-05-23syntax: Fix spans for boolean literals passed to proc macrosVadim Petrochenkov-5/+5
2019-05-23syntax: More consistent wording for some literal parsing errorsVadim Petrochenkov-2/+2
2019-05-23syntax: Return named errors from literal parsing functionsVadim Petrochenkov-126/+164
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-0/+4
Add match arm scopes and other scope fixes * Add drop and lint scopes for match arms. * Lint attributes are now respected on match arms. * Make sure we emit a StorageDead if we diverge when initializing a temporary. * Adjust MIR pretty printing of scopes for locals. * Don't generate duplicate lint scopes for `let statements`. * Add some previously missing fake borrows for matches. closes #46525 cc @rust-lang/compiler
2019-05-22Restore the old behavior of the rustdoc keyword check + Fix rebaseVadim Petrochenkov-8/+7
2019-05-22Eliminate unnecessary `Ident::with_empty_ctxt`sVadim Petrochenkov-10/+8
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-244/+247
2019-05-22Rollup merge of #60995 - topecongiro:parser-from-stream-and-base-dir, ↵Mazdak Farrokhzad-0/+17
r=michaelwoerister Add stream_to_parser_with_base_dir This PR adds `stream_to_parser_with_base_dir`, which creates a parser from a token stream and a base directory. Context: I would like to parse `cfg_if!` macro and get a list of modules defined inside it from rustfmt so that rustfmt can format those modules (cc https://github.com/rust-lang/rustfmt/issues/3253). To do so, I need to create a parser from `TokenStream` and set the directory of `Parser` to the same directory as the parent directory of a file which contains `cfg_if!` invocation. AFAIK there is no way to achieve this, and hence this PR. Alternatively, I could change the visibility of `Parser.directory` from `crate` to `pub` so that the value can be modified after initializing a parser. I don't have a preference over either approach (or others, as long as it works).
2019-05-21Dont show variables from desugarings in borrowck errorsMatthew Jasper-4/+5
2019-05-21Give match arms an HirId and a SpanMatthew Jasper-0/+4
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-27/+31
2019-05-21Fix tidy: remove a trailing whitespacetopecongiro-1/+1
2019-05-21Add doc commenttopecongiro-0/+10
2019-05-21Add stream_to_parser_with_base_dirtopecongiro-0/+7
2019-05-19Improve type size assertionsVadim Petrochenkov-3/+3
Now they - Tell what the new size is, when it changes - Do not require passing an identifier
2019-05-18Auto merge of #60910 - nnethercote:avoid-some-unnecessary-interning, ↵bors-2/+3
r=petrochenkov Avoid some unnecessary interning r? @petrochenkov
2019-05-17Rollup merge of #60901 - estebank:str-str-str, r=CentrilManish Goregaokar-2/+1
Handle more string addition cases with appropriate suggestions
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-2/+3
A lot of these static symbols are pre-interned.
2019-05-16Fix binop spanEsteban Küber-2/+1
2019-05-16review commentsEsteban Küber-26/+22
2019-05-16Move some parser recovery methods to diagnosticsEsteban Küber-263/+271
2019-05-16Fix span for await macro callEsteban Küber-1/+1
2019-05-16Review commentsEsteban Küber-96/+68
- Change wording of suggestion - Move recovery logic to `diagnostics.rs` - Reduce ammount of code duplication
2019-05-16Simplify span usage for incorrect awaitEsteban Küber-3/+3
2019-05-16Split parser logic to its own methodEsteban Küber-87/+96
2019-05-16Parse alternative incorrect uses of await and recoverEsteban Küber-8/+105
2019-05-16Rollup merge of #60691 - topecongiro:await-macro-span, r=CentrilMazdak Farrokhzad-0/+1
Include expression to wait for to the span of Await Currently the span of `await!` only includes itself: ```rust await!(3); // ^^^^^ ``` This PR changes it so that the span holds the whole `await!` expression: ```rust await!(3); // ^^^^^^^^^
2019-05-16Auto merge of #60763 - matklad:tt-parser, r=petrochenkovbors-43/+62
Move token tree related lexer state to a separate struct Just a types-based refactoring. We only used a bunch of fields when tokenizing into a token tree, so let's move them out of the base lexer
2019-05-13move raw span to tt readerAleksey Kladov-1/+2
See https://github.com/rust-lang/rust/pull/50838/files#r283296243 for explanation how jointness checking works with *next* pair
2019-05-13move span and token to tt readerAleksey Kladov-40/+35