Skip to content

Commit 5bf385b

Browse files
author
Keegan McAllister
committed
Rename macro_escape to macro_use
In the future we want to support #[macro_use(foo, bar)] mod macros; but it's not an essential part of macro reform. Reserve the syntax for now.
1 parent fc58479 commit 5bf385b

File tree

18 files changed

+127
-43
lines changed

18 files changed

+127
-43
lines changed

src/libcollections/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ pub use vec_map::VecMap;
5454
// Needed for the vec! macro
5555
pub use alloc::boxed;
5656

57-
#[macro_escape]
57+
#[cfg_attr(stage0, macro_escape)]
58+
#[cfg_attr(not(stage0), macro_use)]
5859
mod macros;
5960

6061
pub mod binary_heap;

src/libcore/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,23 @@
6262
#![feature(default_type_params, unboxed_closures, associated_types)]
6363
#![deny(missing_docs)]
6464

65-
#[macro_escape]
65+
#[cfg_attr(stage0, macro_escape)]
66+
#[cfg_attr(not(stage0), macro_use)]
6667
mod macros;
6768

6869
#[path = "num/float_macros.rs"]
69-
#[macro_escape]
70+
#[cfg_attr(stage0, macro_escape)]
71+
#[cfg_attr(not(stage0), macro_use)]
7072
mod float_macros;
7173

7274
#[path = "num/int_macros.rs"]
73-
#[macro_escape]
75+
#[cfg_attr(stage0, macro_escape)]
76+
#[cfg_attr(not(stage0), macro_use)]
7477
mod int_macros;
7578

7679
#[path = "num/uint_macros.rs"]
77-
#[macro_escape]
80+
#[cfg_attr(stage0, macro_escape)]
81+
#[cfg_attr(not(stage0), macro_use)]
7882
mod uint_macros;
7983

8084
#[path = "num/int.rs"] pub mod int;

src/libcoretest/num/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use core::num::{NumCast, cast};
1414
use core::ops::{Add, Sub, Mul, Div, Rem};
1515
use core::kinds::Copy;
1616

17-
#[macro_escape]
17+
#[cfg_attr(stage0, macro_escape)]
18+
#[cfg_attr(not(stage0), macro_use)]
1819
mod int_macros;
1920

2021
mod i8;
@@ -23,7 +24,8 @@ mod i32;
2324
mod i64;
2425
mod int;
2526

26-
#[macro_escape]
27+
#[cfg_attr(stage0, macro_escape)]
28+
#[cfg_attr(not(stage0), macro_use)]
2729
mod uint_macros;
2830

2931
mod u8;

src/liblog/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ use regex::Regex;
183183

184184
use directive::LOG_LEVEL_NAMES;
185185

186-
#[macro_escape]
186+
#[cfg_attr(stage0, macro_escape)]
187+
#[cfg_attr(not(stage0), macro_use)]
187188
pub mod macros;
188189

189190
mod directive;

src/librustc_driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
182182
// strip before expansion to allow macros to depend on
183183
// configuration variables e.g/ in
184184
//
185-
// #[macro_escape] #[cfg(foo)]
185+
// #[macro_use] #[cfg(foo)]
186186
// mod bar { macro_rules! baz!(() => {{}}) }
187187
//
188188
// baz! should not use this definition unless foo is enabled.

src/librustc_trans/trans/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ pub use self::base::trans_crate;
1616
pub use self::context::CrateContext;
1717
pub use self::common::gensym_name;
1818

19-
#[macro_escape]
19+
#[cfg_attr(stage0, macro_escape)]
20+
#[cfg_attr(not(stage0), macro_use)]
2021
mod macros;
2122

2223
mod doc;

src/librustdoc/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ use rustc::session::search_paths::SearchPaths;
4949
// reexported from `clean` so it can be easily updated with the mod itself
5050
pub use clean::SCHEMA_VERSION;
5151

52-
#[macro_escape]
52+
#[cfg_attr(stage0, macro_escape)]
53+
#[cfg_attr(not(stage0), macro_use)]
5354
pub mod externalfiles;
5455

5556
pub mod clean;

src/libstd/io/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ pub mod stdio;
285285
pub mod timer;
286286
pub mod util;
287287

288-
#[macro_escape]
288+
#[cfg_attr(stage0, macro_escape)]
289+
#[cfg_attr(not(stage0), macro_use)]
289290
pub mod test;
290291

291292
/// The default buffer size for various I/O operations

src/libstd/lib.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,17 @@ pub use unicode::char;
173173
/* Exported macros */
174174

175175
#[cfg(stage0)]
176-
#[macro_escape]
176+
#[cfg_attr(stage0, macro_escape)]
177+
#[cfg_attr(not(stage0), macro_use)]
177178
pub mod macros_stage0;
178179

179180
#[cfg(not(stage0))]
180-
#[macro_escape]
181+
#[cfg_attr(stage0, macro_escape)]
182+
#[cfg_attr(not(stage0), macro_use)]
181183
pub mod macros;
182184

183-
#[macro_escape]
185+
#[cfg_attr(stage0, macro_escape)]
186+
#[cfg_attr(not(stage0), macro_use)]
184187
pub mod bitflags;
185188

186189
mod rtdeps;
@@ -193,15 +196,18 @@ pub mod prelude;
193196
/* Primitive types */
194197

195198
#[path = "num/float_macros.rs"]
196-
#[macro_escape]
199+
#[cfg_attr(stage0, macro_escape)]
200+
#[cfg_attr(not(stage0), macro_use)]
197201
mod float_macros;
198202

199203
#[path = "num/int_macros.rs"]
200-
#[macro_escape]
204+
#[cfg_attr(stage0, macro_escape)]
205+
#[cfg_attr(not(stage0), macro_use)]
201206
mod int_macros;
202207

203208
#[path = "num/uint_macros.rs"]
204-
#[macro_escape]
209+
#[cfg_attr(stage0, macro_escape)]
210+
#[cfg_attr(not(stage0), macro_use)]
205211
mod uint_macros;
206212

207213
#[path = "num/int.rs"] pub mod int;
@@ -229,7 +235,8 @@ pub mod num;
229235

230236
/* Runtime and platform support */
231237

232-
#[macro_escape]
238+
#[cfg_attr(stage0, macro_escape)]
239+
#[cfg_attr(not(stage0), macro_use)]
233240
pub mod thread_local;
234241

235242
pub mod c_str;

src/libstd/rt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ pub use alloc::heap;
3939
pub mod backtrace;
4040

4141
// Internals
42+
#[cfg_attr(stage0, macro_escape)]
43+
#[cfg_attr(not(stage0), macro_use)]
4244
mod macros;
4345

4446
// These should be refactored/moved/made private over time

0 commit comments

Comments
 (0)