Switch to syntex::with_extra_stack
This commit is contained in:
parent
5fb73073bd
commit
0ae61a3dd1
@ -25,14 +25,14 @@ with-syntex = [
|
||||
]
|
||||
|
||||
[build-dependencies]
|
||||
quasi_codegen = { version = "^0.17.0", optional = true }
|
||||
syntex = { version = "^0.41.0", optional = true }
|
||||
quasi_codegen = { version = "^0.18.0", optional = true }
|
||||
syntex = { version = "^0.42.2", optional = true }
|
||||
|
||||
[dependencies]
|
||||
aster = { version = "^0.24.0", default-features = false }
|
||||
aster = { version = "^0.25.0", default-features = false }
|
||||
clippy = { version = "^0.*", optional = true }
|
||||
quasi = { version = "^0.17.0", default-features = false }
|
||||
quasi_macros = { version = "^0.17.0", optional = true }
|
||||
quasi = { version = "^0.18.0", default-features = false }
|
||||
quasi_macros = { version = "^0.18.0", optional = true }
|
||||
serde_codegen_internals = { version = "=0.6.1", default-features = false, path = "../serde_codegen_internals" }
|
||||
syntex = { version = "^0.41.0", optional = true }
|
||||
syntex_syntax = { version = "^0.41.0", optional = true }
|
||||
syntex = { version = "^0.42.2", optional = true }
|
||||
syntex_syntax = { version = "^0.42.0", optional = true }
|
||||
|
@ -1,36 +0,0 @@
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::ops::Drop;
|
||||
|
||||
pub fn set_if_unset<K, V>(k: K, v: V) -> TmpEnv<K>
|
||||
where K: AsRef<OsStr>,
|
||||
V: AsRef<OsStr>,
|
||||
{
|
||||
match env::var(&k) {
|
||||
Ok(_) => TmpEnv::WasAlreadySet,
|
||||
Err(_) => {
|
||||
env::set_var(&k, v);
|
||||
TmpEnv::WasNotSet { k: k }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub enum TmpEnv<K>
|
||||
where K: AsRef<OsStr>,
|
||||
{
|
||||
WasAlreadySet,
|
||||
WasNotSet {
|
||||
k: K,
|
||||
}
|
||||
}
|
||||
|
||||
impl<K> Drop for TmpEnv<K>
|
||||
where K: AsRef<OsStr>,
|
||||
{
|
||||
fn drop(&mut self) {
|
||||
if let TmpEnv::WasNotSet { ref k } = *self {
|
||||
env::remove_var(k);
|
||||
}
|
||||
}
|
||||
}
|
@ -35,9 +35,6 @@ include!(concat!(env!("OUT_DIR"), "/lib.rs"));
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
include!("lib.rs.in");
|
||||
|
||||
#[cfg(feature = "with-syntex")]
|
||||
mod env;
|
||||
|
||||
#[cfg(feature = "with-syntex")]
|
||||
pub fn expand<S, D>(src: S, dst: D) -> Result<(), syntex::Error>
|
||||
where S: AsRef<Path>,
|
||||
@ -86,11 +83,7 @@ pub fn expand<S, D>(src: S, dst: D) -> Result<(), syntex::Error>
|
||||
reg.expand("", src, dst)
|
||||
};
|
||||
|
||||
// 16 MB stack unless otherwise specified
|
||||
let _tmp_env = env::set_if_unset("RUST_MIN_STACK", "16777216");
|
||||
|
||||
use std::thread;
|
||||
thread::spawn(expand_thread).join().unwrap()
|
||||
syntex::with_extra_stack(expand_thread)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
|
@ -17,5 +17,5 @@ with-syntex = ["syntex_syntax", "syntex_errors"]
|
||||
|
||||
[dependencies]
|
||||
clippy = { version = "^0.*", optional = true }
|
||||
syntex_syntax = { version = "^0.41.0", optional = true }
|
||||
syntex_errors = { version = "^0.41.0", optional = true }
|
||||
syntex_syntax = { version = "^0.42.0", optional = true }
|
||||
syntex_errors = { version = "^0.42.0", optional = true }
|
||||
|
Loading…
Reference in New Issue
Block a user