add tests for new behavior

This commit is contained in:
Smitty 2021-04-23 14:06:02 -04:00
parent e4ce655cbf
commit fc97ce6dae
3 changed files with 47 additions and 0 deletions

View 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) {
}
}

View 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 ())

View 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() {}