]> git.lizzy.rs Git - rust.git/commitdiff
Resolve includeme.fragment conflict.
authorBrian Brooks <brooks.brian@gmail.com>
Sat, 21 Feb 2015 11:56:46 +0000 (06:56 -0500)
committerBrian Brooks <brooks.brian@gmail.com>
Sat, 21 Feb 2015 11:56:46 +0000 (06:56 -0500)
src/libcore/macros.rs
src/liblog/macros.rs
src/libstd/macros.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/source_util.rs
src/test/run-pass/syntax-extension-source-utils-files/includeme.fragment
src/test/run-pass/syntax-extension-source-utils.rs

index 943365d8454d4629ed65a6757aa17ef28817e961..d02ed7c25381d2482508f838c1737781dd85520d 100644 (file)
@@ -15,7 +15,8 @@ macro_rules! panic {
         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)*) => ({
@@ -23,7 +24,7 @@ macro_rules! panic {
         // 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)
     });
 }
index 4a9a9bd40600b73d736244b022a68a46cab331fb..787d9c470d41fffefacdeac36f0781c6731a1a8c 100644 (file)
@@ -51,7 +51,7 @@
 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!(),
         };
index 00bb7f86b170cf47b536ed5bdfac11b0405dd590..abdcca59c58f31a850d55476b3f0a7a9b8de96dd 100644 (file)
@@ -44,7 +44,7 @@ macro_rules! panic {
     ($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
         })
     });
@@ -54,7 +54,7 @@ macro_rules! panic {
             // 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
         })
     });
index 5bfd4a9f6111c6a48f4564f2d578eac979c1c83d..454c21fdc572d2e1088a191577cc6dcc59213d26 100644 (file)
@@ -147,7 +147,7 @@ fn expr_struct_ident(&self, span: Span, id: ast::Ident,
 
     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>;
@@ -701,8 +701,8 @@ fn expr_int(&self, sp: Span, i: isize) -> 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))
index c8d48750c75093259d428d491914075dd202b827..40e614c78c7cc92fd5c3165d306049ffa4f9c484 100644 (file)
@@ -35,7 +35,7 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
     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 */
@@ -45,7 +45,8 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
 
     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 */
index dea7f99fcbace35c6da7c123fb882f683c0583db..70cd7b772920db0d22205c6b9d10a0dfa301b725 100644 (file)
@@ -2,6 +2,6 @@
 
 {
     assert!(file!().ends_with("includeme.fragment"));
-    assert!(line!() == 5_usize);
+    assert!(line!() == 5_u32);
     format!("victory robot {}", line!())
 }
index 349a676a433e366eceb45021cb10186a2f22453a..d1dc02bce8d6ec4db04d49a94ad76e3470e65521 100644 (file)
@@ -23,7 +23,7 @@ macro_rules! indirect_line { () => ( 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());