Skip to content

Commit 1212fd8

Browse files
committed
Resolve includeme.fragment conflict.
1 parent 522d09d commit 1212fd8

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

src/libcore/macros.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ macro_rules! panic {
1515
panic!("explicit panic")
1616
);
1717
($msg:expr) => ({
18-
static _MSG_FILE_LINE: (&'static str, &'static str, usize) = ($msg, file!(), line!());
18+
static _MSG_FILE_LINE: (&'static str, &'static str, usize) =
19+
($msg, file!(), line!() as usize);
1920
::core::panicking::panic(&_MSG_FILE_LINE)
2021
});
2122
($fmt:expr, $($arg:tt)*) => ({
2223
// The leading _'s are to avoid dead code warnings if this is
2324
// used inside a dead function. Just `#[allow(dead_code)]` is
2425
// insufficient, since the user may have
2526
// `#[forbid(dead_code)]` and which cannot be overridden.
26-
static _FILE_LINE: (&'static str, usize) = (file!(), line!());
27+
static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
2728
::core::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE)
2829
});
2930
}

src/liblog/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
macro_rules! log {
5252
($lvl:expr, $($arg:tt)+) => ({
5353
static LOC: ::log::LogLocation = ::log::LogLocation {
54-
line: line!(),
54+
line: line!() as usize,
5555
file: file!(),
5656
module_path: module_path!(),
5757
};

src/libstd/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ macro_rules! panic {
4444
($msg:expr) => ({
4545
$crate::rt::begin_unwind($msg, {
4646
// static requires less code at runtime, more constant data
47-
static _FILE_LINE: (&'static str, usize) = (file!(), line!());
47+
static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
4848
&_FILE_LINE
4949
})
5050
});
@@ -54,7 +54,7 @@ macro_rules! panic {
5454
// used inside a dead function. Just `#[allow(dead_code)]` is
5555
// insufficient, since the user may have
5656
// `#[forbid(dead_code)]` and which cannot be overridden.
57-
static _FILE_LINE: (&'static str, usize) = (file!(), line!());
57+
static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
5858
&_FILE_LINE
5959
})
6060
});

src/libsyntax/ext/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub trait AstBuilder {
147147

148148
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
149149
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr>;
150-
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
150+
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr>;
151151
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
152152

153153
fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr>;
@@ -701,8 +701,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
701701
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false),
702702
ast::Sign::new(i))))
703703
}
704-
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
705-
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8)))
704+
fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> {
705+
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU32)))
706706
}
707707
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> {
708708
self.expr_lit(sp, ast::LitBool(value))

src/libsyntax/ext/source_util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
3535
let topmost = cx.original_span_in_file();
3636
let loc = cx.codemap().lookup_char_pos(topmost.lo);
3737

38-
base::MacExpr::new(cx.expr_usize(topmost, loc.line))
38+
base::MacExpr::new(cx.expr_u32(topmost, loc.line as u32))
3939
}
4040

4141
/* column!(): expands to the current column number */
@@ -45,7 +45,8 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
4545

4646
let topmost = cx.original_span_in_file();
4747
let loc = cx.codemap().lookup_char_pos(topmost.lo);
48-
base::MacExpr::new(cx.expr_usize(topmost, loc.col.to_usize()))
48+
49+
base::MacExpr::new(cx.expr_u32(topmost, loc.col.to_usize() as u32))
4950
}
5051

5152
/// file!(): expands to the current filename */

src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
{
44
assert!(file!().ends_with("includeme.fragment"));
5-
assert!(line!() == 5_usize);
5+
assert!(line!() == 5_u32);
66
format!("victory robot {}", line!())
77
}

src/test/run-pass/syntax-extension-source-utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macro_rules! indirect_line { () => ( line!() ) }
2323

2424
pub fn main() {
2525
assert_eq!(line!(), 25);
26-
//assert!((column!() == 11));
26+
assert!((column!() == 4_u32));
2727
assert_eq!(indirect_line!(), 27);
2828
assert!((file!().ends_with("syntax-extension-source-utils.rs")));
2929
assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string());

0 commit comments

Comments
 (0)