Commit Graph

505 Commits

Author SHA1 Message Date
Esteban Küber
34f03c01f6 Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
Esteban Küber
6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber
b2e6aef073 review comments: tweak prefix strings 2019-11-18 11:02:44 -08:00
Esteban Küber
83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Alex Macleod
cfe94b421b Add test for issue 63116 2019-11-16 22:32:59 +00:00
Mazdak Farrokhzad
e3c78d549e Rollup merge of #66407 - JohnTitor:add-ice-tests, r=Centril
Add more tests for fixed ICEs

Closes #36122 (fixed in 1.20.0)
Closes #58094 (fixed in #66054)
Also, fix mistaken test case, from #30904 to #30906 (cc @eddyb)

r? @Centril
2019-11-15 18:01:59 +01:00
Yuki Okushi
09f0ee51c9 Apply suggestion from Centril
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-15 23:54:52 +09:00
Yuki Okushi
74329bf619 Add test for issue-58094 2019-11-15 23:54:52 +09:00
Guanqun Lu
ed9c5da4db add a unit test for #62524 2019-11-15 08:34:34 +08:00
Yuki Okushi
8d059974f7 Rollup merge of #66361 - Centril:66357, r=pnkfelix
parser: don't use `unreachable!()` in `fn unexpected`.

Fixes #66357

r? @estebank
2019-11-14 14:16:23 +09:00
Yuki Okushi
20c356263d Rollup merge of #66351 - JohnTitor:tweak-range-err-msg, r=Centril
Tweak non-char/numeric in range pattern diagnostic

Fixes #66283

r? @estebank
2019-11-14 14:16:20 +09:00
Mazdak Farrokhzad
dcd91d5ceb parser: don't use unreachable!() in fn unexpected. 2019-11-13 12:05:37 +01:00
Yuki Okushi
302cf6db74 Tweak non-char/numeric in range pattern diagnostic 2019-11-13 08:27:53 +09:00
Guanqun Lu
292ba98cb7 fix an ICE in macro's diagnostic message 2019-11-11 22:21:16 +08:00
Mazdak Farrokhzad
9a88364525 syntactically allow visibility on trait item & enum variant 2019-11-11 06:33:09 +01:00
Mazdak Farrokhzad
5a6fd110b8 Rollup merge of #66007 - estebank:remove-here, r=Centril
Remove "here" from "expected one of X here"
2019-11-08 16:50:35 +01:00
Mazdak Farrokhzad
e19cb40fda Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkov
A scheme for more macro-matcher friendly pre-expansion gating

Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated:

```rust
macro_rules! m {
    ($e:expr) => { 0 }; // This fails on the input below due to `, foo`.
    (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`.
}

