add tests for new behavior
This commit is contained in:
parent
e4ce655cbf
commit
fc97ce6dae
9
src/test/ui/match/issue-82392.rs
Normal file
9
src/test/ui/match/issue-82392.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// https://github.com/rust-lang/rust/issues/82329
|
||||
// compile-flags: -Zunpretty=hir,typed
|
||||
// check-pass
|
||||
|
||||
pub fn main() {
|
||||
if true {
|
||||
} else if let Some(a) = Some(3) {
|
||||
}
|
||||
}
|
20
src/test/ui/match/issue-82392.stdout
Normal file
20
src/test/ui/match/issue-82392.stdout
Normal file
@ -0,0 +1,20 @@
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
// https://github.com/rust-lang/rust/issues/82329
|
||||
// compile-flags: -Zunpretty=hir,typed
|
||||
// check-pass
|
||||
|
||||
pub fn main() ({
|
||||
(if (true as bool)
|
||||
({ } as
|
||||
()) else {match ((Some as
|
||||
fn(i32) -> Option<i32> {Option::<i32>::Some})((3
|
||||
as
|
||||
i32))
|
||||
as Option<i32>) {
|
||||
Some(a) => { }
|
||||
_ => { }
|
||||
}} as ())
|
||||
} as ())
|
18
src/test/ui/match/issue-84434.rs
Normal file
18
src/test/ui/match/issue-84434.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// https://github.com/rust-lang/rust/issues/84434
|
||||
// check-pass
|
||||
|
||||
use std::path::Path;
|
||||
struct A {
|
||||
pub func: fn(check: bool, a: &Path, b: Option<&Path>),
|
||||
}
|
||||
const MY_A: A = A {
|
||||
func: |check, a, b| {
|
||||
if check {
|
||||
let _ = ();
|
||||
} else if let Some(parent) = b.and_then(|p| p.parent()) {
|
||||
let _ = ();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user