about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2017-05-12 08:21:00 +0200
committerest31 <MTest31@outlook.com>2017-05-12 09:37:28 +0200
commit80891f6e4725efc72c27e4f224123ec292fdd7d4 (patch)
tree4debab43e1544d893a5757551449f24a0acbe8e9 /src
parent39bcd6f425426bfacd7de9fe0378df4bd9263d00 (diff)
downloadrust-80891f6e4725efc72c27e4f224123ec292fdd7d4.tar.gz
rust-80891f6e4725efc72c27e4f224123ec292fdd7d4.zip
Remove some unused macros from the rust codebase
Removes unused macros from:
  * libcore
  * libcollections
    The last use of these two macros was removed in commit
    b64c9d56700e2c41207166fe8709711ff02488ff
    when the char_range_at_reverse function was been removed.
  * librustc_errors
    Their last use was removed by commits
    2f2c3e178325dc1837badcd7573c2c0905fab979
    and 11dc974a38fd533aa692cea213305056cd3a6902.
  * libsyntax_ext
  * librustc_trans
    Also, put the otry macro in back/msvc/mod.rs under the
    same cfg argument as the places that use it.
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/str.rs12
-rw-r--r--src/libcore/lib.rs4
-rw-r--r--src/libcore/num/float_macros.rs20
-rw-r--r--src/libcore/num/mod.rs7
-rw-r--r--src/librustc_errors/emitter.rs15
-rw-r--r--src/librustc_trans/back/msvc/mod.rs1
-rw-r--r--src/librustc_trans/lib.rs3
-rw-r--r--src/librustc_trans/macros.rs29
-rw-r--r--src/libsyntax_ext/deriving/mod.rs6
9 files changed, 1 insertions, 96 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index 964660183e7..5f4578bbeb3 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -176,18 +176,6 @@ impl<'a> Iterator for EncodeUtf16<'a> {
 #[unstable(feature = "fused", issue = "35602")]
 impl<'a> FusedIterator for EncodeUtf16<'a> {}
 
-// Return the initial codepoint accumulator for the first byte.
-// The first byte is special, only want bottom 5 bits for width 2, 4 bits
-// for width 3, and 3 bits for width 4
-macro_rules! utf8_first_byte {
-    ($byte:expr, $width:expr) => (($byte & (0x7F >> $width)) as u32)
-}
-
-// return the value of $ch updated with continuation byte $byte
-macro_rules! utf8_acc_cont_byte {
-    ($ch:expr, $byte:expr) => (($ch << 6) | ($byte & 63) as u32)
-}
-
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Borrow<str> for String {
     #[inline]
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 80c2221ce64..b6ab1ecaf4e 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -104,10 +104,6 @@ mod macros;
 #[macro_use]
 mod internal_macros;
 
-#[path = "num/float_macros.rs"]
-#[macro_use]
-mod float_macros;
-
 #[path = "num/int_macros.rs"]
 #[macro_use]
 mod int_macros;
diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs
deleted file mode 100644
index b3adef53dab..00000000000
--- a/src/libcore/num/float_macros.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![doc(hidden)]
-
-macro_rules! assert_approx_eq {
-    ($a:expr, $b:expr) => ({
-        use num::Float;
-        let (a, b) = (&$a, &$b);
-        assert!((*a - *b).abs() < 1.0e-6,
-                "{} is not approximately equal to {}", *a, *b);
-    })
-}
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 18e2c1d5c73..8b4002fe9af 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -96,13 +96,6 @@ pub mod dec2flt;
 pub mod bignum;
 pub mod diy_float;
 
-macro_rules! checked_op {
-    ($U:ty, $op:path, $x:expr, $y:expr) => {{
-        let (result, overflowed) = unsafe { $op($x as $U, $y as $U) };
-        if overflowed { None } else { Some(result as Self) }
-    }}
-}
-
 // `Int` + `SignedInt` implemented for signed integers
 macro_rules! int_impl {
     ($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr,
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 53999eb9138..34c138eca9e 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -95,21 +95,6 @@ struct FileWithAnnotatedLines {
     multiline_depth: usize,
 }
 
-
-/// Do not use this for messages that end in `\n` – use `println_maybe_styled` instead. See
-/// `EmitterWriter::print_maybe_styled` for details.
-macro_rules! print_maybe_styled {
-    ($dst: expr, $style: expr, $($arg: tt)*) => {
-        $dst.print_maybe_styled(format_args!($($arg)*), $style, false)
-    }
-}
-
-macro_rules! println_maybe_styled {
-    ($dst: expr, $style: expr, $($arg: tt)*) => {
-        $dst.print_maybe_styled(format_args!($($arg)*), $style, true)
-    }
-}
-
 impl EmitterWriter {
     pub fn stderr(color_config: ColorConfig, code_map: Option<Rc<CodeMapper>>) -> EmitterWriter {
         if color_config.use_color() {
diff --git a/src/librustc_trans/back/msvc/mod.rs b/src/librustc_trans/back/msvc/mod.rs
index 16aef6ee8ca..31f3415b1ec 100644
--- a/src/librustc_trans/back/msvc/mod.rs
+++ b/src/librustc_trans/back/msvc/mod.rs
@@ -32,6 +32,7 @@
 //! comments can also be found below leading through the various code paths.
 
 // A simple macro to make this option mess easier to read
+#[cfg(windows)]
 macro_rules! otry {
     ($expr:expr) => (match $expr {
         Some(val) => val,
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 111c2547721..14b6650c493 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -85,9 +85,6 @@ pub mod back {
 
 pub mod diagnostics;
 
-#[macro_use]
-mod macros;
-
 mod abi;
 mod adt;
 mod asm;
diff --git a/src/librustc_trans/macros.rs b/src/librustc_trans/macros.rs
deleted file mode 100644
index 77efcc6fb00..00000000000
--- a/src/librustc_trans/macros.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-macro_rules! unpack_datum {
-    ($bcx: ident, $inp: expr) => (
-        {
-            let db = $inp;
-            $bcx = db.bcx;
-            db.datum
-        }
-    )
-}
-
-macro_rules! unpack_result {
-    ($bcx: ident, $inp: expr) => (
-        {
-            let db = $inp;
-            $bcx = db.bcx;
-            db.val
-        }
-    )
-}
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs
index b2bb43e41ed..31c7cc33676 100644
--- a/src/libsyntax_ext/deriving/mod.rs
+++ b/src/libsyntax_ext/deriving/mod.rs
@@ -25,12 +25,6 @@ macro_rules! pathvec {
     )
 }
 
-macro_rules! path {
-    ($($x:tt)*) => (
-        ::ext::deriving::generic::ty::Path::new( pathvec![ $($x)* ] )
-    )
-}
-
 macro_rules! path_local {
     ($x:ident) => (
         ::deriving::generic::ty::Path::new_local(stringify!($x))