summary refs log tree commit diff
path: root/src/test/ui/macros
AgeCommit message (Collapse)AuthorLines
2021-06-11Fix incorrect gating of nonterminals in key-value attributesAaron Hill-0/+30
Fixes #85432 When processing a `#[derive]` or `#[cfg_eval]` attribute, we need to re-parse our attribute target, which requires flattenting all `Nonterminals`. However, this caused us to incorrectly gate on a (flattented) nonterminal in a key-value attribute, which is supposed to be allowed. Since we already perform this gating during the initial parse, we suppress it in `capture_cfg` mode.
2021-05-04Remove assert_matches usersMark Rousskov-11/+0
2021-04-28Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakisbors-43/+41
Stabilize `:pat_param` and remove `:pat2021` Blocked on #83384 cc `@rust-lang/lang` #79278 If I understand `@nikomatsakis` in https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873, another FCP is not needed. r? `@nikomatsakis`
2021-04-27remove pat2021mark-27/+25
2021-04-23Revert "Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis"Santiago Pastorino-121/+0
This reverts commit e2561c58a41023a14e0e583113dcf55e1ecb236a, reversing changes made to 2982ba50fc4bb629b8fe4108a81cb2f9b053510b.
2021-04-15update testmark-4/+4
2021-04-15rename pat2015 to pat_parammark-15/+15
2021-04-15Run buffered lints attached to anon constsAaron Hill-0/+34
Fixes #84195
2021-04-15Rollup merge of #84185 - hi-rustin:rustin-patch-macro, r=nikomatsakisDylan DPC-0/+113
add more pat2021 tests close https://github.com/rust-lang/rust/issues/84138 r? ```@nikomatsakis```
2021-04-14test: add reasonable casehi-rustin-2/+2
2021-04-14test: add more caseshi-rustin-3/+69
2021-04-14add macro-or-patterns-2021 testhi-rustin-0/+47
2021-04-12Fix lookahead with None-delimited groupAaron Hill-0/+15
2021-04-10Expand derive invocations in left-to-right orderAaron Hill-20/+20
While derives were being collected in left-to-order order, the corresponding `Invocation`s were being pushed in the wrong order.
2021-04-06Rollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwcoYuki Okushi-0/+31
expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression Fixes https://github.com/rust-lang/rust/issues/80251 The reported error is the same as for `let _ = #[cfg(FALSE)] EXPR;`
2021-04-03Remove redundant `ignore-tidy-linelength` annotationsSimon Jakobi-7/+5
This is step 2 towards fixing #77548. In the codegen and codegen-units test suites, the `//` comment markers were kept in order not to affect any source locations. This is because these tests cannot be automatically `--bless`ed.
2021-04-03expand: Do not ICE when a legacy AST-based macro attribute produces and ↵Vadim Petrochenkov-0/+31
empty expression
2021-04-02address commentshi-rustin-12/+12
2021-04-01add OR_PATTERNS_BACK_COMPAT linthi-rustin-0/+84
test: add more cases test: add comments refine msg
2021-03-28Rollup merge of #83348 - osa1:issue83344, r=jackh726Yuki Okushi-0/+14
format macro argument parsing fix When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344 --- r? ```@estebank```
2021-03-27format macro argument parsing fixÖmer Sinan Ağacan-0/+14
When the character next to `{}` is "shifted" (when mapping a byte index in the format string to span) we should avoid shifting the span end index, so first map the index of `}` to span, then bump the span, instead of first mapping the next byte index to a span (which causes bumping the end span too much). Regression test added. Fixes #83344
2021-03-27Rollup merge of #83343 - osa1:issue83340, r=jackh726Yuki Okushi-0/+16
Simplify and fix byte skipping in format! string parser Fixes '\\' handling in format strings. Fixes #83340
2021-03-23Rollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplettYuki Okushi-1/+1
rename :pat2018 -> :pat2015 as requested by T-lang on zulip: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873 No functional changes here... just renaming. r? `@nikomatsakis`
2021-03-22Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakisbors-1/+0
Stabilize or_patterns (RFC 2535, 2530, 2175) closes #54883 This PR stabilizes the or_patterns feature in Rust 1.53. This is blocked on the following (in order): - [x] The crater run in https://github.com/rust-lang/rust/pull/78935#issuecomment-731564021 - [x] The resolution of the unresolved questions and a second crater run (https://github.com/rust-lang/rust/pull/78935#issuecomment-735412705) - It looks like we will need to pursue some sort of edition-based transition for `:pat`. - [x] Nomination and discussion by T-lang - [x] Implement new behavior for `:pat` based on consensus (https://github.com/rust-lang/rust/pull/80100). - [ ] An FCP on stabilization EDIT: Stabilization report is in https://github.com/rust-lang/rust/pull/79278#issuecomment-772815177
2021-03-22rename :pat2018 -> :pat215mark-1/+1
2021-03-21Simplify and fix byte skipping in format! string parserÖmer Sinan Ağacan-0/+16
Fixes '\\' handling in format strings. Fixes #83340
2021-03-20Move some tests to more reasonable directories - 5Caio-0/+18
2021-03-19update testsmark-1/+0
2021-03-13Add regression testshyd-dev-0/+29
2021-02-23Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakisDylan DPC-0/+121
Support `pub` on `macro_rules` This rebases and updates `since` version of #78166 from ``@petrochenkov`` r? ``@nikomatsakis``
2021-02-21Suggest `return`ing tail expressions that match return typeEsteban Küber-0/+5
Some newcomers are confused by the behavior of tail expressions, interpreting that "leaving out the `;` makes it the return value". To help them go in the right direction, suggest using `return` instead when applicable.
2021-02-19Support `pub` on `macro_rules`Vadim Petrochenkov-0/+121
2021-02-18Rollup merge of #82203 - c410-f3r:tests-tests-tests, r=Dylan-DPCYuki Okushi-0/+94
Move some tests to more reasonable directories - 4 cc #81941
2021-02-16Move some tests to more reasonable directoriesCaio-0/+94
2021-02-16Ensure debug_assert! tests get runTeddy Katz-0/+1
2021-02-16Document that `assert!` format arguments are evaluated lazilyTeddy Katz-0/+11
It can be useful to do some computation in `assert!` format arguments, in order to get better error messages. For example: ```rust assert!( some_condition, "The state is invalid. Details: {}", expensive_call_to_get_debugging_info(), ); ``` It seems like `assert!` only evaluates the format arguments if the assertion fails, which is useful but doesn't appear to be documented anywhere. This PR documents the behavior and adds some tests.
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-22/+22
2021-02-06path trimming: ignore type aliasesDan Aloni-1/+1
2021-02-03Allow/fix non_fmt_panic in tests.Mara Bos-0/+2
2021-02-03Add lint for `panic!(123)` which is not accepted in Rust 2021.Mara Bos-1/+1
This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021. It suggests to add `"{}", ` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized `std::panic::panic_any()` function as an alternative. It renames the lint to `non_fmt_panic` to match the lint naming guidelines.
2021-01-31Move some tests to more reasonable directoriesCaio-0/+14
2021-01-18Rollup merge of #81071 - osa1:fix_81006, r=estebankAshley Mannix-0/+24
rustc_parse_format: Fix character indices in find_skips Fixes #81006
2021-01-17rustc_parse_format: Fix character indices in find_skipsÖmer Sinan Ağacan-0/+24
Fixes #81006
2021-01-17Force vec! to expressions onlyDániel Buga-0/+20
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+77
Address comments Update limits
2021-01-13Update tests for extern block lintingMark Rousskov-4/+10
2020-12-31Auto merge of #80459 - mark-i-m:or-pat-reg, r=petrochenkovbors-0/+14
Implement edition-based macro :pat feature This PR does two things: 1. Fixes the perf regression from https://github.com/rust-lang/rust/pull/80100#issuecomment-750893149 2. Implements `:pat2018` and `:pat2021` matchers, as described by `@joshtriplett` in https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090 behind the feature gate `edition_macro_pat`. r? `@petrochenkov` cc `@Mark-Simulacrum`
2020-12-30Implement edition-based macro pat featuremark-0/+14
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-38/+71
2020-12-22Revert "Promote missing_fragment_specifier to hard error"Wesley Wiser-0/+10
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.