about summary refs log tree commit diff
path: root/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs
blob: 56155e519dca49d551990e366a7a0c87afd949d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//@ revisions: allow not_allow
//@ compile-flags: --crate-type=lib -Cinstrument-coverage  -Zno-profiler-runtime
//@[allow] check-pass

#![feature(staged_api, rustc_allow_const_fn_unstable)]
#![stable(feature = "rust_test", since = "1.0.0")]

#[stable(feature = "rust_test", since = "1.0.0")]
#[rustc_const_stable(feature = "rust_test", since = "1.0.0")]
#[cfg_attr(allow, rustc_allow_const_fn_unstable(const_precise_live_drops))]
pub const fn unwrap<T>(this: Option<T>) -> T {
//[not_allow]~^ ERROR: cannot be evaluated
    match this {
        Some(x) => x,
        None => panic!(),
    }
}