Move derive internals into serde_derive crate
We can continue to publish serde_derive_internals independently but serde_derive no longer has a dependency on it. This improves compile time of serde_derive by 7%.
This commit is contained in:
parent
ed425b3a6f
commit
3859f58d9b
@ -25,7 +25,6 @@ proc-macro = true
|
||||
[dependencies]
|
||||
proc-macro2 = "0.3"
|
||||
quote = "0.5.2"
|
||||
serde_derive_internals = { version = "=0.23.1", default-features = false, path = "../serde_derive_internals" }
|
||||
syn = { version = "0.13", features = ["visit"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -6,11 +6,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use attr;
|
||||
use check;
|
||||
use internals::attr;
|
||||
use internals::check;
|
||||
use internals::Ctxt;
|
||||
use syn;
|
||||
use syn::punctuated::Punctuated;
|
||||
use Ctxt;
|
||||
|
||||
pub struct Container<'a> {
|
||||
pub ident: syn::Ident,
|
@ -6,6 +6,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use internals::Ctxt;
|
||||
use proc_macro2::{Group, Span, TokenStream, TokenTree};
|
||||
use std::collections::BTreeSet;
|
||||
use std::str::FromStr;
|
||||
@ -15,7 +16,6 @@ use syn::synom::{ParseError, Synom};
|
||||
use syn::Ident;
|
||||
use syn::Meta::{List, NameValue, Word};
|
||||
use syn::NestedMeta::{Literal, Meta};
|
||||
use Ctxt;
|
||||
|
||||
// This module handles parsing of `#[serde(...)]` attributes. The entrypoints
|
||||
// are `attr::Container::from_ast`, `attr::Variant::from_ast`, and
|
||||
@ -25,7 +25,7 @@ use Ctxt;
|
||||
// user will see errors simultaneously for all bad attributes in the crate
|
||||
// rather than just the first.
|
||||
|
||||
pub use case::RenameRule;
|
||||
pub use internals::case::RenameRule;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct Attr<'c, T> {
|
||||
@ -167,6 +167,7 @@ pub enum Identifier {
|
||||
}
|
||||
|
||||
impl Identifier {
|
||||
#[cfg(feature = "deserialize_in_place")]
|
||||
pub fn is_some(self) -> bool {
|
||||
match self {
|
||||
Identifier::No => false,
|
@ -6,9 +6,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use ast::{Container, Data, Style};
|
||||
use attr::{EnumTag, Identifier};
|
||||
use Ctxt;
|
||||
use internals::ast::{Container, Data, Style};
|
||||
use internals::attr::{EnumTag, Identifier};
|
||||
use internals::Ctxt;
|
||||
|
||||
/// Cross-cutting checks that require looking at more than a single attrs
|
||||
/// object. Simpler checks should happen when parsing and building the attrs.
|
16
serde_derive/src/internals/mod.rs
Normal file
16
serde_derive/src/internals/mod.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2017 Serde Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub mod ast;
|
||||
pub mod attr;
|
||||
|
||||
mod ctxt;
|
||||
pub use self::ctxt::Ctxt;
|
||||
|
||||
mod case;
|
||||
mod check;
|
@ -35,11 +35,11 @@ extern crate quote;
|
||||
#[macro_use]
|
||||
extern crate syn;
|
||||
|
||||
extern crate serde_derive_internals as internals;
|
||||
|
||||
extern crate proc_macro;
|
||||
extern crate proc_macro2;
|
||||
|
||||
mod internals;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use syn::DeriveInput;
|
||||
|
||||
|
@ -9,7 +9,10 @@ repository = "https://github.com/serde-rs/serde"
|
||||
documentation = "https://docs.serde.rs/serde_derive_internals/"
|
||||
keywords = ["serde", "serialization"]
|
||||
readme = "README.md"
|
||||
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
|
||||
include = ["Cargo.toml", "lib.rs", "src/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "0.3"
|
||||
|
@ -17,11 +17,7 @@ extern crate syn;
|
||||
|
||||
extern crate proc_macro2;
|
||||
|
||||
pub mod ast;
|
||||
pub mod attr;
|
||||
#[path = "src/mod.rs"]
|
||||
mod internals;
|
||||
|
||||
mod ctxt;
|
||||
pub use ctxt::Ctxt;
|
||||
|
||||
mod case;
|
||||
mod check;
|
||||
pub use internals::*;
|
1
serde_derive_internals/src
Symbolic link
1
serde_derive_internals/src
Symbolic link
@ -0,0 +1 @@
|
||||
../serde_derive/src/internals/
|
Loading…
Reference in New Issue
Block a user