mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 21:53:56 +00:00
56 lines
864 B
Rust
56 lines
864 B
Rust
|
// edition:2021
|
||
|
|
||
|
#![feature(inline_const)]
|
||
|
|
||
|
fn closure() {
|
||
|
loop {
|
||
|
let closure = || {
|
||
|
if true {
|
||
|
Err(1)
|
||
|
//~^ ERROR mismatched types
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn async_block() {
|
||
|
loop {
|
||
|
let fut = async {
|
||
|
if true {
|
||
|
Err(1)
|
||
|
//~^ ERROR mismatched types
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn fn_item() {
|
||
|
let _ = loop {
|
||
|
fn foo() -> Result<(), ()> {
|
||
|
if true {
|
||
|
Err(1)
|
||
|
//~^ ERROR mismatched types
|
||
|
}
|
||
|
Err(())
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
fn const_block() {
|
||
|
let _ = loop {
|
||
|
const {
|
||
|
if true {
|
||
|
Err(1)
|
||
|
//~^ ERROR mismatched types
|
||
|
}
|
||
|
Err(())
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
|
||
|
fn main() {}
|