Following consensus on: #2580 (review)

This PR phases out the precompiled per final consensus made in #2580
i#
Fix a cfg
This commit is contained in:
pinkforest
2023-08-21 13:18:02 +10:00
parent 151b45ae36
commit 360606b9a6
33 changed files with 3 additions and 1607 deletions
-7
View File
@@ -6,8 +6,6 @@ use proc_macro2::{Literal, Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use std::collections::BTreeSet;
use std::ptr;
#[cfg(precompiled)]
use std::sync::atomic::Ordering;
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::{parse_quote, Ident, Index, Member};
@@ -301,11 +299,6 @@ fn deserialize_body(cont: &Container, params: &Parameters) -> Fragment {
#[cfg(feature = "deserialize_in_place")]
fn deserialize_in_place_body(cont: &Container, params: &Parameters) -> Option<Stmts> {
#[cfg(precompiled)]
if !crate::DESERIALIZE_IN_PLACE.load(Ordering::Relaxed) {
return None;
}
// Only remote derives have getters, and we do not generate
// deserialize_in_place for remote derives.
assert!(!params.has_getter);
+2 -21
View File
@@ -66,17 +66,11 @@ extern crate proc_macro2;
extern crate quote;
extern crate syn;
#[cfg(not(precompiled))]
extern crate proc_macro;
#[cfg(precompiled)]
extern crate proc_macro2 as proc_macro;
mod internals;
use proc_macro::TokenStream;
#[cfg(precompiled)]
use std::sync::atomic::AtomicBool;
#[cfg(not(precompiled))]
use syn::parse_macro_input;
use syn::DeriveInput;
@@ -91,20 +85,7 @@ mod pretend;
mod ser;
mod this;
#[cfg(precompiled)]
macro_rules! parse_macro_input {
($tokenstream:ident as $ty:ty) => {
match syn::parse2::<$ty>($tokenstream) {
Ok(data) => data,
Err(err) => return err.to_compile_error(),
}
};
}
#[cfg(precompiled)]
pub static DESERIALIZE_IN_PLACE: AtomicBool = AtomicBool::new(false);
#[cfg_attr(not(precompiled), proc_macro_derive(Serialize, attributes(serde)))]
#[proc_macro_derive(Serialize, attributes(serde))]
pub fn derive_serialize(input: TokenStream) -> TokenStream {
let mut input = parse_macro_input!(input as DeriveInput);
ser::expand_derive_serialize(&mut input)
@@ -112,7 +93,7 @@ pub fn derive_serialize(input: TokenStream) -> TokenStream {
.into()
}
#[cfg_attr(not(precompiled), proc_macro_derive(Deserialize, attributes(serde)))]
#[proc_macro_derive(Deserialize, attributes(serde))]
pub fn derive_deserialize(input: TokenStream) -> TokenStream {
let mut input = parse_macro_input!(input as DeriveInput);
de::expand_derive_deserialize(&mut input)