Nick Cameron
ffd2a0b9d7
Add some simple error recovery to the parser and fix tests
...
Some tests just add the extra errors, others I fix by doing some simple error recovery. I've tried to avoid doing too much in the hope of doing something more principled later.
In general error messages are getting worse at this stage, but I think in the long run they will get better.
2016-02-15 09:30:23 +13:00
Nick Cameron
0ef9c5f585
error correction for missing or mismatched closing brackets
2016-02-15 09:30:23 +13:00
Nick Cameron
36a9f0cff1
refactoring: inline some function in the parser
2016-02-15 09:30:23 +13:00
Vadim Petrochenkov
9f414a44a7
Split ast::PatKind::Enum into tuple struct and path patterns
2016-02-13 15:51:27 +03:00
Vadim Petrochenkov
14adc9bb63
Rename ast::Pat_ and its variants
2016-02-13 13:49:24 +03:00
Jeffrey Seyfried
d21e908175
Disallow non-inline modules without path annotations inside blocks and fix fallout
2016-02-13 07:05:28 +00:00
Jeffrey Seyfried
dbc2466f09
Only consider a module to be a directory owner if it is located within a directory owner
2016-02-13 07:01:41 +00:00
Jonas Schievink
c877d61b15
Use more autoderef in libsyntax
2016-02-12 19:28:42 +01:00
Vadim Petrochenkov
77cc5764b9
Remove some unnecessary indirection from AST structures
2016-02-11 23:33:09 +03:00
Oliver 'ker' Schneider
2b816b0d6a
[breaking-change] don't glob export ast::PathListItem_ variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
8b3856b1bc
[breaking-change] don't glob export ast::StrStyle variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
d844bfb196
[breaking-change] don't glob export ast::Visibility variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
dfe35da6b8
[breaking-change] don't glob export ast::TraitItemKind variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
73fa9b2da2
[breaking-change] don't glob export ast::Mutablity variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
e797e1961d
[breaking-change] don't glob export ast::MacStmtStyle
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
798974cae5
[breaking-change] don't glob export ast::KleeneOp variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
019614f03d
[breaking-change] don't glob export ast::Item_ variants
2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
0d6ddd1903
[breaking-change] don't glob export ast::ForeignItem_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
8290c950a8
[breaking-change] don't pub export ast::Stmt_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
498a2e416e
[breaking-change] don't pub export ast::IntLitType variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d
[breaking-change] don't pub export ast::Lit_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
05d4cefd63
[breaking-change] don't pub export ast::Ty_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
625e78b700
[breaking-change] don't glob export ast::{UintTy, IntTy} variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
80bf9ae18a
[breaking-change] don't glob export ast::Expr_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
1c4d437158
[breaking-change] don't glob export ast::ExplicitSelf_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
79fa657abc
[breaking-change] don't glob export ast::Decl_ variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
8516ba367d
[breaking-change] don't glob export ast::CaptureClause variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
243a30c931
[breaking-change] don't glob import/export syntax::abi enum variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
47b0784ba8
[breaking-change] don't glob export ast::BlockCheckMode variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
3b57d40fe5
[breaking-change] don't glob import ast::FunctionRetTy variants
2016-02-11 12:34:48 +01:00
Oliver Schneider
05e25de4f0
[breaking-change] don't glob export ast::BinOp_
2016-02-11 12:34:48 +01:00
Oliver Schneider
f875f4c4c2
[breaking-change] don't glob export ast::UnOp variants
2016-02-11 12:34:48 +01:00
Tomasz Miąsko
cecf83f592
Breaking tokens into pieces should behave similar to Parser::bump.
...
Previously when breaking tokens into smaller pieces, the replace_token
function have been used. It replaced current token and updated span
information, but it did not clear the list of expected tokens, neither
did it update remaining info about last token. This could lead to
incorrect error message, like one described in the issue #24780 :
expected one of ... `>` ... found `>`
2016-02-08 21:26:48 +01:00
Nick Cameron
b6e4f18e55
Replace some aborts with Results
...
Fixes #31207
by removing abort_if_new_errors
2016-02-01 08:42:27 +13:00
bors
8256c470a5
Auto merge of #31089 - fhahn:macro-ice, r=pnkfelix
...
This is a work in progress PR that potentially should fix #29084 , #28308 , #25385 , #28288 , #31011 . I think this may also adresse parts of #2887 .
The problem in this issues seems to be that when transcribing macro arguments, we just clone the argument Nonterminal, which still has to original spans. This leads to the unprintable spans. One solution would be to update the spans of the inserted argument to match the argument in the macro definition. So for [this testcase](https://github.com/rust-lang/rust/compare/master...fhahn:macro-ice?expand=1#diff-f7def7420c51621640707b6337726876R2 ) the error message would be displayed in the macro definition:
src/test/compile-fail/issue-31011.rs:4:12: 4:22 error: attempted access of field `trace` on type `&T`, but no field with that name was found
src/test/compile-fail/issue-31011.rs:4 if $ctx.trace {
Currently I've added a very simple `update_span` function, which updates the span of the outer-most expression of a `NtExpr`, but this `update_span` function should be updated to handle all Nonterminals. But I'm pretty new to the macro system and would like to check if this approach makes sense, before doing that.
2016-01-27 12:12:52 +00:00
Florian Hahn
e533ed91be
Avoid storing interolated token in Parser.last_token
2016-01-27 11:28:33 +01:00
Florian Hahn
47bfd8c93c
Turn interpolated_or_expr_span into a function
2016-01-27 10:47:33 +01:00
Manish Goregaokar
b6faae11f4
Rollup merge of #31211 - Manishearth:pr-30765, r=nrc
...
r? @eddyb or @nrc
2016-01-26 18:55:39 +05:30
Florian Hahn
9d8c64b996
Push try! to call site of interpolated_or_expr_span!
2016-01-26 12:49:22 +01:00
Florian Hahn
2bc8f4ff80
Add interpolated_or_expr_span macro and pass lo to newly added parse_dot_suffix
2016-01-26 11:51:24 +01:00
Florian Hahn
1bde18d60c
Use interpolated token span when building spans for bigger expressions
2016-01-26 10:32:58 +01:00
Florian Hahn
20edb366e7
Set span for interpolated tokens correctly
2016-01-26 10:32:58 +01:00
Manish Goregaokar
065e47eb3b
Improve error message for let-in-expr-position
2016-01-26 13:55:46 +05:30
Daan Sprenkels
1745153eae
do not additionally note about unexpected identifier after unexpected let
...
error, by moving unexpected let check into the proper if-else clause
2016-01-25 20:56:13 +05:30
Daan Sprenkels
2b1e273293
Update qquote.rs test case and make unexpected let
error fatal
2016-01-25 20:56:12 +05:30
Daan Sprenkels
79f2cff44e
libsyntax: move check for keyword Let to a more logical spot
2016-01-25 20:56:10 +05:30
Daan Sprenkels
082c03b078
libsyntax: note that let a = (let b = something)
is invalid
...
in parse_bottom_expr (parser.rs)
2016-01-25 20:52:53 +05:30
Nick Cameron
0ac8915875
The war on abort_if_errors
2016-01-22 08:19:27 +13:00
Nick Cameron
b1b6b33c6d
Some basic error correction in the parser after a dot
2016-01-22 08:19:27 +13:00
Florian Hahn
e61d21fe3d
Cancel parse_ty error in Parser::parse_generic_values_after_lt
2016-01-10 22:59:23 +01:00