Skip to content

Commit 55fc374

Browse files
committed
Blanket rename rustc-macro to proc-macro
1 parent d3bad1a commit 55fc374

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

src/cargo/core/manifest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub enum LibKind {
6161
Lib,
6262
Rlib,
6363
Dylib,
64-
RustcMacro,
64+
ProcMacro,
6565
Other(String),
6666
}
6767

@@ -71,7 +71,7 @@ impl LibKind {
7171
"lib" => LibKind::Lib,
7272
"rlib" => LibKind::Rlib,
7373
"dylib" => LibKind::Dylib,
74-
"rustc-macro" => LibKind::RustcMacro,
74+
"procc-macro" => LibKind::ProcMacro,
7575
s => LibKind::Other(s.to_string()),
7676
}
7777
}
@@ -82,7 +82,7 @@ impl LibKind {
8282
LibKind::Lib => "lib",
8383
LibKind::Rlib => "rlib",
8484
LibKind::Dylib => "dylib",
85-
LibKind::RustcMacro => "rustc-macro",
85+
LibKind::ProcMacro => "proc-macro",
8686
LibKind::Other(ref s) => s,
8787
}
8888
}
@@ -92,7 +92,7 @@ impl LibKind {
9292
LibKind::Lib |
9393
LibKind::Rlib |
9494
LibKind::Dylib |
95-
LibKind::RustcMacro => true,
95+
LibKind::ProcMacro => true,
9696
LibKind::Other(..) => false,
9797
}
9898
}

src/cargo/util/toml.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ struct TomlTarget {
905905
bench: Option<bool>,
906906
doc: Option<bool>,
907907
plugin: Option<bool>,
908-
rustc_macro: Option<bool>,
908+
proc_macro: Option<bool>,
909909
harness: Option<bool>,
910910
}
911911

