-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
embed_migrations!
temporarily
Unfortunately it will be impossible to write this macro using the Macros 1.1 API. While this is an important feature that I want to keep, I more importantly want to keep the main repository working on stable. It will have to live as a separate crate, and possibly have an API change to work around build scripts.
- Loading branch information
Showing
23 changed files
with
70 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,46 @@ | ||
#[cfg(feature = "with-syntex")] | ||
mod inner { | ||
extern crate syntex; | ||
extern crate syntex_syntax as syntax; | ||
|
||
use std::env; | ||
use std::path::Path; | ||
use std::thread; | ||
|
||
use self::syntax::codemap::Span; | ||
use self::syntax::ext::base::{self, ExtCtxt}; | ||
use self::syntax::tokenstream::TokenTree; | ||
|
||
pub fn main() { | ||
with_extra_stack(move || { | ||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
let mut registry = syntex::Registry::new(); | ||
|
||
macro_rules! register_quote_macro { | ||
($macro_name: ident, $name: ident) => { | ||
fn $name<'cx>( | ||
cx: &'cx mut ExtCtxt, | ||
sp: Span, | ||
tts: &[TokenTree], | ||
) -> Box<base::MacResult + 'cx> { | ||
syntax::ext::quote::$name(cx, sp, tts) | ||
} | ||
|
||
registry.add_macro(stringify!($macro_name), $name); | ||
} | ||
} | ||
extern crate syntex; | ||
extern crate syntex_syntax as syntax; | ||
|
||
register_quote_macro!(quote_ty, expand_quote_ty); | ||
register_quote_macro!(quote_item, expand_quote_item); | ||
register_quote_macro!(quote_tokens, expand_quote_tokens); | ||
register_quote_macro!(quote_expr, expand_quote_expr); | ||
use std::env; | ||
use std::path::Path; | ||
use std::thread; | ||
|
||
let src = Path::new("src/lib.in.rs"); | ||
let dst = Path::new(&out_dir).join("lib.rs"); | ||
use self::syntax::codemap::Span; | ||
use self::syntax::ext::base::{self, ExtCtxt}; | ||
use self::syntax::tokenstream::TokenTree; | ||
|
||
registry.expand("", &src, &dst).unwrap(); | ||
}); | ||
} | ||
fn main() { | ||
with_extra_stack(move || { | ||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
let mut registry = syntex::Registry::new(); | ||
|
||
macro_rules! register_quote_macro { | ||
($macro_name: ident, $name: ident) => { | ||
fn $name<'cx>( | ||
cx: &'cx mut ExtCtxt, | ||
sp: Span, | ||
tts: &[TokenTree], | ||
) -> Box<base::MacResult + 'cx> { | ||
syntax::ext::quote::$name(cx, sp, tts) | ||
} | ||
|
||
fn with_extra_stack<F: FnOnce() + Send + 'static>(f: F) { | ||
env::set_var("RUST_MIN_STACK", "16777216"); // 16MB | ||
thread::spawn(f).join().unwrap(); | ||
} | ||
} | ||
registry.add_macro(stringify!($macro_name), $name); | ||
} | ||
} | ||
|
||
register_quote_macro!(quote_ty, expand_quote_ty); | ||
register_quote_macro!(quote_item, expand_quote_item); | ||
register_quote_macro!(quote_tokens, expand_quote_tokens); | ||
register_quote_macro!(quote_expr, expand_quote_expr); | ||
|
||
#[cfg(not(feature = "with-syntex"))] | ||
mod inner { | ||
pub fn main() {} | ||
let src = Path::new("src/lib.in.rs"); | ||
let dst = Path::new(&out_dir).join("lib.rs"); | ||
|
||
registry.expand("", &src, &dst).unwrap(); | ||
}); | ||
} | ||
|
||
fn main() { | ||
inner::main(); | ||
fn with_extra_stack<F: FnOnce() + Send + 'static>(f: F) { | ||
env::set_var("RUST_MIN_STACK", "16777216"); // 16MB | ||
thread::spawn(f).join().unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.