Skip to content

Commit 1c3ef0f

Browse files
committed
---
yaml --- r: 152406 b: refs/heads/try2 c: 966c734 h: refs/heads/master v: v3
1 parent 4d49bd3 commit 1c3ef0f

File tree

104 files changed

+1094
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1094
-893
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0ea7aa30cc864d00fc30b9ba610f2daefab4e850
8+
refs/heads/try2: 966c7346cae89cf47017bfbf27e383d0b0351d82
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/crates.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ DEPS_uuid := std serialize
8383
DEPS_sync := std alloc
8484
DEPS_getopts := std
8585
DEPS_collections := core alloc
86-
DEPS_fourcc := rustc syntax std
87-
DEPS_hexfloat := rustc syntax std
86+
DEPS_fourcc := syntax std
87+
DEPS_hexfloat := syntax std
8888
DEPS_num := std
8989
DEPS_test := std getopts serialize term time regex native:rust_test_helpers
9090
DEPS_time := std serialize sync
9191
DEPS_rand := core
9292
DEPS_url := std
9393
DEPS_log := std sync
9494
DEPS_regex := std
95-
DEPS_regex_macros = rustc syntax std regex
95+
DEPS_regex_macros = syntax std regex
9696
DEPS_fmt_macros = std
9797

9898
TOOL_DEPS_compiletest := test green rustuv getopts

branches/try2/src/compiletest/compiletest.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@
1818

1919
extern crate test;
2020
extern crate getopts;
21+
#[phase(link, syntax)]
22+
extern crate log;
2123
extern crate green;
2224
extern crate rustuv;
2325

24-
#[cfg(stage0)]
25-
#[phase(syntax, link)]
26-
extern crate log;
27-
28-
#[cfg(not(stage0))]
29-
#[phase(plugin, link)]
30-
extern crate log;
31-
3226
extern crate regex;
3327

3428
use std::os;

branches/try2/src/doc/rust.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,8 +1819,9 @@ type int8_t = i8;
18191819

18201820
### Function-only attributes
18211821

1822-
- `plugin_registrar` - mark this function as the registration point for
1823-
compiler plugins, such as loadable syntax extensions.
1822+
- `macro_registrar` - when using loadable syntax extensions, mark this
1823+
function as the registration point for the current crate's syntax
1824+
extensions.
18241825
- `main` - indicates that this function should be passed to the entry point,
18251826
rather than the function in the crate root named `main`.
18261827
- `start` - indicates that this function should be used as the entry point,
@@ -4097,7 +4098,7 @@ that demonstrates all four of them:
40974098

