Skip to content

Commit 32a7fdc

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 152400 b: refs/heads/try2 c: aca0bac h: refs/heads/master v: v3
1 parent af1faa5 commit 32a7fdc

File tree

5 files changed

+25
-35
lines changed

5 files changed

+25
-35
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: ed41b71fbe69cc920a3a021ac4e96dc4d5cc488c
8+
refs/heads/try2: aca0bac29f7d7e86edfb5850cef1ab9b5e4797f2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

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

18201820
### Function-only attributes
18211821

1822-
- `macro_registrar` - when using loadable syntax extensions, mark this
1823-
function as the registration point for the current crate's syntax
1824-
extensions.
1822+
- `plugin_registrar` - mark this function as the registration point for
1823+
compiler plugins, such as loadable syntax extensions.
18251824
- `main` - indicates that this function should be passed to the entry point,
18261825
rather than the function in the crate root named `main`.
18271826
- `start` - indicates that this function should be used as the entry point,

branches/try2/src/libfourcc/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,25 @@ fn main() {
4848
html_root_url = "http://doc.rust-lang.org/")]
4949

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

5353
extern crate syntax;
54+
extern crate rustc;
5455

5556
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::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
60+
use syntax::ext::base::{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;
6566

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));
67+
#[plugin_registrar]
68+
pub fn plugin_registrar(reg: &mut Registry) {
69+
reg.register_macro("fourcc", expand_syntax_ext);
7470
}
7571

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

branches/try2/src/libhexfloat/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,23 @@ fn main() {
4545
html_root_url = "http://doc.rust-lang.org/")]
4646

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

5050
extern crate syntax;
51+
extern crate rustc;
5152

5253
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::{SyntaxExtension, BasicMacroExpander, NormalTT, ExtCtxt, MacExpr};
56+
use syntax::ext::base::{ExtCtxt, MacExpr};
5757
use syntax::ext::build::AstBuilder;
5858
use syntax::parse;
5959
use syntax::parse::token;
60+
use rustc::plugin::Registry;
6061

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));
62+
#[plugin_registrar]
63+
pub fn plugin_registrar(reg: &mut Registry) {
64+
reg.register_macro("hexfloat", expand_syntax_ext);
6965
}
7066

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

branches/try2/src/libregex_macros/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@
1919
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2020
html_root_url = "http://doc.rust-lang.org/")]
2121

22-
#![feature(macro_registrar, managed_boxes, quote)]
22+
#![feature(plugin_registrar, managed_boxes, quote)]
2323

2424
extern crate regex;
2525
extern crate syntax;
26+
extern crate rustc;
2627

2728
use std::rc::Rc;
2829

2930
use syntax::ast;
3031
use syntax::codemap;
3132
use syntax::ext::build::AstBuilder;
32-
use syntax::ext::base::{
33-
SyntaxExtension, ExtCtxt, MacResult, MacExpr, DummyResult,
34-
NormalTT, BasicMacroExpander,
35-
};
33+
use syntax::ext::base::{ExtCtxt, MacResult, MacExpr, DummyResult};
3634
use syntax::parse;
3735
use syntax::parse::token;
3836
use syntax::print::pprust;
3937

38+
use rustc::plugin::Registry;
39+
4040
use regex::Regex;
4141
use regex::native::{
4242
OneChar, CharClass, Any, Save, Jump, Split,
@@ -46,11 +46,10 @@ use regex::native::{
4646
};
4747

4848
/// For the `regex!` syntax extension. Do not use.
49-
#[macro_registrar]
49+
#[plugin_registrar]
5050
#[doc(hidden)]
51-
pub fn macro_registrar(register: |ast::Name, SyntaxExtension|) {
52-
let expander = box BasicMacroExpander { expander: native, span: None };
53-
register(token::intern("regex"), NormalTT(expander, None))
51+
pub fn plugin_registrar(reg: &mut Registry) {
52+
reg.register_macro("regex", native);
5453
}
5554

5655
/// Generates specialized code for the Pike VM for a particular regular

0 commit comments

Comments
 (0)