about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-18 17:32:07 +0000
committerbors <bors@rust-lang.org>2014-12-18 17:32:07 +0000
commitf9a48492a82f805aa40d8b6fea290badbab0d1b1 (patch)
treef496892ac2e9bfb5b7be8016c6d5ad5e5d6667ef /src/libstd/sys
parentc4d58ce15be0318622b42790a501e0d20a9f827c (diff)
parentddb2466f6a1bb66f22824334022a4cee61c73bdc (diff)
downloadrust-f9a48492a82f805aa40d8b6fea290badbab0d1b1.tar.gz
rust-f9a48492a82f805aa40d8b6fea290badbab0d1b1.zip
auto merge of #19984 : japaric/rust/macro-expressions, r=alexcrichton
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]

---

Rebased version of #18958
r? @alexcrichton 
cc @pcwalton 
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/unix/mod.rs4
-rw-r--r--src/libstd/sys/unix/process.rs2
-rw-r--r--src/libstd/sys/unix/timer.rs2
-rw-r--r--src/libstd/sys/windows/c.rs12
-rw-r--r--src/libstd/sys/windows/mod.rs4
-rw-r--r--src/libstd/sys/windows/timer.rs2
6 files changed, 13 insertions, 13 deletions
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs
index 107263c31a7..acbf2096326 100644
--- a/src/libstd/sys/unix/mod.rs
+++ b/src/libstd/sys/unix/mod.rs
@@ -23,7 +23,7 @@ use prelude::*;
 use io::{mod, IoResult, IoError};
 use sys_common::mkerr_libc;
 
-macro_rules! helper_init( (static $name:ident: Helper<$m:ty>) => (
+macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
     static $name: Helper<$m> = Helper {
         lock: ::sync::MUTEX_INIT,
         cond: ::sync::CONDVAR_INIT,
@@ -32,7 +32,7 @@ macro_rules! helper_init( (static $name:ident: Helper<$m:ty>) => (
         initialized: ::cell::UnsafeCell { value: false },
         shutdown: ::cell::UnsafeCell { value: false },
     };
-) )
+) }
 
 pub mod c;
 pub mod ext;
diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs
index 4ef1757cc3a..835f4279d9b 100644
--- a/src/libstd/sys/unix/process.rs
+++ b/src/libstd/sys/unix/process.rs
@@ -28,7 +28,7 @@ use sys_common::{AsInner, mkerr_libc, timeout};
 
 pub use sys_common::ProcessConfig;
 
-helper_init!(static HELPER: Helper<Req>)
+helper_init! { static HELPER: Helper<Req> }
 
 /// The unique id of the process (this should never be negative).
 pub struct Process {
diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs
index 6ebbedb8e90..79a6a871f8d 100644
--- a/src/libstd/sys/unix/timer.rs
+++ b/src/libstd/sys/unix/timer.rs
@@ -60,7 +60,7 @@ use sys_common::helper_thread::Helper;
 use prelude::*;
 use io::IoResult;
 
-helper_init!(static HELPER: Helper<Req>)
+helper_init! { static HELPER: Helper<Req> }
 
 pub trait Callback {
     fn call(&mut self);
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index e46765f25b8..d1cb91bcdb3 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -169,7 +169,7 @@ pub mod compat {
     ///
     /// Note that arguments unused by the fallback implementation should not be called `_` as
     /// they are used to be passed to the real function if available.
-    macro_rules! compat_fn(
+    macro_rules! compat_fn {
         ($module:ident::$symbol:ident($($argname:ident: $argtype:ty),*)
                                       -> $rettype:ty $fallback:block) => (
             #[inline(always)]
@@ -195,7 +195,7 @@ pub mod compat {
         ($module:ident::$symbol:ident($($argname:ident: $argtype:ty),*) $fallback:block) => (
             compat_fn!($module::$symbol($($argname: $argtype),*) -> () $fallback)
         )
-    )
+    }
 
     /// Compatibility layer for functions in `kernel32.dll`
     ///
@@ -211,20 +211,20 @@ pub mod compat {
             fn SetLastError(dwErrCode: DWORD);
         }
 
-        compat_fn!(kernel32::CreateSymbolicLinkW(_lpSymlinkFileName: LPCWSTR,
+        compat_fn! { kernel32::CreateSymbolicLinkW(_lpSymlinkFileName: LPCWSTR,
                                                  _lpTargetFileName: LPCWSTR,
                                                  _dwFlags: DWORD) -> BOOLEAN {
             unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); }
             0
-        })
+        } }
 
-        compat_fn!(kernel32::GetFinalPathNameByHandleW(_hFile: HANDLE,
+        compat_fn! { kernel32::GetFinalPathNameByHandleW(_hFile: HANDLE,
                                                        _lpszFilePath: LPCWSTR,
                                                        _cchFilePath: DWORD,
                                                        _dwFlags: DWORD) -> DWORD {
             unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); }
             0
-        })
+        } }
     }
 }
 
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index 41361a0cde6..d22d4e0f534 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -24,7 +24,7 @@ use prelude::*;
 use io::{mod, IoResult, IoError};
 use sync::{Once, ONCE_INIT};
 
-macro_rules! helper_init( (static $name:ident: Helper<$m:ty>) => (
+macro_rules! helper_init { (static $name:ident: Helper<$m:ty>) => (
     static $name: Helper<$m> = Helper {
         lock: ::sync::MUTEX_INIT,
         cond: ::sync::CONDVAR_INIT,
@@ -33,7 +33,7 @@ macro_rules! helper_init( (static $name:ident: Helper<$m:ty>) => (
         initialized: ::cell::UnsafeCell { value: false },
         shutdown: ::cell::UnsafeCell { value: false },
     };
-) )
+) }
 
 pub mod c;
 pub mod ext;
diff --git a/src/libstd/sys/windows/timer.rs b/src/libstd/sys/windows/timer.rs
index 9af3a7c8b6e..e2f9e2a9201 100644
--- a/src/libstd/sys/windows/timer.rs
+++ b/src/libstd/sys/windows/timer.rs
@@ -32,7 +32,7 @@ use sys_common::helper_thread::Helper;
 use prelude::*;
 use io::IoResult;
 
-helper_init!(static HELPER: Helper<Req>)
+helper_init! { static HELPER: Helper<Req> }
 
 pub trait Callback {
     fn call(&mut self);