//@ known-bug: #110395 // FIXME(effects) check-pass //@ compile-flags: -Znext-solver #![crate_type = "lib"] #![allow(internal_features, incomplete_features)] #![no_std] #![no_core] #![feature( auto_traits, const_trait_impl, effects, lang_items, no_core, staged_api, unboxed_closures, rustc_attrs, marker_trait_attr, )] #![stable(feature = "minicore", since = "1.0.0")] fn test() { fn is_const_fn(_: F) where F: const FnOnce<()>, { } const fn foo() {} is_const_fn(foo); } /// ---------------------------------------------------------------------- /// /// Const fn trait definitions #[const_trait] #[lang = "fn"] #[rustc_paren_sugar] trait Fn: ~const FnMut { extern "rust-call" fn call(&self, args: Args) -> Self::Output; } #[const_trait] #[lang = "fn_mut"] #[rustc_paren_sugar] trait FnMut: ~const FnOnce { extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; } #[const_trait] #[lang = "fn_once"] #[rustc_paren_sugar] trait FnOnce { #[lang = "fn_once_output"] type Output; extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } /// ---------------------------------------------------------------------- /// /// All this other stuff needed for core. Unrelated to test. #[lang = "destruct"] #[const_trait] trait Destruct {} #[lang = "freeze"] unsafe auto trait Freeze {} #[lang = "drop"] #[const_trait] trait Drop { fn drop(&mut self); } #[lang = "sized"] trait Sized {} #[lang = "copy"] trait Copy {} #[lang = "tuple_trait"] trait Tuple {} #[lang = "receiver"] trait Receiver {} impl Receiver for &T {} impl Receiver for &mut T {} #[stable(feature = "minicore", since = "1.0.0")] pub mod effects { use super::Sized; #[lang = "EffectsNoRuntime"] #[stable(feature = "minicore", since = "1.0.0")] pub struct NoRuntime; #[lang = "EffectsMaybe"] #[stable(feature = "minicore", since = "1.0.0")] pub struct Maybe; #[lang = "EffectsRuntime"] #[stable(feature = "minicore", since = "1.0.0")] pub struct Runtime; #[lang = "EffectsCompat"] #[stable(feature = "minicore", since = "1.0.0")] pub trait Compat<#[rustc_runtime] const RUNTIME: bool> {} #[stable(feature = "minicore", since = "1.0.0")] impl Compat for NoRuntime {} #[stable(feature = "minicore", since = "1.0.0")] impl Compat for Runtime {} #[stable(feature = "minicore", since = "1.0.0")] impl<#[rustc_runtime] const RUNTIME: bool> Compat for Maybe {} #[lang = "EffectsTyCompat"] #[marker] #[stable(feature = "minicore", since = "1.0.0")] pub trait TyCompat {} #[stable(feature = "minicore", since = "1.0.0")] impl TyCompat for T {} #[stable(feature = "minicore", since = "1.0.0")] impl TyCompat for Maybe {} #[stable(feature = "minicore", since = "1.0.0")] impl TyCompat for T {} #[lang = "EffectsIntersection"] #[stable(feature = "minicore", since = "1.0.0")] pub trait Intersection { #[lang = "EffectsIntersectionOutput"] #[stable(feature = "minicore", since = "1.0.0")] type Output: ?Sized; } }