-
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.
Infer wildcard type from other patterns at every pattern level
- Loading branch information
Showing
4 changed files
with
72 additions
and
26 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
29 changes: 29 additions & 0 deletions
29
src/test/ui/type-alias-impl-trait/issue-96572-unconstrained-only-pattern-rpit.rs
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,29 @@ | ||
// check-pass | ||
|
||
#[allow(unconditional_recursion)] | ||
fn foo(b: bool) -> impl Copy { | ||
let (mut x, mut y) = foo(false); | ||
x = 42; | ||
y = "foo"; | ||
if b { | ||
panic!() | ||
} else { | ||
foo(true) | ||
} | ||
} | ||
|
||
fn bar(b: bool) -> Option<impl Copy> { | ||
if b { | ||
return None; | ||
} | ||
match bar(!b) { | ||
Some((mut x, mut y)) => { | ||
x = 42; | ||
y = "foo"; | ||
} | ||
None => {} | ||
} | ||
None | ||
} | ||
|
||
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