X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Fconstness.rs;h=7298b548f3197ab248581f3d9fa70aacffef76cb;hb=041bec87c022128556640b7091f479f3040c3c37;hp=e33d0a74ea013ab99c408b322d2239d84a705c15;hpb=fc19f0e75b57e0306a7ca9c132e27bfac0bb3e44;p=rust.git diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index e33d0a74ea0..7298b548f31 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -95,9 +95,16 @@ fn is_promotable_const_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } } + fn const_fn_is_allowed_fn_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { + tcx.is_const_fn(def_id) && + tcx.lookup_stability(def_id) + .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) + } + *providers = Providers { is_const_fn_raw, is_promotable_const_fn, + const_fn_is_allowed_fn_ptr, ..*providers }; }