-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #107478 - compiler-errors:anon-enum-tys-are-ambiguous, …
…r=estebank Revert "Teach parser to understand fake anonymous enum syntax" and related commits anonymous enum types are currently ambiguous in positions like: * `|` operator: `a as fn() -> B | C` * closure args: `|_: as fn() -> A | B` I first tried to thread around `RecoverAnonEnum` into all these positions, but the resulting complexity in the compiler is IMO not worth it, or at least worth a bit more thinking time. In the mean time, let's revert this syntax for now, so we can go back to the drawing board. Fixes #107461 cc: `@estebank` `@cjgillot` #106960 --- ### Squashed revert commits: Revert "review comment: Remove AST AnonTy" This reverts commit 020cca8. Revert "Ensure macros are not affected" This reverts commit 12d18e4. Revert "Emit fewer errors on patterns with possible type ascription" This reverts commit c847a01. Revert "Teach parser to understand fake anonymous enum syntax" This reverts commit 2d82420.
- Loading branch information
Showing
10 changed files
with
72 additions
and
265 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
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
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,26 @@ | ||
// check-pass | ||
|
||
macro_rules! test_expr { | ||
($expr:expr) => {}; | ||
} | ||
|
||
macro_rules! test_ty { | ||
($a:ty | $b:ty) => {}; | ||
} | ||
|
||
fn main() { | ||
test_expr!(a as fn() -> B | C); | ||
// Do not break the `|` operator. | ||
|
||
test_expr!(|_: fn() -> B| C | D); | ||
// Do not break `-> Ret` in closure args. | ||
|
||
test_ty!(A | B); | ||
// We can't support anon enums in arbitrary positions. | ||
|
||
test_ty!(fn() -> A | B); | ||
// Don't break fn ptrs. | ||
|
||
test_ty!(impl Fn() -> A | B); | ||
// Don't break parenthesized generics. | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.