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