-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PatKind::Err
to AST/HIR
#119967
Add PatKind::Err
to AST/HIR
#119967
Conversation
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes might have occurred in exhaustiveness checking cc @Nadrieril Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Btw, if you'd like to have another small side project, you can equip |
We use rust/compiler/rustc_ast/src/ast.rs Lines 1294 to 1305 in 2730354
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with the comment removed
@@ -51,7 +51,8 @@ fn unary_pattern(pat: &Pat<'_>) -> bool { | |||
| PatKind::Binding(..) | |||
| PatKind::Wild | |||
| PatKind::Never | |||
| PatKind::Or(_) => false, | |||
| PatKind::Or(_) | |||
| PatKind::Err(_) => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but I find this weird... Wild
can match only a single thing if it's for a type like ()
, similarly 1..=1
, similarly []
....
@bors delegate+ |
✌️ @ShE3py, you can now approve this pull request! If @WaffleLapkin told you to " |
Might be worth mentioning that the impls of rust/compiler/rustc_ast/src/mut_visit.rs Lines 1635 to 1667 in aa5f781
|
Ty!
I looked a bit and at first glance it may be possible to add something like ast::ExprKind::Err(guar) => hir::ExprKind::Err(*guar),
ast::ExprKind::Dummy => hir::ExprKind::Err(self.dcx().span_delayed_bug(e.span, "lowered ExprKind::Dummy")), I might give it a try next week. |
@ShE3py: Yeah, general approach of splitting it and adding a dummy variant for " |
|
Add `PatKind::Err` to AST/HIR rust-lang#116715 added `thir::PatKind::Error`; this PR adds `hir::PatKind::Err` and `ast::PatKind::Err` (see rust-lang#118625 (comment).) --- `@rustbot` label +A-patterns r? WaffleLapkin
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#119172 (Detect `NulInCStr` error earlier.) - rust-lang#119833 (Make tcx optional from StableMIR run macro and extend it to accept closures) - rust-lang#119967 (Add `PatKind::Err` to AST/HIR) - rust-lang#119978 (Move async closure parameters into the resultant closure's future eagerly) - rust-lang#120021 (don't store const var origins for known vars) - rust-lang#120038 (Don't create a separate "basename" when naming and opening a MIR dump file) - rust-lang#120057 (Don't ICE when deducing future output if other errors already occurred) - rust-lang#120073 (Remove spastorino from users_on_vacation) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#119172 (Detect `NulInCStr` error earlier.) - rust-lang#119833 (Make tcx optional from StableMIR run macro and extend it to accept closures) - rust-lang#119967 (Add `PatKind::Err` to AST/HIR) - rust-lang#119978 (Move async closure parameters into the resultant closure's future eagerly) - rust-lang#120021 (don't store const var origins for known vars) - rust-lang#120038 (Don't create a separate "basename" when naming and opening a MIR dump file) - rust-lang#120057 (Don't ICE when deducing future output if other errors already occurred) - rust-lang#120073 (Remove spastorino from users_on_vacation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119967 - ShE3py:patkind-err, r=WaffleLapkin Add `PatKind::Err` to AST/HIR rust-lang#116715 added `thir::PatKind::Error`; this PR adds `hir::PatKind::Err` and `ast::PatKind::Err` (see rust-lang#118625 (comment).) --- ``@rustbot`` label +A-patterns r? WaffleLapkin
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See rust-lang#119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See rust-lang#119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See rust-lang#119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See rust-lang#119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
Add `ErrorGuaranteed` to `ast::ExprKind::Err` See rust-lang#119967 for context ``` \ \ _~^~^~_ \) / o o \ (/ '_ - _' / '-----' \ ``` r? fmease
#116715 added
thir::PatKind::Error
; this PR addshir::PatKind::Err
andast::PatKind::Err
(see #118625 (comment).)@rustbot label +A-patterns
r? WaffleLapkin