panic!("explicit panic")
);
($msg:expr) => ({
- static _MSG_FILE_LINE: (&'static str, &'static str, usize) = ($msg, file!(), line!());
+ static _MSG_FILE_LINE: (&'static str, &'static str, usize) =
+ ($msg, file!(), line!() as usize);
::core::panicking::panic(&_MSG_FILE_LINE)
});
($fmt:expr, $($arg:tt)*) => ({
// used inside a dead function. Just `#[allow(dead_code)]` is
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
- static _FILE_LINE: (&'static str, usize) = (file!(), line!());
+ static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
::core::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE)
});
}
macro_rules! log {
($lvl:expr, $($arg:tt)+) => ({
static LOC: ::log::LogLocation = ::log::LogLocation {
- line: line!(),
+ line: line!() as usize,
file: file!(),
module_path: module_path!(),
};
($msg:expr) => ({
$crate::rt::begin_unwind($msg, {
// static requires less code at runtime, more constant data
- static _FILE_LINE: (&'static str, usize) = (file!(), line!());
+ static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
&_FILE_LINE
})
});
// used inside a dead function. Just `#[allow(dead_code)]` is
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
- static _FILE_LINE: (&'static str, usize) = (file!(), line!());
+ static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
&_FILE_LINE
})
});
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr>;
- fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
+ fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr>;
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false),
ast::Sign::new(i))))
}
- fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
- self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8)))
+ fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
+ self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU32)))
}
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitBool(value))
let topmost = cx.original_span_in_file();
let loc = cx.codemap().lookup_char_pos(topmost.lo);
- base::MacExpr::new(cx.expr_usize(topmost, loc.line))
+ base::MacExpr::new(cx.expr_u32(topmost, loc.line as u32))
}
/* column!(): expands to the current column number */
let topmost = cx.original_span_in_file();
let loc = cx.codemap().lookup_char_pos(topmost.lo);
- base::MacExpr::new(cx.expr_usize(topmost, loc.col.to_usize()))
+
+ base::MacExpr::new(cx.expr_u32(topmost, loc.col.to_usize() as u32))
}
/// file!(): expands to the current filename */
{
assert!(file!().ends_with("includeme.fragment"));
- assert!(line!() == 5_usize);
+ assert!(line!() == 5_u32);
format!("victory robot {}", line!())
}
pub fn main() {
assert_eq!(line!(), 25);
- //assert!((column!() == 11));
+ assert!((column!() == 4_u32));
assert_eq!(indirect_line!(), 27);
assert!((file!().ends_with("syntax-extension-source-utils.rs")));
assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());