about summary refs log tree commit diff
path: root/src/librustc_parse
AgeCommit message (Collapse)AuthorLines
2020-03-01Rollup merge of #69579 - petrochenkov:noprevspan, r=CentrilYuki Okushi-207/+224
parser: Remove `Parser::prev_span` Follow-up to https://github.com/rust-lang/rust/pull/69384. r? @Centril
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-84/+94
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Replace ptr hashing with ptr castingDavid-15/+6
Implementes suggeseted changes by Centril. This checks whether the memory location of the cast remains the same after atttempting to parse a postfix operator after a cast has been parsed. If the address is not the same, an illegal postfix operator was parsed. Previously the code generated a hash of the pointer, which was overly complex and inefficent. Casting the pointers and comparing them is simpler and more effcient.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-82/+92
2020-02-29Rollup merge of #69587 - petrochenkov:reqname, r=CentrilDylan DPC-3/+4
rustc_parse: Tweak the function parameter name check The function doesn't need a full token, only its edition. Noticed while implementing https://github.com/rust-lang/rust/pull/69384. I'm still not sure whether normalized or unnormalized token is a better fit for the edition check here, so https://github.com/rust-lang/rust/pull/69384 and this PR just keep the status quo behavior. r? @Centril
2020-02-29Make it build againVadim Petrochenkov-3/+3
2020-02-29rustc_parse: Tweak the function parameter name checkVadim Petrochenkov-3/+4
2020-02-29Auto merge of #69260 - GuillaumeGomez:create-E0747-error-code, r=varkor,estebankbors-2/+6
Create E0747 error code for unterminated raw strings Reopening of #66035. r? @estebank
2020-02-29parser: Remove `Parser::prev_span`Vadim Petrochenkov-10/+12
2020-02-29parser: `prev_span` -> `prev_token.span`Vadim Petrochenkov-197/+212
2020-02-29Auto merge of #69570 - Dylan-DPC:rollup-d6boczt, r=Dylan-DPCbors-4/+4
Rollup of 6 pull requests Successful merges: - #69477 (docs: add mention of async blocks in move keyword docs) - #69504 (Use assert_ne in hash tests) - #69546 (use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.) - #69551 (use is_empty() instead of len() == x to determine if structs are empty.) - #69563 (Fix no_std detection for target triples) - #69567 (use .to_string() instead of format!() macro to create strings) Failed merges: r? @ghost
2020-02-29Auto merge of #69255 - estebank:e0599-details, r=varkorbors-2/+4
Add more context to E0599 errors Point at the intermediary unfulfilled trait bounds. Fix #52523, fix #61661, cc #36513, fix #68131, fix #64417, fix #61768, cc #57457, cc #9082, fix #57994, cc #64934, cc #65149.
2020-02-29Rollup merge of #69567 - matthiaskrgr:useless_fmt, r=nagisaDylan DPC-1/+1
use .to_string() instead of format!() macro to create strings handles what is left after https://github.com/rust-lang/rust/pull/69541
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-3/+3
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-29use .to_string() instead of format!() macro to create stringsMatthias Krüger-1/+1
2020-02-28Suggest constraining type parametersEsteban Küber-2/+4
2020-02-28Rollup merge of #69547 - matthiaskrgr:more_misc, r=Mark-SimulacrumMazdak Farrokhzad-1/+1
remove redundant clones, references to operands, explicit boolean comparisons and filter(x).next() calls.
2020-02-28Rollup merge of #69541 - dotdash:format, r=Mark-SimulacrumMazdak Farrokhzad-9/+6
Remove unneeded calls to format!()
2020-02-28Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morseMazdak Farrokhzad-1/+1
use char instead of &str for single char patterns
2020-02-28Rollup merge of #69384 - petrochenkov:nounnorm, r=CentrilMazdak Farrokhzad-69/+59
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token` So, after https://github.com/rust-lang/rust/pull/69006, its follow-ups and an attempt to remove `Parser::prev_span` I came to the conclusion that the unnormalized token and its span is what you want in most cases, so it should be default. Normalization only makes difference in few cases where we are checking against `token::Ident` or `token::Lifetime` specifically. This PR uses `normalized_token` for those cases. Using normalization explicitly means that people writing code should remember about `NtIdent` and `NtLifetime` in general. (That is alleviated by the fact that `token.ident()` and `fn parse_ident_*` are already written.) Remembering about `NtIdent`, was, however, already the case, kind of, because the implicit normalization was performed only for the current/previous token, but not for things like `look_ahead`. As a result, most of token classification methods in `token.rs` already take `NtIdent` into account (this PR fixes a few pre-existing minor mistakes though). The next step is removing `normalized(_prev)_token` entirely and replacing it with `token.ident()` (mostly) and `token.normalize()` (occasionally). I want to make it a separate PR for that and run it though perf. `normalized_token` filled on every bump has both a potential to avoid repeated normalization, and to do unnecessary work in advance (it probably doesn't matter anyway, the normalization is very cheap). r? @Centril
2020-02-28Add E0747 error codeGuillaume Gomez-2/+6
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-3/+3
2020-02-28remove redundant clones, references to operands, explicit boolean ↵Matthias Krüger-1/+1
comparisons and filter(x).next() calls.
2020-02-28Rollup merge of #69529 - matthiaskrgr:clippy_identity_conversion, ↵Dylan DPC-17/+11
r=Mark-Simulacrum don't use .into() to convert types into identical types. This removes redundant `.into()` calls. example: `let s: String = format!("hello").into();`
2020-02-27don't use .into() to convert types into identical types.Matthias Krüger-17/+11
example: let s: String = format!("hello").into();
2020-02-27Remove unneeded calls to format!()Björn Steinbrink-9/+6
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-27use find(x) instead of filter(x).next()Matthias Krüger-11/+4
2020-02-26Rollup merge of #69447 - Centril:minor-stmt-refactor, r=estebankDylan DPC-94/+87
Minor refactoring of statement parsing Extracted out of https://github.com/rust-lang/rust/pull/69445. r? @estebank
2020-02-26Rollup merge of #69423 - petrochenkov:nont, r=CentrilDylan DPC-11/+0
syntax: Remove `Nt(Impl,Trait,Foreign)Item` Follow-up to https://github.com/rust-lang/rust/pull/69366. r? @Centril
2020-02-25parse: address nitpickMazdak Farrokhzad-3/+2
2020-02-25parse: move condition into guardMazdak Farrokhzad-28/+28
2020-02-24parse: simplify `parse_stmt_without_recovery`.Mazdak Farrokhzad-36/+29
2020-02-24parse: extract `parse_stmt_item` & `parse_stmt_path_start`.Mazdak Farrokhzad-32/+33
2020-02-24syntax: Remove `Nt(Impl,Trait,Foreign)Item`Vadim Petrochenkov-11/+0
2020-02-24don't explicitly compare against true or falseMatthias Krüger-2/+2
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-65/+56
2020-02-24Add some missing support for `NtIdent`Vadim Petrochenkov-4/+3
2020-02-24parse: tweak diagnostic wordingsMazdak Farrokhzad-5/+5
2020-02-24parse: tweak `parse_item_` for more reuse.Mazdak Farrokhzad-19/+9
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-32/+32
2020-02-24parse: `NtItem` -> `parse_item_common`.Mazdak Farrokhzad-8/+9
2020-02-24parser: tweak item kind wordingMazdak Farrokhzad-11/+9
2020-02-24parser: tweak unmatched wordingMazdak Farrokhzad-5/+6
2020-02-24parser: refactor away at_endMazdak Farrokhzad-9/+3
2020-02-24parse: move token hack into `parse_item_common`.Mazdak Farrokhzad-55/+31
2020-02-24parse: use `parse_item_common` in `parse_assoc_item_`.Mazdak Farrokhzad-144/+72
2020-02-24parse: use `parse_item_common` in `parse_foreign_item`.Mazdak Farrokhzad-28/+53
2020-02-24parse: recover `default` on free items.Mazdak Farrokhzad-13/+46
2020-02-24parse: extract `error_on_unmatched_vis`.Mazdak Farrokhzad-10/+16