Skip to content

Commit 35d91a6

Browse files
brsonalexcrichton
authored andcommitted
---
yaml --- r: 132026 b: refs/heads/dist-snap c: c88bf10 h: refs/heads/master v: v3
1 parent 39aac31 commit 35d91a6

File tree

7 files changed

+31
-13
lines changed

7 files changed

+31
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 1c3655bed192e31bdf649ed5f4e728201ede17b2
9+
refs/heads/dist-snap: c88bf10c37d32f18774cfa3ef480eb77df294565
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ pub fn compile_input(sess: Session,
6969
cfg: ast::CrateConfig,
7070
input: &Input,
7171
outdir: &Option<Path>,
72-
output: &Option<Path>) {
72+
output: &Option<Path>,
73+
addl_plugins: Option<Plugins>) {
7374
// We need nested scopes here, because the intermediate results can keep
7475
// large chunks of memory alive and we want to free them as soon as
7576
// possible to keep the peak memory usage low
@@ -85,7 +86,8 @@ pub fn compile_input(sess: Session,
8586
let id = link::find_crate_name(Some(&sess), krate.attrs.as_slice(),
8687
input);
8788
let (expanded_crate, ast_map)
88-
= match phase_2_configure_and_expand(&sess, krate, id.as_slice()) {
89+
= match phase_2_configure_and_expand(&sess, krate, id.as_slice(),
90+
addl_plugins) {
8991
None => return,
9092
Some(p) => p,
9193
};
@@ -186,7 +188,8 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
186188
/// Returns `None` if we're aborting after handling -W help.
187189
pub fn phase_2_configure_and_expand(sess: &Session,
188190
mut krate: ast::Crate,
189-
crate_name: &str)
191+
crate_name: &str,
192+
addl_plugins: Option<Plugins>)
190193
-> Option<(ast::Crate, syntax::ast_map::Map)> {
191194
let time_passes = sess.time_passes();
192195

@@ -212,9 +215,10 @@ pub fn phase_2_configure_and_expand(sess: &Session,
212215
krate = time(time_passes, "configuration 1", krate, |krate|
213216
front::config::strip_unconfigured_items(krate));
214217

218+
let mut addl_plugins = Some(addl_plugins);
215219
let Plugins { macros, registrars }
216220
= time(time_passes, "plugin loading", (), |_|
217-
plugin::load::load_plugins(sess, &krate));
221+
plugin::load::load_plugins(sess, &krate, addl_plugins.take_unwrap()));
218222

219223
let mut registry = Registry::new(&krate);
220224

@@ -697,7 +701,7 @@ pub fn pretty_print_input(sess: Session,
697701
PpmExpanded | PpmExpandedIdentified | PpmTyped | PpmFlowGraph(_) => {
698702
let (krate, ast_map)
699703
= match phase_2_configure_and_expand(&sess, krate,
700-
id.as_slice()) {
704+
id.as_slice(), None) {
701705
None => return,
702706
Some(p) => p,
703707
};

branches/dist-snap/src/librustc/driver/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn run_compiler(args: &[String]) {
124124
return;
125125
}
126126

127-
driver::compile_input(sess, cfg, &input, &odir, &ofile);
127+
driver::compile_input(sess, cfg, &input, &odir, &ofile, None);
128128
}
129129

130130
/// Prints version information and returns None on success or an error

branches/dist-snap/src/librustc/middle/typeck/infer/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn test_env(_test_name: &str,
117117
let input = driver::StrInput(source_string.to_string());
118118
let krate = driver::phase_1_parse_input(&sess, krate_config, &input);
119119
let (krate, ast_map) =
120-
driver::phase_2_configure_and_expand(&sess, krate, "test")
120+
driver::phase_2_configure_and_expand(&sess, krate, "test", None)
121121
.expect("phase 2 aborted");
122122

123123
// run just enough stuff to build a tcx:

branches/dist-snap/src/librustc/plugin/load.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,24 @@ impl<'a> PluginLoader<'a> {
6666
}
6767

6868
/// Read plugin metadata and dynamically load registrar functions.
69-
pub fn load_plugins(sess: &Session, krate: &ast::Crate) -> Plugins {
69+
pub fn load_plugins(sess: &Session, krate: &ast::Crate,
70+
addl_plugins: Option<Plugins>) -> Plugins {
7071
let mut loader = PluginLoader::new(sess);
7172
visit::walk_crate(&mut loader, krate, ());
72-
loader.plugins
73+
74+
let mut plugins = loader.plugins;
75+
76+
match addl_plugins {
77+
Some(addl_plugins) => {
78+
// Add in the additional plugins requested by the frontend
79+
let Plugins { macros: addl_macros, registrars: addl_registrars } = addl_plugins;
80+
plugins.macros.push_all_move(addl_macros);
81+
plugins.registrars.push_all_move(addl_registrars);
82+
}
83+
None => ()
84+
}
85+
86+
return plugins;
7387
}
7488

7589
// note that macros aren't expanded yet, and therefore macros can't add plugins.

branches/dist-snap/src/librustdoc/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>)
121121
&input);
122122

123123
let (krate, ast_map)
124-
= phase_2_configure_and_expand(&sess, krate, name.as_slice())
124+
= phase_2_configure_and_expand(&sess, krate, name.as_slice(), None)
125125
.expect("phase_2_configure_and_expand aborted in rustdoc!");
126126

127127
let driver::driver::CrateAnalysis {

branches/dist-snap/src/librustdoc/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub fn run(input: &str,
6969
}));
7070
let krate = driver::phase_1_parse_input(&sess, cfg, &input);
7171
let (krate, _) = driver::phase_2_configure_and_expand(&sess, krate,
72-
"rustdoc-test")
72+
"rustdoc-test", None)
7373
.expect("phase_2_configure_and_expand aborted in rustdoc!");
7474

7575
let ctx = box(GC) core::DocContext {
@@ -166,7 +166,7 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
166166
let out = Some(outdir.path().clone());
167167
let cfg = config::build_configuration(&sess);
168168
let libdir = sess.target_filesearch().get_lib_path();
169-
driver::compile_input(sess, cfg, &input, &out, &None);
169+
driver::compile_input(sess, cfg, &input, &out, &None, None);
170170

171171
if no_run { return }
172172

0 commit comments

Comments
 (0)