bors
fe499a7b34
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
...
resolve: Improve candidate search for unresolved macro suggestions
Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names.
The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around).
This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086 .
r? @davidtwco
2019-07-19 00:24:39 +00:00
Vadim Petrochenkov
329c05251a
resolve: Visit all scopes to collect suggestion candidates for unresolved macros
2019-07-18 13:42:45 +03:00
Vadim Petrochenkov
79f0d88de8
resolve: Use feature(custom_attribute) fallback only if the feature is enabled
...
Normally `#![feature(...)]` shouldn't change behavior, but custom attributes in particular are in the process of retirement, and we should not produce a message telling to enable them.
It also helps with unifying diagnostics for unresolved macros.
2019-07-18 13:42:45 +03:00
Samy Kacimi
e5e1397adb
normalize use of backticks in compiler messages for librustc/lint
...
https://github.com/rust-lang/rust/issues/60532
2019-07-17 22:49:48 +02:00
Vadim Petrochenkov
a2a1cd1864
pprust: Fix formatting regressions from the previous commits
...
Fix some remaining cases of bad formatting
Update some failing tests
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
11585b598c
pprust: Use print_mac_common for delimited token groups
2019-07-15 12:42:07 +03:00
Vadim Petrochenkov
da50d59881
pretty-print: Do not lose the $crate printing flag in print_tt
2019-07-11 12:07:35 +03:00
Vadim Petrochenkov
e86e5cb38f
Add a regression test for #44692
...
Add a test for the issue resolved by removing `resolve_macro_path`
Add a test making sure that extern prelude entries introduced from an opaque macro are not visible anywhere, even it that macro
Fix test output after rebase
2019-07-11 00:35:01 +03:00
Vadim Petrochenkov
b003dd6d9b
expand: Merge expand_{bang,attr,derive}_invoc into a single function
...
It's more convenient to have all this highly related stuff together on one screen (for future refactorings).
The `expand_invoc` function is compact enough now, after all the previous refactorings.
2019-07-11 00:12:57 +03:00
Vadim Petrochenkov
374a80a86d
expand: It's always possible to create a dummy AST fragment
...
Remove a bunch of `Option`s that assumed that dummy fragment creation could fail.
The test output changed due to not performing the expansion in `fn expand_invoc` in case of the recursion limit hit.
2019-07-11 00:12:57 +03:00
Vadim Petrochenkov
f923942094
resolve: Divide macro path resolution into speculative and error reporting parts
...
Also move macro stability checking closer to other checks performed on obtained resolutions.
Tighten the stability spans as well, it is an error to *refer* to and unstable entity in any way, not only "call" it.
2019-07-11 00:12:08 +03:00
Vadim Petrochenkov
3041ec6118
resolve/expand: Catch macro kind mismatches early in resolve
...
This way we are processing all of them in a single point, rather than separately for each syntax extension kind.
Also, the standard expected/found wording is used.
2019-07-11 00:12:08 +03:00
Vadim Petrochenkov
f16993d4ac
resolve/expand: resolve_macro_invocation no longer returns determinate errors
...
It either returns the indeterminacy error, or valid (but perhaps dummy) `SyntaxExtension`.
With this change enum `Determinacy` is no longer used in libsyntax and can be moved to resolve.
The regressions in diagnosics are fixed in the next commits.
2019-07-11 00:12:08 +03:00
Samy Kacimi
41e71b0c93
normalize use of backticks in compiler messages for libsyntax/feature_gate
...
https://github.com/rust-lang/rust/issues/60532
2019-07-09 14:13:28 +02:00
Vadim Petrochenkov
941653b528
Address review comments + Fix rebase
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
0817fc6c6c
Support deprecation checking for macros
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
d9ee97e896
resolve: Use standard stability diagnostics for macros
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
73dec4a804
resolve: Check stability for local macros as well
2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
22d6d8ac76
#[rustc_transparent_macro] -> #[rustc_macro_transparency = ...]
2019-07-06 16:59:08 +03:00
Yuki Okushi
c004451a20
Migrate compile-pass annotations to build-pass
2019-07-03 06:30:28 +09:00
Vadim Petrochenkov
8edbbacbca
syntax: Remove SyntaxExtension::DeclMacro
...
It's a less powerful duplicate of `SyntaxExtension::NormalTT`
2019-06-10 21:33:31 +03:00
Mazdak Farrokhzad
73c6563ce0
Fix typo in comment.
2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad
a4b9a03362
Fix inaccurate comments in '?' Kleene operator tests.
2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad
1e793c71b5
Update tests since ? macro op is supported on 2015.
2019-06-09 04:16:34 +02:00
Mazdak Farrokhzad
6b71fba9c1
Rollup merge of #61669 - petrochenkov:tokderef2, r=oli-obk
...
syntax: Remove `Deref` impl from `Token`
Follow up to https://github.com/rust-lang/rust/pull/61541
r? @oli-obk
2019-06-09 00:20:38 +02:00
Vadim Petrochenkov
ea4ad555d7
Introduce #[rustc_dummy] attribute and use it in tests
...
Unlike other built-in attributes, this attribute accepts any input
2019-06-08 23:55:25 +03:00
Vadim Petrochenkov
ffe23475cb
syntax: Keep full Tokens for macro_rules separators
2019-06-08 20:36:20 +03:00
Esteban Küber
24160171e4
Tweak macro parse errors when reaching EOF during macro call parse
...
- 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-24 11:49:33 -07:00
Mark Mansi
5a9de557b3
add ui tests
2019-05-22 12:20:43 -05:00
Vadim Petrochenkov
3f064cae3d
Move literal parsing code into a separate file
...
Remove some dead code
2019-05-11 16:03:16 +03:00
bors
96d565be01
Auto merge of #60039 - rasendubi:assert-trailing-junk, r=alexcrichton
...
Make assert! ensure the macro is parsed completely
Fixes https://github.com/rust-lang/rust/issues/60024
2019-04-29 14:50:17 +00:00
Esteban Küber
0e505d427a
Add guard for missing comma in macro call suggestion
2019-04-24 16:45:29 -07:00
Alexey Shmalko
f29e9a5cb8
Handle common assert! misuses
2019-04-25 02:06:38 +03:00
varkor
7f0f0e31ec
Remove double trailing newlines
2019-04-22 16:57:01 +01:00
Matthew Jasper
8eef102270
update tests for migrate mode by default
2019-04-22 08:40:08 +01:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info
2019-04-18 13:29:28 -04:00
Alexey Shmalko
dfc0861085
Make assert! ensure the macro is parsed completely
2019-04-17 15:30:15 +03:00
Mazdak Farrokhzad
abfca1e155
Rollup merge of #59858 - mark-i-m:dup-matcher-bindings-3, r=Centril
...
Make duplicate matcher bindings a hard error
r? @Centril
Closes #57742
2019-04-14 00:23:44 +02:00
Mazdak Farrokhzad
ca9f04e41e
Rollup merge of #59862 - estebank:tweak-unstable-diag, r=petrochenkov
...
Tweak unstable diagnostic output
2019-04-12 20:36:15 +02:00
Mark Mansi
e149dc02a4
remove warn
2019-04-11 15:09:43 -05:00
Esteban Küber
146d040f0b
Reword tracking issue note
2019-04-11 11:42:06 -07:00
Mark Mansi
d7f5c50a33
make duplicate matcher bindings a hard error
2019-04-10 21:29:17 -05:00
Esteban Küber
3ab97062cf
Tweak unstable diagnostic output
2019-04-10 18:10:30 -07:00
Andy Russell
bbdeafc13c
clarify what the item is in "not a module" error
2019-04-10 12:55:21 -04:00
Mazdak Farrokhzad
fb8396da84
Rollup merge of #59574 - JohnTitor:distinguish-error-vs-warning, r=Centril
...
Distinguish message for external macros depending on error level
fixes #57716
(I picked you because assigned to this issue.)
r? @estebank
2019-03-31 16:10:38 +02:00
Yuki OKUSHI
45c82abf13
Distinguish depending on error level
...
Remove unnecessary comment
2019-03-31 07:51:31 +09:00
Mazdak Farrokhzad
f9262afa4d
Rollup merge of #59394 - mark-i-m:dup-matcher-bindings-2, r=Centril
...
warn -> deny duplicate match bindings
This is the next step of https://github.com/rust-lang/rust/issues/57742
r? @Centril
- [x] Decide whether to go to deny-by-default or hard error.
- My preference is to make this deny-by-default, rather than going straight to a hard error. The CI should fail because I haven't updated the ui test yet. I'll update it when we decide which to do.
- [x] Update [test](c25d6b8344/src/test/ui/macros/macro-multiple-matcher-bindings.rs )
- [ ] ~Crater run~ see https://github.com/rust-lang/rust/pull/59394#issuecomment-477817351
2019-03-29 02:40:48 +01:00
mark
9f14e146ed
deny duplicate matcher bindings by default
2019-03-28 14:27:16 -05:00
Andy Russell
695dfe7dff
compiletest: make path normalization smarter
2019-03-25 01:06:45 -04:00
Mazdak Farrokhzad
8ebe2acb7b
Rollup merge of #59116 - estebank:comma-sugg, r=petrochenkov
...
Be more discerning on when to attempt suggesting a comma in a macro invocation
Fix #58796 .
2019-03-19 15:16:55 +01:00