2018-07-21 20:59:44 -07:00
|
|
|
//@ compile-flags: --edition 2018
|
|
|
|
|
2018-07-24 18:03:25 -07:00
|
|
|
#![feature(try_blocks)]
|
2017-02-28 11:05:03 -08:00
|
|
|
|
2017-03-14 16:48:01 -07:00
|
|
|
fn use_val<T: Sized>(_x: T) {}
|
|
|
|
|
2017-02-28 11:05:03 -08:00
|
|
|
pub fn main() {
|
|
|
|
let cfg_res;
|
2018-07-21 20:59:44 -07:00
|
|
|
let _: Result<(), ()> = try {
|
2017-02-28 11:05:03 -08:00
|
|
|
Err(())?;
|
|
|
|
cfg_res = 5;
|
2017-03-14 16:48:01 -07:00
|
|
|
Ok::<(), ()>(())?;
|
|
|
|
use_val(cfg_res);
|
2017-02-28 11:05:03 -08:00
|
|
|
};
|
2022-06-21 11:57:45 -07:00
|
|
|
assert_eq!(cfg_res, 5); //~ ERROR E0381
|
2017-02-28 11:05:03 -08:00
|
|
|
}
|