Removed a few macro-expanding-to-module workarounds
Also documented a few issues
This commit is contained in:
parent
bf6964ecb6
commit
90f9eb3b1e
|
@ -1036,11 +1036,7 @@ pub fn upperhex(buf: &[u8], f: &mut Formatter) {
|
|||
f.pad_integral(local.slice_to(buf.len()), "0x", true);
|
||||
}
|
||||
|
||||
// FIXME(#4375) shouldn't need an inner module
|
||||
macro_rules! integer(($signed:ident, $unsigned:ident) => {
|
||||
mod $signed {
|
||||
use super::*;
|
||||
|
||||
// Signed is special because it actuall emits the negative sign,
|
||||
// nothing else should do that, however.
|
||||
impl Signed for $signed {
|
||||
|
@ -1060,7 +1056,6 @@ macro_rules! integer(($signed:ident, $unsigned:ident) => {
|
|||
int_base!($unsigned, $unsigned, 10, Unsigned, "")
|
||||
int_base!($unsigned, $unsigned, 16, LowerHex, "0x")
|
||||
upper_hex!($unsigned, $unsigned)
|
||||
}
|
||||
})
|
||||
|
||||
integer!(int, uint)
|
||||
|
|
|
@ -11,18 +11,19 @@
|
|||
//! Operations and constants for `f32`
|
||||
#[allow(missing_doc)];
|
||||
|
||||
use default::Default;
|
||||
use libc::c_int;
|
||||
use num::{Zero, One, strconv};
|
||||
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
|
||||
use num;
|
||||
use prelude::*;
|
||||
|
||||
use cmath::c_float_utils;
|
||||
use default::Default;
|
||||
use libc::{c_float, c_int};
|
||||
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
|
||||
use num::{Zero, One, strconv};
|
||||
use num;
|
||||
use to_str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
pub use cmath::c_float_targ_consts::*;
|
||||
|
||||
use self::delegated::*;
|
||||
|
||||
macro_rules! delegate(
|
||||
(
|
||||
$(
|
||||
|
@ -33,13 +34,6 @@ macro_rules! delegate(
|
|||
) -> $rv:ty = $bound_name:path
|
||||
),*
|
||||
) => (
|
||||
// An inner module is required to get the #[inline] attribute on the
|
||||
// functions.
|
||||
mod delegated {
|
||||
use cmath::c_float_utils;
|
||||
use libc::{c_float, c_int};
|
||||
use unstable::intrinsics;
|
||||
|
||||
$(
|
||||
#[inline]
|
||||
pub fn $name($( $arg : $arg_ty ),*) -> $rv {
|
||||
|
@ -48,7 +42,6 @@ macro_rules! delegate(
|
|||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -12,19 +12,20 @@
|
|||
|
||||
#[allow(missing_doc)];
|
||||
|
||||
use default::Default;
|
||||
use libc::c_int;
|
||||
use num::{Zero, One, strconv};
|
||||
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
|
||||
use num;
|
||||
use prelude::*;
|
||||
|
||||
use cmath::c_double_utils;
|
||||
use default::Default;
|
||||
use libc::{c_double, c_int};
|
||||
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
|
||||
use num::{Zero, One, strconv};
|
||||
use num;
|
||||
use to_str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
pub use cmath::c_double_targ_consts::*;
|
||||
pub use cmp::{min, max};
|
||||
|
||||
use self::delegated::*;
|
||||
|
||||
macro_rules! delegate(
|
||||
(
|
||||
$(
|
||||
|
@ -35,13 +36,6 @@ macro_rules! delegate(
|
|||
) -> $rv:ty = $bound_name:path
|
||||
),*
|
||||
) => (
|
||||
// An inner module is required to get the #[inline] attribute on the
|
||||
// functions.
|
||||
mod delegated {
|
||||
use cmath::c_double_utils;
|
||||
use libc::{c_double, c_int};
|
||||
use unstable::intrinsics;
|
||||
|
||||
$(
|
||||
#[inline]
|
||||
pub fn $name($( $arg : $arg_ty ),*) -> $rv {
|
||||
|
@ -50,7 +44,6 @@ macro_rules! delegate(
|
|||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// FIXME(#4375): this shouldn't have to be a nested module named 'generated'
|
||||
// FIXME(#4375): This shouldn't have to be a nested module named 'generated'...
|
||||
// FIXME(#10716): ... but now that we could solve that, the import lines and
|
||||
// attributes still prevent a removal of that module.
|
||||
|
||||
#[macro_escape];
|
||||
#[doc(hidden)];
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// FIXME(#4375): this shouldn't have to be a nested module named 'generated'
|
||||
// FIXME(#4375): This shouldn't have to be a nested module named 'generated'...
|
||||
// FIXME(#10716): ... but now that we could solve that, the import lines and
|
||||
// attributes still prevent a removal of that module.
|
||||
|
||||
#[macro_escape];
|
||||
#[doc(hidden)];
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
#[allow(missing_doc)];
|
||||
|
||||
use clone::Clone;
|
||||
|
||||
pub use self::inner::*;
|
||||
#[cfg(not(test))] use cmp::*;
|
||||
#[cfg(not(test))] use default::Default;
|
||||
#[cfg(not(test))] use num::Zero;
|
||||
|
||||
/// Method extensions to pairs where both types satisfy the `Clone` bound
|
||||
pub trait CopyableTuple<T, U> {
|
||||
|
@ -86,12 +87,6 @@ macro_rules! tuple_impls {
|
|||
})+
|
||||
}
|
||||
)+) => {
|
||||
pub mod inner {
|
||||
use clone::Clone;
|
||||
#[cfg(not(test))] use cmp::*;
|
||||
#[cfg(not(test))] use default::Default;
|
||||
#[cfg(not(test))] use num::Zero;
|
||||
|
||||
$(
|
||||
pub trait $move_trait<$($T),+> {
|
||||
$(fn $get_fn(self) -> $T;)+
|
||||
|
@ -196,7 +191,6 @@ macro_rules! tuple_impls {
|
|||
}
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Constructs an expression that performs a lexical ordering using method $rel.
|
||||
|
|
|
@ -2463,15 +2463,14 @@ impl<A> Default for @[A] {
|
|||
}
|
||||
|
||||
macro_rules! iterator {
|
||||
/* FIXME: #4375 Cannot attach documentation/attributes to a macro generated struct.
|
||||
(struct $name:ident -> $ptr:ty, $elem:ty) => {
|
||||
/// An iterator for iterating over a vector.
|
||||
pub struct $name<'self, T> {
|
||||
priv ptr: $ptr,
|
||||
priv end: $ptr,
|
||||
priv lifetime: $elem // FIXME: #5922
|
||||
priv lifetime: Option<$elem> // FIXME: #5922
|
||||
}
|
||||
};*/
|
||||
(impl $name:ident -> $elem:ty) => {
|
||||
|
||||
impl<'self, T> Iterator<$elem> for $name<'self, T> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<$elem> {
|
||||
|
@ -2502,11 +2501,7 @@ macro_rules! iterator {
|
|||
(exact, Some(exact))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! double_ended_iterator {
|
||||
(impl $name:ident -> $elem:ty) => {
|
||||
impl<'self, T> DoubleEndedIterator<$elem> for $name<'self, T> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<$elem> {
|
||||
|
@ -2548,15 +2543,7 @@ impl<'self, T> RandomAccessIterator<&'self T> for VecIterator<'self, T> {
|
|||
}
|
||||
}
|
||||
|
||||
//iterator!{struct VecIterator -> *T, &'self T}
|
||||
/// An iterator for iterating over a vector.
|
||||
pub struct VecIterator<'self, T> {
|
||||
priv ptr: *T,
|
||||
priv end: *T,
|
||||
priv lifetime: Option<&'self ()> // FIXME: #5922
|
||||
}
|
||||
iterator!{impl VecIterator -> &'self T}
|
||||
double_ended_iterator!{impl VecIterator -> &'self T}
|
||||
iterator!{struct VecIterator -> *T, &'self T}
|
||||
pub type RevIterator<'self, T> = Invert<VecIterator<'self, T>>;
|
||||
|
||||
impl<'self, T> ExactSize<&'self T> for VecIterator<'self, T> {}
|
||||
|
@ -2566,15 +2553,7 @@ impl<'self, T> Clone for VecIterator<'self, T> {
|
|||
fn clone(&self) -> VecIterator<'self, T> { *self }
|
||||
}
|
||||
|
||||
//iterator!{struct VecMutIterator -> *mut T, &'self mut T}
|
||||
/// An iterator for mutating the elements of a vector.
|
||||
pub struct VecMutIterator<'self, T> {
|
||||
priv ptr: *mut T,
|
||||
priv end: *mut T,
|
||||
priv lifetime: Option<&'self mut ()> // FIXME: #5922
|
||||
}
|
||||
iterator!{impl VecMutIterator -> &'self mut T}
|
||||
double_ended_iterator!{impl VecMutIterator -> &'self mut T}
|
||||
iterator!{struct VecMutIterator -> *mut T, &'self mut T}
|
||||
pub type MutRevIterator<'self, T> = Invert<VecMutIterator<'self, T>>;
|
||||
|
||||
/// An iterator that moves out of a vector.
|
||||
|
|
Loading…
Reference in New Issue