Skip to content

Commit 78b350f

Browse files
committed
---
yaml --- r: 151357 b: refs/heads/try2 c: 50fb77f h: refs/heads/master i: 151355: f201e4c v: v3
1 parent b436021 commit 78b350f

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
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: 5d145c1c18abb1a6b81238dd1b73178635c12f0a
8+
refs/heads/try2: 50fb77f8baed29bb1014893c8a1f3e66cbd8e3e1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustdoc/clean.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use syntax::codemap::Pos;
2020
use syntax::parse::token::InternedString;
2121
use syntax::parse::token;
2222

23+
use rustc::back::link;
24+
use rustc::driver::driver;
2325
use rustc::metadata::cstore;
2426
use rustc::metadata::csearch;
2527
use rustc::metadata::decoder;
@@ -75,19 +77,23 @@ pub struct Crate {
7577

7678
impl<'a> Clean<Crate> for visit_ast::RustdocVisitor<'a> {
7779
fn clean(&self) -> Crate {
78-
use syntax::attr::find_crateid;
7980
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
8081

8182
let mut externs = Vec::new();
8283
cx.sess().cstore.iter_crate_data(|n, meta| {
8384
externs.push((n, meta.clean()));
8485
});
8586

87+
let input = driver::FileInput(cx.src.clone());
88+
let t_outputs = driver::build_output_filenames(&input,
89+
&None,
90+
&None,
91+
self.attrs.as_slice(),
92+
cx.sess());
93+
let id = link::find_crate_id(self.attrs.as_slice(),
94+
t_outputs.out_filestem);
8695
Crate {
87-
name: match find_crateid(self.attrs.as_slice()) {
88-
Some(n) => n.name,
89-
None => fail!("rustdoc requires a `crate_id` crate attribute"),
90-
},
96+
name: id.name,
9197
module: Some(self.module.clean()),
9298
externs: externs,
9399
}

branches/try2/src/librustdoc/core.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pub enum MaybeTyped {
3434

3535
pub struct DocContext {
3636
pub krate: ast::Crate,
37-
pub maybe_typed: MaybeTyped
37+
pub maybe_typed: MaybeTyped,
38+
pub src: Path,
3839
}
3940

4041
impl DocContext {
@@ -96,7 +97,8 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<~str>)
9697
debug!("crate: {:?}", krate);
9798
(DocContext {
9899
krate: krate,
99-
maybe_typed: Typed(ty_cx)
100+
maybe_typed: Typed(ty_cx),
101+
src: cpath.clone(),
100102
}, CrateAnalysis {
101103
exported_items: exported_items,
102104
public_items: public_items,

branches/try2/src/librustdoc/test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn run(input: &str, cfgs: Vec<~str>,
5555
diagnostic::mk_span_handler(diagnostic_handler, codemap);
5656

5757
let sess = driver::build_session_(sessopts,
58-
Some(input_path),
58+
Some(input_path.clone()),
5959
span_diagnostic_handler);
6060

6161
let mut cfg = driver::build_configuration(&sess);
@@ -70,6 +70,7 @@ pub fn run(input: &str, cfgs: Vec<~str>,
7070
let ctx = @core::DocContext {
7171
krate: krate,
7272
maybe_typed: core::NotTyped(sess),
73+
src: input_path,
7374
};
7475
local_data::set(super::ctxtkey, ctx);
7576

0 commit comments

Comments
 (0)