1
Fork 0

Add a feature gate

@alexcrichton figured out a way how to do it :)
This commit is contained in:
est31 2017-08-10 01:42:36 +02:00
parent b6ac9c0d30
commit 5cf9f6330a
3 changed files with 25 additions and 1 deletions

View file

@ -52,6 +52,16 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32))
}
/* __rust_unstable_column!(): expands to the current column number */
pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<base::MacResult+'static> {
if sp.allows_unstable() {
expand_column(cx, sp, tts)
} else {
cx.span_fatal(sp, "the __rust_unstable_column macro is unstable");
}
}
/// file!(): expands to the current filename */
/// The filemap (`loc.file`) contains a bunch more information we could spit
/// out if we wanted.