fn main() {
    assert_eq!(1, m!(box 42, foo));
}
```

Closes https://github.com/rust-lang/rust/issues/65846.

r? @petrochenkov
cc @Mark-Simulacrum
2019-11-07 08:51:57 +01:00
Mazdak Farrokhzad
bffc3d8073 test that extern lits accept raw strings annd escapes 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
b189dfe507 test that parser is oblivious to set of ABIs 2019-11-07 05:25:31 +01:00
Mazdak Farrokhzad
1db4d607e7 parser: allow ABIs from literal macro fragments 2019-11-07 05:25:31 +01:00
Esteban Küber
52e8ec1432 Remove "here" from "expected one of X here" 2019-11-06 17:26:20 -08:00
Mazdak Farrokhzad
bceaba86b9 rollback gating for failing macro matchers 2019-11-06 12:30:08 +01:00
Mazdak Farrokhzad
e5da1a12e7 Rollup merge of #66054 - petrochenkov:delspan, r=estebank
syntax: Avoid span arithmetic for delimiter tokens

The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it.
Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly.
If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries.

Fixes https://github.com/rust-lang/rust/issues/62524
r? @estebank
2019-11-06 03:28:09 +01:00
bors
f49f388713 Auto merge of #65838 - estebank:resilient-recovery, r=Centril
Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.
2019-11-04 02:30:45 +00:00
Vadim Petrochenkov
90f891d8ae syntax: Avoid span arithmetics for delimiter tokens 2019-11-03 14:58:12 +03:00
bors
f39205b5d9 Auto merge of #66004 - eddyb:revert-early-gate, r=petrochenkov
Partially revert the early feature-gatings added in #65742.

The intent here is to address #65860 ASAP (in time for beta, ideally), while leaving as much of #65742 around as possible, to make it easier to re-enable later.

Therefore, I've only kept the parts of the revert that re-add the old (i.e. non-early) feature-gating checks that were removed in #65742, and the test reverts.

I've disabled the new early feature-gating checks from #65742 entirely for now, but it would be easy to put them behind a `-Z` flag, or turn them into warnings, which would allow us to keep tests for both the early and late versions of the checks - assuming that's desirable.

cc @nikomatsakis @Mark-Simulacrum @Centril
2019-11-02 10:48:59 +00:00
Eduard-Mihai Burtescu
4c48355c69 Revert "pre-expansion gate exclusive_range_pattern"
This reverts commit 665a876e30.
2019-10-31 19:08:11 +02:00
Guillaume Gomez
fcbf77ef16 Update ui tests 2019-10-31 10:39:46 +01:00
Esteban Küber
454e2aa8c9 Do not complain about missing fn main() in some cases 2019-10-30 12:05:26 -07:00
Esteban Küber
053a09529a Reduce ammount of errors given unclosed delimiter
When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it more granularly in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.
2019-10-30 12:05:17 -07:00
Mazdak Farrokhzad
46063ed23f Rollup merge of #65809 - roblabla:eficall-abi, r=nagisa
Add new EFIAPI ABI

Fixes #54527

Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI.

Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?
2019-10-29 04:08:23 +01:00
Mazdak Farrokhzad
2fe6f22dea Rollup merge of #65640 - estebank:recover-missing-semi, r=Centril
Use heuristics to recover parsing of missing `;`

- Detect `,` and `:` typos where `;` was intended.
- When the next token could have been the start of a new statement,
  detect a missing semicolon.

Fix #48160, fix #44767 (after adding note about statements).
2019-10-28 21:35:58 +01:00
Esteban Küber
e8016c2b13 review comments 2019-10-28 10:53:13 -07:00
Esteban Küber
1b0836df6f Tweak unexpected token wording 2019-10-28 10:53:13 -07:00
Esteban Küber
d673d0ac84 Use heuristics to recover parsing of missing ;
- Detect `,` and `:` typos where `;` was intended.
- When the next token could have been the start of a new statement,
  detect a missing semicolon.
2019-10-28 10:53:13 -07:00
Esteban Küber
b26ddb8af3 Point at local similarly named element and tweak references to variants
Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27 11:50:43 -07:00
Mazdak Farrokhzad
0aa7c6f96b Rollup merge of #65773 - estebank:sugg-whitespace, r=Centril
Increase spacing for suggestions in diagnostics

Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.

r? @Centril
2019-10-26 14:17:45 +02:00
roblabla
093ec70b1e Add new EFIAPI ABI
Adds a new ABI for the EFIAPI calls. This ABI should reflect the latest
version of the UEFI specification at the time of commit (UEFI spec 2.8,
URL below). The specification says that for x86_64, we should follow the
win64 ABI, while on all other supported platforms (ia32, itanium, arm,
arm64 and risc-v), we should follow the C ABI.

To simplify the implementation, we will simply follow the C ABI on all
platforms except x86_64, even those technically unsupported by the UEFI
specification.

https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
2019-10-25 13:01:25 +00:00
Esteban Küber
0baf61bfdb Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
Mazdak Farrokhzad
665a876e30 pre-expansion gate exclusive_range_pattern 2019-10-24 00:32:03 +02:00
Tyler Mandry
e27e39b7b2 Rollup merge of #65493 - GuillaumeGomez:long-err-explanation-E0584, r=kinnison
Add long error explanation for E0584

Part of #61137.

r? @kinnison
2019-10-18 13:48:24 -07:00
Tyler Mandry
8f8a23f642 Rollup merge of #65364 - XiangQingW:master, r=estebank
Collect occurrences of empty blocks for mismatched braces diagnostic

Fix #63904
2019-10-18 13:48:16 -07:00
Guillaume Gomez
f647c06120 Update ui tests 2019-10-17 14:19:27 +02:00
wangxiangqing
fe819a074c Collect occurrences of for mismatched braces diagnostic
Change-Id: I20ba0b62308370ee961141fa1aefc4b9c9f0cb3a
2019-10-15 23:59:22 +08:00
Mazdak Farrokhzad
16266a5405 pprust: p1@p2 -> p1 @ p2 2019-10-14 18:12:04 +02:00
Mazdak Farrokhzad
3a9f8deb1d recover_intersection_pat: adjust wording 2019-10-14 18:02:49 +02:00
Mazdak Farrokhzad
a77a8aaa2e syntax: add test for intersection pattern parser recovery 2019-10-14 17:08:13 +02:00
wangxiangqing
e6ce3ef80a Collect occurrences of for mismatched braces diagnostic
Change-Id: I20ba0b62308370ee961141fa1aefc4b9c9f0cb3a
2019-10-13 13:07:32 +08:00
Mazdak Farrokhzad
a7ba754b6c syntax: unify and simplify fn signature parsing. 2019-10-07 06:01:38 +02:00