forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#107813 - compiler-errors:bad-impl-trait-in-…
…macro-is-ok, r=estebank Do not eagerly recover for bad `impl Trait` types in macros Fixes rust-lang#107796 cc rust-lang#106712, ```@estebank``` and ```@Ezrashaw``` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries. This also fixes a separate regression from rust-lang#99915, that was introduced before we added `may_recover` though.
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// check-pass | ||
|
||
// edition:2021 | ||
// for the `impl` + keyword test | ||
|
||
macro_rules! impl_primitive { | ||
($ty:ty) => { | ||
compile_error!("whoops"); | ||
}; | ||
(impl async) => {}; | ||
} | ||
|
||
impl_primitive!(impl async); | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// check-pass | ||
|
||
macro_rules! impl_primitive { | ||
($ty:ty) => { impl_primitive!(impl $ty); }; | ||
(impl $ty:ty) => { fn a(_: $ty) {} } | ||
} | ||
|
||
impl_primitive! { u8 } | ||
|
||
macro_rules! test { | ||
($ty:ty) => { compile_error!("oh no"); }; | ||
(impl &) => {}; | ||
} | ||
|
||
test!(impl &); | ||
|
||
fn main() {} |