40984099
~~~~
40994100
#![feature(phase)]
4100-
#[phase(plugin, link)] extern crate log;
4101+
#[phase(syntax, link)] extern crate log;
41014102
41024103
fn main() {
41034104
error!("This is an error log")

branches/try2/src/liballoc/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,8 @@
7070
#![no_std]
7171
#![feature(phase)]
7272

73-
#[cfg(stage0)]
7473
#[phase(syntax, link)]
7574
extern crate core;
76-
77-
#[cfg(not(stage0))]
78-
#[phase(plugin, link)]
79-
extern crate core;
80-
8175
extern crate libc;
8276

8377

@@ -86,10 +80,8 @@ extern crate libc;
8680
#[cfg(test)] extern crate debug;
8781
#[cfg(test)] extern crate sync;
8882
#[cfg(test)] extern crate native;
89-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
90-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
91-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
92-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
83+
#[cfg(test)] #[phase(syntax, link)] extern crate std;
84+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
9385

9486
// Heaps provided for low-level allocation strategies
9587

branches/try2/src/libcollections/lib.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,14 @@
2323
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
2424
#![no_std]
2525

26+
#[phase(syntax, link)] extern crate core;
2627
extern crate alloc;
2728

28-
#[cfg(stage0)]
29-
#[phase(syntax, link)]
30-
extern crate core;
31-
32-
#[cfg(not(stage0))]
33-
#[phase(plugin, link)]
34-
extern crate core;
35-
3629
#[cfg(test)] extern crate native;
3730
#[cfg(test)] extern crate test;
3831
#[cfg(test)] extern crate debug;
39-
40-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate std;
41-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
42-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate std;
43-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
32+
#[cfg(test)] #[phase(syntax, link)] extern crate std;
33+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
4434

4535
use core::prelude::*;
4636

branches/try2/src/libcore/ops.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,27 @@ pub trait DerefMut<Result>: Deref<Result> {
726726
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
727727
}
728728

729+
/// A version of the call operator that takes an immutable receiver.
730+
#[lang="fn"]
731+
pub trait Fn<Args,Result> {
732+
/// This is called when the call operator is used.
733+
fn call(&self, args: Args) -> Result;
734+
}
735+
736+
/// A version of the call operator that takes a mutable receiver.
737+
#[lang="fn_mut"]
738+
pub trait FnMut<Args,Result> {
739+
/// This is called when the call operator is used.
740+
fn call_mut(&mut self, args: Args) -> Result;
741+
}
742+
743+
/// A version of the call operator that takes a by-value receiver.
744+
#[lang="fn_once"]
745+
pub trait FnOnce<Args,Result> {
746+
/// This is called when the call operator is used.
747+
fn call_once(self, args: Args) -> Result;
748+
}
749+
729750
#[cfg(test)]
730751
mod bench {
731752
extern crate test;

branches/try2/src/libflate/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ Simple [DEFLATE][def]-based compression. This is a wrapper around the
2828
#![feature(phase)]
2929
#![deny(deprecated_owned_vector)]
3030

31-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
32-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
31+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
3332

3433
extern crate libc;
3534

branches/try2/src/libfourcc/lib.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ to be `big`, i.e. left-to-right order. It returns a u32.
2222
To load the extension and use it:
2323
2424
```rust,ignore
25-
#[phase(plugin)]
25+
#[phase(syntax)]
2626
extern crate fourcc;
2727
2828
fn main() {
@@ -48,25 +48,29 @@ fn main() {
4848
html_root_url = "http://doc.rust-lang.org/")]
4949

5050
#![deny(deprecated_owned_vector)]
51-
#![feature(plugin_registrar, managed_boxes)]
51+
#![feature(macro_registrar, managed_boxes)]
5252

5353
extern crate syntax;
54-
extern crate rustc;
5554

5655
use syntax::ast;
56+
use syntax::ast::Name;
5757
use syntax::attr::contains;
5858
use syntax::codemap::{Span, mk_sp};
5959
use syntax::ext::base;
60-
use syntax::ext::base::{ExtCtxt, MacExpr};
60+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
6161
use syntax::ext::build::AstBuilder;
6262
use syntax::parse;
6363
use syntax::parse::token;
6464
use syntax::parse::token::InternedString;
65-
use rustc::plugin::Registry;
6665

67-
#[plugin_registrar]
68-
pub fn plugin_registrar(reg: &mut Registry) {
69-
reg.register_macro("fourcc", expand_syntax_ext);
66+
#[macro_registrar]
67+
pub fn macro_registrar(register: |Name, SyntaxExtension|) {
68+
register(token::intern("fourcc"),
69+
NormalTT(box BasicMacroExpander {
70+
expander: expand_syntax_ext,
71+
span: None,
72+
},
73+
None));
7074
}
7175

7276
pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])

branches/try2/src/libgetopts/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@
9191
#![deny(deprecated_owned_vector)]
9292

9393
#[cfg(test)] extern crate debug;
94-
#[cfg(test, stage0)] #[phase(syntax, link)] extern crate log;
95-
#[cfg(test, not(stage0))] #[phase(plugin, link)] extern crate log;
94+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
9695

9796
use std::cmp::PartialEq;
9897
use std::result::{Err, Ok};

branches/try2/src/libgreen/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
//!
149149
//! ```
150150
//! #![feature(phase)]
151-
//! #[phase(plugin)] extern crate green;
151+
//! #[phase(syntax)] extern crate green;
152152
//!
153153
//! green_start!(main)
154154
//!
@@ -211,7 +211,7 @@
211211
#![allow(visible_private_types)]
212212
#![deny(deprecated_owned_vector)]
213213

214-
#[cfg(test)] #[phase(plugin, link)] extern crate log;
214+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
215215
#[cfg(test)] extern crate rustuv;
216216
extern crate libc;
217217
extern crate alloc;
@@ -249,7 +249,7 @@ pub mod task;
249249
///
250250
/// ```
251251
/// #![feature(phase)]
252-
/// #[phase(plugin)] extern crate green;
252+
/// #[phase(syntax)] extern crate green;
253253
///
254254
/// green_start!(main)
255255
///

branches/try2/src/libhexfloat/lib.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ literal.
2121
To load the extension and use it:
2222
2323
```rust,ignore
24-
#[phase(plugin)]
24+
#[phase(syntax)]
2525
extern crate hexfloat;
2626
2727
fn main() {
@@ -45,23 +45,27 @@ fn main() {
4545
html_root_url = "http://doc.rust-lang.org/")]
4646

4747
#![deny(deprecated_owned_vector)]
48-
#![feature(plugin_registrar, managed_boxes)]
48+
#![feature(macro_registrar, managed_boxes)]
4949

5050
extern crate syntax;
51-
extern crate rustc;
5251

5352
use syntax::ast;
53+
use syntax::ast::Name;
5454
use syntax::codemap::{Span, mk_sp};
5555
use syntax::ext::base;
56-
use syntax::ext::base::{ExtCtxt, MacExpr};
56+
use syntax::ext::base::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
5757
use syntax::ext::build::AstBuilder;
5858
use syntax::parse;
5959
use syntax::parse::token;
60-
use rustc::plugin::Registry;
6160

62-
#[plugin_registrar]
63-
pub fn plugin_registrar(reg: &mut Registry) {
64-
reg.register_macro("hexfloat", expand_syntax_ext);
61+
#[macro_registrar]
62+
pub fn macro_registrar(register: |Name, SyntaxExtension|) {
63+
register(token::intern("hexfloat"),
64+
NormalTT(box BasicMacroExpander {
65+
expander: expand_syntax_ext,
66+
span: None,
67+
},
68+
None));
6569
}
6670

6771
//Check if the literal is valid (as LLVM expects),

branches/try2/src/liblog/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Utilities for program-wide and customizable logging
1616
1717
```
1818
#![feature(phase)]
19-
#[phase(plugin, link)] extern crate log;
19+
#[phase(syntax, link)] extern crate log;
2020
2121
fn main() {
2222
debug!("this is a debug {}", "message");

branches/try2/src/liblog/macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
///
2323
/// ```
2424
/// #![feature(phase)]
25-
/// #[phase(plugin, link)] extern crate log;
25+
/// #[phase(syntax, link)] extern crate log;
2626
///
2727
/// # fn main() {
2828
/// log!(log::DEBUG, "this is a debug message");
@@ -51,7 +51,7 @@ macro_rules! log(
5151
///
5252
/// ```
5353
/// #![feature(phase)]
54-
/// #[phase(plugin, link)] extern crate log;
54+
/// #[phase(syntax, link)] extern crate log;
5555
///
5656
/// # fn main() {
5757
/// # let error = 3;
@@ -69,7 +69,7 @@ macro_rules! error(
6969
///
7070
/// ```
7171
/// #![feature(phase)]
72-
/// #[phase(plugin, link)] extern crate log;
72+
/// #[phase(syntax, link)] extern crate log;
7373
///
7474
/// # fn main() {
7575
/// # let code = 3;
@@ -87,7 +87,7 @@ macro_rules! warn(
8787
///
8888
/// ```
8989
/// #![feature(phase)]
90-
/// #[phase(plugin, link)] extern crate log;
90+
/// #[phase(syntax, link)] extern crate log;
9191
///
9292
/// # fn main() {
9393
/// # let ret = 3;
@@ -107,7 +107,7 @@ macro_rules! info(
107107
///
108108
/// ```
109109
/// #![feature(phase)]
110-
/// #[phase(plugin, link)] extern crate log;
110+
/// #[phase(syntax, link)] extern crate log;
111111
///
112112
/// # fn main() {
113113
/// debug!("x = {x}, y = {y}", x=10, y=20);
@@ -124,7 +124,7 @@ macro_rules! debug(
124124
///
125125
/// ```
126126
/// #![feature(phase)]
127-
/// #[phase(plugin, link)] extern crate log;
127+
/// #[phase(syntax, link)] extern crate log;
128128
///
129129
/// # fn main() {
130130
/// # struct Point { x: int, y: int }

branches/try2/src/librand/lib.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,13 @@
2828
#![no_std]
2929
#![experimental]
3030

31-
#[cfg(stage0)]
3231
#[phase(syntax, link)]
3332
extern crate core;
3433

35-
#[cfg(not(stage0))]
36-
#[phase(plugin, link)]
37-
extern crate core;
38-
39-
#[cfg(test, stage0)]
40-
#[phase(syntax, link)] extern crate std;
41-
42-
#[cfg(test, stage0)]
43-
#[phase(syntax, link)] extern crate log;
44-
45-
#[cfg(test, not(stage0))]
46-
#[phase(plugin, link)] extern crate std;
47-
48-
#[cfg(test, not(stage0))]
49-
#[phase(plugin, link)] extern crate log;
50-
5134
#[cfg(test)] extern crate native;
5235
#[cfg(test)] extern crate debug;
36+
#[cfg(test)] #[phase(syntax, link)] extern crate std;
37+
#[cfg(test)] #[phase(syntax, link)] extern crate log;
5338

5439
use core::prelude::*;
5540

0 commit comments

Comments
 (0)