1
Fork 0

Update library functions with stability attributes

This may not be strictly minimal, but all unstable functions also need a
`rustc_const_unstable` attribute.
This commit is contained in:
Dylan MacKenzie 2020-09-17 11:02:56 -07:00
parent 3dd28c78c3
commit 110e59e70e
13 changed files with 22 additions and 0 deletions

View file

@ -401,6 +401,7 @@ fn run_client<A: for<'a, 's> DecodeMut<'a, 's, ()>, R: Encode<()>>(
}
impl Client<fn(crate::TokenStream) -> crate::TokenStream> {
#[allow_internal_unstable(const_fn)]
pub const fn expand1(f: fn(crate::TokenStream) -> crate::TokenStream) -> Self {
extern "C" fn run(
bridge: Bridge<'_>,
@ -413,6 +414,7 @@ impl Client<fn(crate::TokenStream) -> crate::TokenStream> {
}
impl Client<fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream> {
#[allow_internal_unstable(const_fn)]
pub const fn expand2(
f: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
) -> Self {
@ -457,6 +459,7 @@ impl ProcMacro {
}
}
#[allow_internal_unstable(const_fn)]
pub const fn custom_derive(
trait_name: &'static str,
attributes: &'static [&'static str],
@ -465,6 +468,7 @@ impl ProcMacro {
ProcMacro::CustomDerive { trait_name, attributes, client: Client::expand1(expand) }
}
#[allow_internal_unstable(const_fn)]
pub const fn attr(
name: &'static str,
expand: fn(crate::TokenStream, crate::TokenStream) -> crate::TokenStream,
@ -472,6 +476,7 @@ impl ProcMacro {
ProcMacro::Attr { name, client: Client::expand2(expand) }
}
#[allow_internal_unstable(const_fn)]
pub const fn bang(
name: &'static str,
expand: fn(crate::TokenStream) -> crate::TokenStream,

View file

@ -35,6 +35,7 @@ impl<'a, 'b, T: LambdaL> DerefMut for RefMutL<'a, 'b, T> {
pub struct ScopedCell<T: LambdaL>(Cell<<T as ApplyL<'static>>::Out>);
impl<T: LambdaL> ScopedCell<T> {
#[allow_internal_unstable(const_fn)]
pub const fn new(value: <T as ApplyL<'static>>::Out) -> Self {
ScopedCell(Cell::new(value))
}

View file

@ -20,6 +20,7 @@
)]
#![feature(nll)]
#![feature(staged_api)]
#![feature(const_fn)]
#![feature(allow_internal_unstable)]
#![feature(decl_macro)]
#![feature(extern_types)]