From 464e375d2f14de91aeb3263fa9331270667f8a79 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Tue, 29 Apr 2014 20:05:51 -0700 Subject: [PATCH] Move bitflags module to libstd This will allow us to provide type-safe APIs in libstd that are C-compatible. --- src/libcollections/lib.rs | 1 - src/{libcollections => libstd}/bitflags.rs | 8 ++------ src/libstd/lib.rs | 3 +++ 3 files changed, 5 insertions(+), 7 deletions(-) rename src/{libcollections => libstd}/bitflags.rs (98%) diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 891ac3be0e92..2121e129c352 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -42,7 +42,6 @@ pub use smallintmap::SmallIntMap; pub use treemap::{TreeMap, TreeSet}; pub use trie::{TrieMap, TrieSet}; -pub mod bitflags; pub mod bitv; pub mod btree; pub mod deque; diff --git a/src/libcollections/bitflags.rs b/src/libstd/bitflags.rs similarity index 98% rename from src/libcollections/bitflags.rs rename to src/libstd/bitflags.rs index 3e50f4153927..3caa5b5ab3cf 100644 --- a/src/libcollections/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -17,9 +17,6 @@ //! # Example //! //! ~~~rust -//! #[feature(phase)]; -//! #[phase(syntax)] extern crate collections; -//! //! bitflags!(Flags: u32 { //! FlagA = 0x00000001, //! FlagB = 0x00000010, @@ -41,9 +38,6 @@ //! The generated `struct`s can also be extended with type and trait implementations: //! //! ~~~rust -//! #[feature(phase)]; -//! #[phase(syntax)] extern crate collections; -//! //! use std::fmt; //! //! bitflags!(Flags: u32 { @@ -174,6 +168,8 @@ macro_rules! bitflags( #[cfg(test)] mod tests { + use ops::{BitOr, BitAnd, Sub}; + bitflags!(Flags: u32 { FlagA = 0x00000001, FlagB = 0x00000010, diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 841a73fa01fc..c34ebfdf7c20 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -142,7 +142,10 @@ fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, rustuv::event_loop, __test::main) } +/* Exported macros */ + pub mod macros; +pub mod bitflags; mod rtdeps;