bors
ca075d268d
Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakis
...
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-28 20:35:17 +00:00
mark
2a9db919ff
remove pat2021
2021-04-27 21:15:59 -05:00
Santiago Pastorino
0e4d2fd447
Revert "Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis"
...
This reverts commit e2561c58a4 , reversing
changes made to 2982ba50fc .
2021-04-23 10:40:32 -03:00
mark
3f7b98ebe0
update test
2021-04-15 14:27:29 -05:00
mark
0566ccc72f
rename pat2015 to pat_param
2021-04-15 13:52:09 -05:00
Aaron Hill
19c9d93ab5
Run buffered lints attached to anon consts
...
Fixes #84195
2021-04-15 11:11:44 -04:00
Dylan DPC
13effcb282
Rollup merge of #84185 - hi-rustin:rustin-patch-macro, r=nikomatsakis
...
add more pat2021 tests
close https://github.com/rust-lang/rust/issues/84138
r? ```@nikomatsakis```
2021-04-15 01:27:54 +02:00
hi-rustin
eb944c1466
test: add reasonable case
2021-04-14 22:31:44 +08:00
hi-rustin
7b14eda522
test: add more cases
2021-04-14 22:16:56 +08:00
hi-rustin
0e9de930ac
add macro-or-patterns-2021 test
2021-04-14 18:51:54 +08:00
Aaron Hill
eb7b1a150f
Fix lookahead with None-delimited group
2021-04-12 11:50:16 -04:00
Aaron Hill
21e6cc19fe
Expand derive invocations in left-to-right order
...
While derives were being collected in left-to-order order, the
corresponding `Invocation`s were being pushed in the wrong order.
2021-04-10 17:29:20 -04:00
Yuki Okushi
67ffbedada
Rollup merge of #83814 - petrochenkov:emptyexpr, r=davidtwco
...
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-06 06:24:12 +09:00
Simon Jakobi
3ea62cb5d1
Remove redundant ignore-tidy-linelength annotations
...
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-03 22:30:20 +02:00
Vadim Petrochenkov
cd22425990
expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression
2021-04-03 19:42:09 +03:00
hi-rustin
aa987c2f57
address comments
2021-04-02 08:08:02 +08:00
hi-rustin
2c66e15468
add OR_PATTERNS_BACK_COMPAT lint
...
test: add more cases
test: add comments
refine msg
2021-04-01 23:14:14 +08:00
Yuki Okushi
973fb4b77f
Rollup merge of #83348 - osa1:issue83344, r=jackh726
...
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-28 01:33:13 +09:00
Ömer Sinan Ağacan
5b9bac2ab6
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
2021-03-27 13:06:36 +03:00
Yuki Okushi
d7216bae23
Rollup merge of #83343 - osa1:issue83340, r=jackh726
...
Simplify and fix byte skipping in format! string parser
Fixes '\\' handling in format strings.
Fixes #83340
2021-03-27 12:37:19 +09:00
Yuki Okushi
50d048f142
Rollup merge of #83384 - mark-i-m:rename-pat2018, r=joshtriplett
...
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-23 10:15:43 +09:00
bors
5d04957a4b
Auto merge of #79278 - mark-i-m:stabilize-or-pattern, r=nikomatsakis
...
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-22 19:48:27 +00:00
mark
8c4b3dbb50
rename :pat2018 -> :pat215
2021-03-22 12:40:23 -05:00
Ömer Sinan Ağacan
ae8ef70a49
Simplify and fix byte skipping in format! string parser
...
Fixes '\\' handling in format strings.
Fixes #83340
2021-03-21 14:42:27 +03:00
Caio
3490170893
Move some tests to more reasonable directories - 5
2021-03-20 11:41:24 -03:00
mark
b9ecba30bc
update tests
2021-03-19 19:45:42 -05:00
hyd-dev
7ecb5d8601
Add regression tests
2021-03-13 20:10:04 +08:00
Dylan DPC
e2561c58a4
Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis
...
Support `pub` on `macro_rules`
This rebases and updates `since` version of #78166 from ``@petrochenkov``
r? ``@nikomatsakis``
2021-02-23 16:10:23 +01:00
Esteban Küber
796ce9fcb7
Suggest returning tail expressions that match return type
...
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-21 16:27:29 -08:00
Vadim Petrochenkov
0fddc2f780
Support pub on macro_rules
2021-02-19 13:52:57 -03:00
Yuki Okushi
fe15494857
Rollup merge of #82203 - c410-f3r:tests-tests-tests, r=Dylan-DPC
...
Move some tests to more reasonable directories - 4
cc #81941
2021-02-18 15:57:29 +09:00
Caio
e7e93717ce
Move some tests to more reasonable directories
2021-02-16 21:22:21 -03:00
Teddy Katz
15197cbc61
Ensure debug_assert! tests get run
2021-02-16 19:05:30 -05:00
Teddy Katz
cb653b100c
Document that assert! format arguments are evaluated lazily
...
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-16 00:55:46 -05:00
Vadim Petrochenkov
dbdbd30bf2
expand/resolve: Turn #[derive] into a regular macro attribute
2021-02-07 20:08:45 +03:00
Dan Aloni
eaefe4a230
path trimming: ignore type aliases
2021-02-06 12:03:48 +02:00
Mara Bos
e9ad5be0f7
Allow/fix non_fmt_panic in tests.
2021-02-03 23:15:45 +01:00
Mara Bos
a616f8267e
Add lint for panic!(123) which is not accepted in Rust 2021.
...
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-02-03 22:42:53 +01:00
Caio
2bb4a694d1
Move some tests to more reasonable directories
2021-01-31 19:46:46 -03:00
Ashley Mannix
c7ca540da2
Rollup merge of #81071 - osa1:fix_81006, r=estebank
...
rustc_parse_format: Fix character indices in find_skips
Fixes #81006
2021-01-18 21:53:24 +10:00
Ömer Sinan Ağacan
9111e9dd01
rustc_parse_format: Fix character indices in find_skips
...
Fixes #81006
2021-01-17 17:40:58 +03:00
Dániel Buga
c127ed6e97
Force vec! to expressions only
2021-01-17 12:48:25 +01:00
Caio
ad35979c50
Move some tests to more reasonable directories - 2
...
Address comments
Update limits
2021-01-16 19:46:54 -03:00
Mark Rousskov
8a3edb1d66
Update tests for extern block linting
2021-01-13 07:49:16 -05:00
bors
44e3daf5ee
Auto merge of #80459 - mark-i-m:or-pat-reg, r=petrochenkov
...
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-31 14:52:26 +00:00
mark
40bf3c0f09
Implement edition-based macro pat feature
2020-12-30 09:57:49 -06:00
Vadim Petrochenkov
4d2d0bad4e
Remove compile-fail test suite
2020-12-29 23:39:56 +03:00
Wesley Wiser
f1eb88b28a
Revert "Promote missing_fragment_specifier to hard error"
...
This reverts commit 02eae432e7 .
2020-12-22 09:33:16 -05:00
mark
1a7d00a529
implement edition-specific :pat behavior for 2015/18
2020-12-19 07:13:36 -06:00
Vadim Petrochenkov
31d72c2658
Accept arbitrary expressions in key-value attributes at parse time
2020-12-09 21:37:32 +03:00