Guillaume Gomez
75d226ed76
Rollup merge of #56002 - Axary:master, r=estebank
...
fix #55972 : Erroneous self arguments on bare functions emit subpar compilation error
#55972
r? @estebank
2018-11-22 10:37:50 +01:00
Axary
88d60941da
improve error note
2018-11-20 14:43:16 +01:00
Axary
2be930bd03
fix tidy (remove whitespace)
2018-11-16 19:35:13 +01:00
Axary
fe23ffbda0
improve error when self is used as not the first argument
2018-11-16 19:27:27 +01:00
Axary
646d68f585
add a note to the error message
2018-11-16 18:43:06 +01:00
Axary
218e35efa1
eat CloseDelim
2018-11-16 13:54:49 +01:00
Eric Huss
7f4bc2247a
Clean up some non-mod-rs stuff.
2018-11-14 18:55:41 -08:00
Nicholas Nethercote
c6862992d9
Change Lit::short_name
to Lit::literal_name
.
...
This avoids a moderately hot allocation in `parse_lit_token`.
2018-11-12 15:16:03 +11:00
Mark Rousskov
686de87d2f
Rollup merge of #55777 - nnethercote:less-P-in-ast, r=petrochenkov
...
Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.
Because it results in fewer allocations and small speedups on some
benchmarks.
2018-11-08 18:15:19 -07:00
Nicholas Nethercote
706c2ad651
Use Lit
rather than P<Lit>
in ast::ExprKind
.
...
Because it results in fewer allocations and small speedups on some
benchmarks.
2018-11-08 19:00:55 +11:00
kennytm
9d9146ad95
Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwco
...
refactor: use shorthand fields
refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07 21:27:00 +08:00
teresy
eca11b99a7
refactor: use shorthand fields
2018-11-06 15:05:44 -05:00
bors
af791bb8f4
Auto merge of #55451 - estebank:arg-doc, r=pnkfelix
...
Custom diagnostic when trying to doc comment argument
When writing
```
pub fn f(
/// Comment
id: u8,
) {}
```
Produce a targeted diagnostic
```
error: documentation comments cannot be applied to method arguments
--> $DIR/fn-arg-doc-comment.rs:2:5
|
LL | /// Comment
| ^^^^^^^^^^^ doc comments are not allowed here
```
Fix #54801 .
2018-11-05 16:36:18 +00:00
bors
794fc062be
Auto merge of #55455 - estebank:expected-descr, r=michaelwoerister
...
Use token description in "expected/found" parse messages
Fix #54309 .
2018-11-04 06:56:11 +00:00
Alexander Regueiro
4bdc3d833a
Extended elaboration for trait aliases to include arbitrary bounds.
2018-11-03 04:09:34 +00:00
Alexander Regueiro
90041d638b
Added support for trait aliases as object types.
2018-11-03 04:09:34 +00:00
Esteban Küber
54858d5a67
Fix regression
2018-10-29 09:39:58 -07:00
Esteban Küber
3e22e0c3bc
Use token description in "expected/found" parse messages
2018-10-28 16:05:50 -07:00
Esteban Küber
adb96ec64b
Provide specific label for patern parsing error
2018-10-28 14:38:00 -07:00
Esteban Küber
d491734b15
Point at match
when a parse failure ocurrs inside of it
2018-10-28 11:41:23 -07:00
Esteban Küber
ea57134607
Produce targeted diagnostic when using doc comments on fn args
...
Before parsing argument names and types, try to consume an incorrectly
included doc comment or attribute in order to recover and continue
parsing the rest of the fn definition.
2018-10-28 11:38:50 -07:00
bors
4f5cfa611d
Auto merge of #55192 - cramertj:nested-mod, r=petrochenkov
...
Fix ordering of nested modules in non-mod.rs mods
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix #55094
2018-10-28 13:13:55 +00:00
Nick Cameron
59cb1705d7
rebasing and reviewer changes
...
Primarily refactoring `(Ident, Option<NodeId>)` to `Segment`
2018-10-26 09:50:51 +13:00
Nick Cameron
fc67d8fac4
Give each PathSegment a NodeId
2018-10-26 09:48:44 +13:00
ljedrz
d28aed6dc4
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations
2018-10-19 09:45:45 +02:00
Taylor Cramer
ca35ca8395
Fix ordering of nested modules in non-mod.rs mods
...
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix #55094
2018-10-18 17:11:51 -07:00
Donato Sciarra
406cbf1a39
Support underscore as constant name
...
Issue: 54912
2018-10-14 10:14:58 +02:00
kennytm
644dbf99ed
Rollup merge of #54967 - holmgr:master, r=estebank
...
Remove incorrect span for second label inner macro invocation
A fix for issue #54841
2018-10-12 22:04:16 +08:00
bors
a534216fa6
Auto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, r=nikomatsakis
...
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls
Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
2018-10-11 09:19:23 +00:00
Manish Goregaokar
e1e628ec87
Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelix
...
Fixes #47311 .
r? @nrc
2018-10-10 15:59:21 -07:00
Manish Goregaokar
8ebc6d6dbb
Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkov
...
Fixes #47311 .
r? @nrc
2018-10-10 15:58:40 -07:00
holmgr
05bb22d9e8
Remove incorrect span for second label inner macro invocation
2018-10-10 19:39:16 +02:00
Matthew Russo
344747330c
parse_trait_item_ now handles interpolated blocks as function body decls
2018-10-08 22:50:34 -04:00
Donato Sciarra
b7248d5988
Fix internal compiler error on malformed match arm pattern.
...
Issue: 54379
2018-10-07 13:14:21 +02:00
Havvy (Ryan Scheel)
1a867dc346
cfg_attr_multi: Basic implementation
...
Does not implement the warning or a feature flag.
2018-10-05 17:29:17 -07:00
Pietro Albini
a95a6e287a
Rollup merge of #54833 - abonander:issue-54441, r=petrochenkov
...
make `Parser::parse_foreign_item()` return a foreign item or error
Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter.
This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`.
closes #54441
r? @petrochenkov
cc @dtolnay
2018-10-05 22:33:17 +02:00
Andy Russell
f5db411410
add suggestion for inverted function parameters
...
Fixes #54065 .
2018-10-05 10:33:19 -04:00
Austin Bonander
9da428dad8
make Parser::parse_foreign_item()
return a foreign item or error
...
closes #54441
2018-10-05 02:47:57 -07:00
bors
c4501a0f1d
Auto merge of #52319 - tinco:issue_12590, r=pnkfelix
...
Track whether module declarations are inline (fixes #12590 )
To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
2018-09-27 09:51:12 +00:00
David Wood
3becbbc129
Fixed off-by-one span.
...
Fixes the off-by-one span issue where closure argument spans were
pointing to the token after the argument.
2018-09-23 14:18:34 +02:00
Pietro Albini
7c34cf7ee3
Rollup merge of #54415 - petrochenkov:norollback, r=estebank
...
parser: Tweak function parameter parsing to avoid rollback on succesfull path
Since rollback is not perfect and may e.g. leave non-fatal errors after it, we need to make sure compilation fails if it happens.
So in particular case of `fn parse_arg_general` we need to parse the "good" `TYPE` first and only then rollback and recover erroneous `PAT: TYPE` if necessary.
Found when working on https://github.com/rust-lang/rfcs/pull/2544#issuecomment-423293222 .
r? @ghost
2018-09-22 09:56:40 +02:00
Pietro Albini
1eee532eff
Rollup merge of #54409 - estebank:remove-in, r=pnkfelix
...
Detect `for _ in in bar {}` typo
Fix #36611 , #52964 , without modifying the parsing of emplacement `in` to avoid further problems like #50832 .
2018-09-22 09:56:37 +02:00
Pietro Albini
822c51121e
Rollup merge of #54261 - varkor:dyn-keyword-2018, r=petrochenkov
...
Make `dyn` a keyword in the 2018 edition
Proposed in https://github.com/rust-lang/rust/issues/44662#issuecomment-421596088 .
2018-09-22 09:56:27 +02:00
Esteban Küber
06d577d8b2
Detect for _ in in bar {}
typo
2018-09-20 22:40:44 -07:00
Vadim Petrochenkov
9784d3543f
parser: Tweak function parameter parsing to avoid rollback on succesfull path
2018-09-21 04:26:53 +03:00
Vitaly _Vi Shukela
d0790c490a
Whitespace fix again.
2018-09-17 20:26:05 +03:00
Vitaly _Vi Shukela
2b77760944
Fill in suggestions Applicability according to @estebank
...
Also fix some formatting along the way.
2018-09-17 03:20:08 +03:00
varkor
cb594cf373
Treat dyn
as a keyword in the 2018 edition
2018-09-16 23:34:42 +01:00
Vitaly _Vi Shukela
b6fea3255c
Remove usages of span_suggestion without Applicability
...
Use Applicability::Unspecified for all of them instead.
2018-09-16 21:42:46 +03:00
Vitaly _Vi Shukela
bc63a4a13a
issue 54109: use short suggestions
2018-09-15 02:05:32 +03:00