@@ -934,7 +934,7 @@ impl TomlTarget {
934934
bench: None,
935935
doc: None,
936936
plugin: None,
937-
rustc_macro: None,
937+
proc_macro: None,
938938
harness: None,
939939
}
940940
}
@@ -1017,15 +1017,15 @@ impl TomlTarget {
10171017
fn validate_crate_type(&self) -> CargoResult<()> {
10181018
// Per the Macros 1.1 RFC:
10191019
//
1020-
// > Initially if a crate is compiled with the rustc-macro crate type
1020+
// > Initially if a crate is compiled with the proc-macro crate type
10211021
// > (and possibly others) it will forbid exporting any items in the
1022-
// > crate other than those functions tagged #[rustc_macro_derive] and
1022+
// > crate other than those functions tagged #[proc_macro_derive] and
10231023
// > those functions must also be placed at the crate root.
10241024
//
10251025
// A plugin requires exporting plugin_registrar so a crate cannot be
10261026
// both at once.
1027-
if self.plugin == Some(true) && self.rustc_macro == Some(true) {
1028-
Err(human("lib.plugin and lib.rustc-macro cannot both be true".to_string()))
1027+
if self.plugin == Some(true) && self.proc_macro == Some(true) {
1028+
Err(human("lib.plugin and lib.proc-macro cannot both be true".to_string()))
10291029
} else {
10301030
Ok(())
10311031
}
@@ -1064,7 +1064,7 @@ fn normalize(lib: &Option<TomlLibTarget>,
10641064
.set_doctest(toml.doctest.unwrap_or(t2.doctested()))
10651065
.set_benched(toml.bench.unwrap_or(t2.benched()))
10661066
.set_harness(toml.harness.unwrap_or(t2.harness()))
1067-
.set_for_host(match (toml.plugin, toml.rustc_macro) {
1067+
.set_for_host(match (toml.plugin, toml.proc_macro) {
10681068
(None, None) => t2.for_host(),
10691069
(Some(true), _) | (_, Some(true)) => true,
10701070
(Some(false), _) | (_, Some(false)) => false,
@@ -1081,7 +1081,7 @@ fn normalize(lib: &Option<TomlLibTarget>,
10811081
Some(kinds) => kinds.iter().map(|s| LibKind::from_str(s)).collect(),
10821082
None => {
10831083
vec![ if l.plugin == Some(true) {LibKind::Dylib}
1084-
else if l.rustc_macro == Some(true) {LibKind::RustcMacro}
1084+
else if l.proc_macro == Some(true) {LibKind::ProcMacro}
10851085
else {LibKind::Lib} ]
10861086
}
10871087
};

src/doc/manifest.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ plugin = false
512512

513513
# If the target is meant to be a "macros 1.1" procedural macro, this field must
514514
# be set to true.
515-
rustc-macro = false
515+
proc-macro = false
516516

517517
# If set to false, `cargo test` will omit the `--test` flag to rustc, which
518518
# stops it from generating a test harness. This is useful when the binary being
@@ -534,11 +534,11 @@ crate-type = ["dylib"] # could be `staticlib` as well
534534
```
535535

536536
The available options are `dylib`, `rlib`, `staticlib`, `cdylib`, and
537-
`rustc-macro`. You should only use this option in a project. Cargo will always
537+
`proc-macro`. You should only use this option in a project. Cargo will always
538538
compile packages (dependencies) based on the requirements of the project that
539539
includes them.
540540

541-
You can read more about the different crate types in the
541+
You can read more about the different crate types in the
542542
[Rust Reference Manual](https://doc.rust-lang.org/reference.html#linkage)
543543

544544
# The `[replace]` Section
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn noop() {
2323
path = "../noop"
2424
"#)
2525
.file("src/main.rs", r#"
26-
#![feature(rustc_macro)]
26+
#![feature(proc_macro)]
2727
2828
#[macro_use]
2929
extern crate noop;
@@ -41,15 +41,15 @@ fn noop() {
4141
authors = []
4242
4343
[lib]
44-
rustc-macro = true
44+
proc-macro = true
4545
"#)
4646
.file("src/lib.rs", r#"
47-
#![feature(rustc_macro, rustc_macro_lib)]
47+
#![feature(proc_macro, proc_macro_lib)]
4848
49-
extern crate rustc_macro;
50-
use rustc_macro::TokenStream;
49+
extern crate proc_macro;
50+
use proc_macro::TokenStream;
5151
52-
#[rustc_macro_derive(Noop)]
52+
#[proc_macro_derive(Noop)]
5353
pub fn noop(input: TokenStream) -> TokenStream {
5454
input
5555
}
@@ -80,7 +80,7 @@ fn impl_and_derive() {
8080
path = "../transmogrify"
8181
"#)
8282
.file("src/main.rs", r#"
83-
#![feature(rustc_macro)]
83+
#![feature(proc_macro)]
8484
8585
#[macro_use]
8686
extern crate transmogrify;
@@ -106,15 +106,15 @@ fn impl_and_derive() {
106106
authors = []
107107
108108
[lib]
109-
rustc-macro = true
109+
proc-macro = true
110110
"#)
111111
.file("src/lib.rs", r#"
112-
#![feature(rustc_macro, rustc_macro_lib)]
112+
#![feature(proc_macro, proc_macro_lib)]
113113
114-
extern crate rustc_macro;
115-
use rustc_macro::TokenStream;
114+
extern crate proc_macro;
115+
use proc_macro::TokenStream;
116116
117-
#[rustc_macro_derive(Transmogrify)]
117+
#[proc_macro_derive(Transmogrify)]
118118
#[doc(hidden)]
119119
pub fn transmogrify(input: TokenStream) -> TokenStream {
120120
assert_eq!(input.to_string(), "struct X;\n");
@@ -149,7 +149,7 @@ fn impl_and_derive() {
149149

150150
#[test]
151151
#[ignore]
152-
fn plugin_and_rustc_macro() {
152+
fn plugin_and_proc_macro() {
153153
if !is_nightly() {
154154
return;
155155
}
@@ -163,28 +163,28 @@ fn plugin_and_rustc_macro() {
163163
164164
[lib]
165165
plugin = true
166-
rustc-macro = true
166+
proc-macro = true
167167
"#)
168168
.file("src/lib.rs", r#"
169169
#![feature(plugin_registrar, rustc_private)]
170-
#![feature(rustc_macro, rustc_macro_lib)]
170+
#![feature(proc_macro, proc_macro_lib)]
171171
172172
extern crate rustc_plugin;
173173
use rustc_plugin::Registry;
174174
175-
extern crate rustc_macro;
176-
use rustc_macro::TokenStream;
175+
extern crate proc_macro;
176+
use proc_macro::TokenStream;
177177
178178
#[plugin_registrar]
179179
pub fn plugin_registrar(reg: &mut Registry) {}
180180
181-
#[rustc_macro_derive(Questionable)]
181+
#[proc_macro_derive(Questionable)]
182182
pub fn questionable(input: TokenStream) -> TokenStream {
183183
input
184184
}
185185
"#);
186186

187-
let msg = " lib.plugin and lib.rustc-macro cannot both be true";
187+
let msg = " lib.plugin and lib.proc-macro cannot both be true";
188188
assert_that(questionable.cargo_process("build"),
189189
execs().with_status(101).with_stderr_contains(msg));
190190
}

0 commit comments

Comments
 (0)