Skip to content

Commit e54566c

Browse files
committed
---
yaml --- r: 174745 b: refs/heads/snap-stage3 c: e930aeb h: refs/heads/master i: 174743: 85dbc6e v: v3
1 parent 2faea0e commit e54566c

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: a0f86de49748b472d4d189d9688b0d856c000914
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: aaf595eab9e57c7c2f301fb0e4054a03df23324d
4+
refs/heads/snap-stage3: e930aeb32b82181e3941c1c9f149057ac3a56537
55
refs/heads/try: 08f6380a9f0b866796080094f44fe25ea5636547
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustdoc/clean/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use rustc::middle::def;
4545
use rustc::middle::subst::{self, ParamSpace, VecPerParamSpace};
4646
use rustc::middle::ty;
4747
use rustc::middle::stability;
48-
use rustc::session::config;
4948

5049
use std::rc::Rc;
5150
use std::u32;
@@ -127,15 +126,17 @@ pub struct Crate {
127126

128127
impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
129128
fn clean(&self, cx: &DocContext) -> Crate {
129+
use rustc::session::config::Input;
130+
130131
let mut externs = Vec::new();
131132
cx.sess().cstore.iter_crate_data(|n, meta| {
132133
externs.push((n, meta.clean(cx)));
133134
});
134135
externs.sort_by(|&(a, _), &(b, _)| a.cmp(&b));
135136

136137
// Figure out the name of this crate
137-
let input = config::Input::File(cx.src.clone());
138-
let name = link::find_crate_name(None, self.attrs.as_slice(), &input);
138+
let input = &cx.input;
139+
let name = link::find_crate_name(None, self.attrs.as_slice(), input);
139140

140141
// Clean the crate, translating the entire libsyntax AST to one that is
141142
// understood by rustdoc.
@@ -188,9 +189,14 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
188189
m.items.extend(tmp.into_iter());
189190
}
190191

192+
let src = match cx.input {
193+
Input::File(ref path) => path.clone(),
194+
Input::Str(_) => FsPath::new("") // FIXME: this is wrong
195+
};
196+
191197
Crate {
192198
name: name.to_string(),
193-
src: cx.src.clone(),
199+
src: src,
194200
module: Some(module),
195201
externs: externs,
196202
primitives: primitives,

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub use self::MaybeTyped::*;
1111

1212
use rustc_driver::driver;
1313
use rustc::session::{self, config};
14-
use rustc::session::config::UnstableFeatures;
14+
use rustc::session::config::{Input, UnstableFeatures};
1515
use rustc::session::search_paths::SearchPaths;
1616
use rustc::middle::{privacy, ty};
1717
use rustc::lint;
@@ -39,7 +39,7 @@ pub type ExternalPaths = RefCell<Option<HashMap<ast::DefId,
3939
pub struct DocContext<'tcx> {
4040
pub krate: &'tcx ast::Crate,
4141
pub maybe_typed: MaybeTyped<'tcx>,
42-
pub src: Path,
42+
pub input: Input,
4343
pub external_paths: ExternalPaths,
4444
pub external_traits: RefCell<Option<HashMap<ast::DefId, clean::Trait>>>,
4545
pub external_typarams: RefCell<Option<HashMap<ast::DefId, String>>>,
@@ -80,12 +80,15 @@ pub struct CrateAnalysis {
8080
pub type Externs = HashMap<String, Vec<String>>;
8181

8282
pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
83-
cpath: &Path, triple: Option<String>)
83+
input: Input, triple: Option<String>)
8484
-> (clean::Crate, CrateAnalysis) {
8585

8686
// Parse, resolve, and typecheck the given crate.
8787

88-
let input = config::Input::File(cpath.clone());
88+
let cpath = match input {
89+
Input::File(ref p) => Some(p.clone()),
90+
_ => None
91+
};
8992

9093
let warning_lint = lint::builtin::WARNINGS.name_lower();
9194

@@ -107,8 +110,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
107110
let span_diagnostic_handler =
108111
diagnostic::mk_span_handler(diagnostic_handler, codemap);
109112

110-
let sess = session::build_session_(sessopts,
111-
Some(cpath.clone()),
113+
let sess = session::build_session_(sessopts, cpath,
112114
span_diagnostic_handler);
113115

114116
let cfg = config::build_configuration(&sess);
@@ -136,7 +138,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
136138
let ctxt = DocContext {
137139
krate: ty_cx.map.krate(),
138140
maybe_typed: Typed(ty_cx),
139-
src: cpath.clone(),
141+
input: input,
140142
external_traits: RefCell::new(Some(HashMap::new())),
141143
external_typarams: RefCell::new(Some(HashMap::new())),
142144
external_paths: RefCell::new(Some(HashMap::new())),

branches/snap-stage3/src/librustdoc/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
350350
info!("starting to run rustc");
351351

352352
let (mut krate, analysis) = std::thread::Thread::scoped(move |:| {
353+
use rustc::session::config::Input;
354+
353355
let cr = cr;
354-
core::run_core(paths, cfgs, externs, &cr, triple)
356+
core::run_core(paths, cfgs, externs, Input::File(cr), triple)
355357
}).join().map_err(|_| "rustc failed").unwrap();
356358
info!("finished with rustc");
357359
let mut analysis = Some(analysis);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn run(input: &str,
7979
let ctx = core::DocContext {
8080
krate: &krate,
8181
maybe_typed: core::NotTyped(sess),
82-
src: input_path,
82+
input: input,
8383
external_paths: RefCell::new(Some(HashMap::new())),
8484
external_traits: RefCell::new(None),
8585
external_typarams: RefCell::new(None),

0 commit comments

Comments
 (0)