summary refs log tree commit diff
path: root/src/test/ui/macros
AgeCommit message (Collapse)AuthorLines
2019-09-13pprust: Do not print spaces before some tokensVadim Petrochenkov-1/+1
2019-09-02expand: Keep the correct current expansion ID for eager expansionsVadim Petrochenkov-0/+3
Solve the problem of `ParentScope` entries for eager expansions not exising in the resolver map by creating them on demand.
2019-08-10diagnostics: Describe crate root modules in `DefKind::Mod` as "crate"Vadim Petrochenkov-1/+1
2019-08-10Give built-in macros stable addresses in the standard libraryVadim Petrochenkov-0/+157
2019-08-09Rollup merge of #62672 - lzutao:deprecated-try-macro, r=CentrilMazdak Farrokhzad-0/+2
Deprecate `try!` macro Replaces #62077 Fixes rust-lang/rust-clippy#1361 Fixes #61000
2019-08-09Allow deprecated try macro in test cratesLzu Tao-3/+2
2019-08-09Deprecate `try!` macroBO41-0/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com> Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
2019-08-05Don't recommend `extern crate` syntaxKornel-2/+2
2019-08-03Rollup merge of #62954 - ia0:fix_typo_span, r=CentrilMazdak Farrokhzad-22/+22
Fix typo in Delimited::open_tt
2019-08-01Add check-pass test for #63102.Robert Bartlensky-0/+8
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-4/+2
rustbuild Remove some random unnecessary lint `allow`s
2019-07-27tests: Move run-pass tests with naming conflicts to uiVadim Petrochenkov-0/+765
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-0/+2079
2019-07-27Fix typo in Delimited::open_ttJulien Cretin-22/+22
2019-07-26Auto merge of #62086 - petrochenkov:builtout, r=eddybbors-0/+28
Define built-in macros through libcore This PR defines built-in macros through libcore using a scheme similar to lang items (attribute `#[rustc_builtin_macro]`). All the macro properties (stability, visibility, etc.) are taken from the source code in libcore, with exception of the expander function transforming input tokens/AST into output tokens/AST, which is still provided by the compiler. The macros are made available to user code through the standard library prelude (`{core,std}::prelude::v1`), so they are still always in scope. As a result **built-in macros now have stable absolute addresses in the library**, like `core::prelude::v1::line!()`, this is an insta-stable change. Right now `prelude::v1` is the only publicly available absolute address for these macros, but eventually they can be moved into more appropriate locations with library team approval (e.g. `Clone` derive -> `core::clone::Clone`). Now when built-in macros have canonical definitions they can be imported or reexported without issues (https://github.com/rust-lang/rust/issues/61687). Other changes: - You can now define a derive macro with a name matching one of the built-in derives (https://github.com/rust-lang/rust/issues/52269). This was an artificial restriction that could be worked around with import renaming anyway. Known regressions: - Empty library crate with a crate-level `#![test]` attribute no longer compiles without `--test`. Previously it didn't compile *with* `--test` or with the bin crate type. Fixes https://github.com/rust-lang/rust/issues/61687 Fixes https://github.com/rust-lang/rust/issues/61804 r? @eddyb
2019-07-26Introduce built-in macros through libcoreVadim Petrochenkov-0/+28
2019-07-25Implement slow-path for FirstSets::firstJulien Cretin-0/+93
When 2 or more sequences share the same span, we can't use the precomputed map for their first set. So we compute it recursively. Fixes #62831.
2019-07-23Rollup merge of #62791 - estebank:type-ascription, r=petrochenkovMark Rousskov-1/+1
Handle more cases of typos misinterpreted as type ascription Fix #60933, #54516. CC #47666, #34255, #48016.
2019-07-20Auto merge of #62710 - estebank:bad-named-args, r=petrochenkovbors-14/+22
Specific error for positional args after named args in `format!()` When writing positional arguments after named arguments in the `format!()` and `println!()` macros, provide a targeted diagnostic. Follow up to https://github.com/rust-lang/rust/pull/57522/files#r247278885
2019-07-19Implement checks for meta-variables in macrosJulien Cretin-0/+220
2019-07-19Handle more cases of typos misinterpreted as type ascriptionEsteban Küber-1/+1
2019-07-19Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwcobors-11/+7
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-18resolve: Visit all scopes to collect suggestion candidates for unresolved macrosVadim Petrochenkov-5/+5
2019-07-18resolve: Use `feature(custom_attribute)` fallback only if the feature is enabledVadim Petrochenkov-8/+4
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-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-3/+3
https://github.com/rust-lang/rust/issues/60532
2019-07-15Specific error for positional args after named args in `format!()`Esteban Küber-14/+22
When writing positional arguments after named arguments in the `format!()` and `println!()` macros, provide a targeted diagnostic.
2019-07-15pprust: Fix formatting regressions from the previous commitsVadim Petrochenkov-1/+1
Fix some remaining cases of bad formatting Update some failing tests
2019-07-15pprust: Use `print_mac_common` for delimited token groupsVadim Petrochenkov-6/+6
2019-07-11pretty-print: Do not lose the `$crate` printing flag in `print_tt`Vadim Petrochenkov-0/+18
2019-07-11Add a regression test for #44692Vadim Petrochenkov-0/+31
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-11expand: Merge `expand_{bang,attr,derive}_invoc` into a single functionVadim Petrochenkov-1/+1
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-11expand: It's always possible to create a dummy AST fragmentVadim Petrochenkov-2/+0
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-11resolve: Divide macro path resolution into speculative and error reporting partsVadim Petrochenkov-7/+7
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-11resolve/expand: Catch macro kind mismatches early in resolveVadim Petrochenkov-3/+3
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-11resolve/expand: `resolve_macro_invocation` no longer returns determinate errorsVadim Petrochenkov-2/+2
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-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-7/+7
https://github.com/rust-lang/rust/issues/60532
2019-07-07Address review comments + Fix rebaseVadim Petrochenkov-1/+1
2019-07-07Support deprecation checking for macrosVadim Petrochenkov-3/+81
2019-07-07resolve: Use standard stability diagnostics for macrosVadim Petrochenkov-4/+4
2019-07-07resolve: Check stability for local macros as wellVadim Petrochenkov-2/+10
2019-07-06`#[rustc_transparent_macro]` -> `#[rustc_macro_transparency = ...]`Vadim Petrochenkov-12/+12
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-8/+8
2019-06-10syntax: Remove `SyntaxExtension::DeclMacro`Vadim Petrochenkov-0/+3
It's a less powerful duplicate of `SyntaxExtension::NormalTT`
2019-06-09Fix typo in comment.Mazdak Farrokhzad-1/+1
2019-06-09Fix inaccurate comments in '?' Kleene operator tests.Mazdak Farrokhzad-25/+27
2019-06-09Update tests since ? macro op is supported on 2015.Mazdak Farrokhzad-83/+148
2019-06-09Rollup merge of #61669 - petrochenkov:tokderef2, r=oli-obkMazdak Farrokhzad-2/+2
syntax: Remove `Deref` impl from `Token` Follow up to https://github.com/rust-lang/rust/pull/61541 r? @oli-obk
2019-06-08Introduce `#[rustc_dummy]` attribute and use it in testsVadim Petrochenkov-4/+4
Unlike other built-in attributes, this attribute accepts any input
2019-06-08syntax: Keep full `Token`s for `macro_rules` separatorsVadim Petrochenkov-2/+2
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-6/+6
- 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