Skip to content

Commit cc9d3f4

Browse files
committed
---
yaml --- r: 275206 b: refs/heads/stable c: cf76fcf h: refs/heads/master
1 parent 3cfaa7f commit cc9d3f4

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 27ca2507defe13c5c989a9aa64d138645a7db65e
32+
refs/heads/stable: cf76fcf30d1efefd01bba0ed9b81cd867262346f
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustdoc/clean/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ use std::collections::HashMap;
4848
use std::path::PathBuf;
4949
use std::rc::Rc;
5050
use std::u32;
51+
use std::env::current_dir;
5152

5253
use core::DocContext;
5354
use doctree;
@@ -201,7 +202,13 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
201202
}
202203

203204
let src = match cx.input {
204-
Input::File(ref path) => path.clone(),
205+
Input::File(ref path) => {
206+
if path.is_absolute() {
207+
path.clone()
208+
} else {
209+
current_dir().unwrap().join(path)
210+
}
211+
},
205212
Input::Str(_) => PathBuf::new() // FIXME: this is wrong
206213
};
207214

branches/stable/src/librustdoc/html/render.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use std::io::prelude::*;
4646
use std::io::{self, BufWriter, BufReader};
4747
use std::iter::repeat;
4848
use std::mem;
49-
use std::path::{PathBuf, Path};
49+
use std::path::{PathBuf, Path, Component};
5050
use std::str;
5151
use std::sync::Arc;
5252

@@ -810,16 +810,17 @@ fn clean_srcpath<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F) wh
810810
// make it relative, if possible
811811
let p = p.strip_prefix(src_root).unwrap_or(p);
812812

813-
let mut iter = p.iter().map(|x| x.to_str().unwrap()).peekable();
813+
let mut iter = p.components().peekable();
814+
814815
while let Some(c) = iter.next() {
815816
if !keep_filename && iter.peek().is_none() {
816817
break;
817818
}
818819

819-
if ".." == c {
820-
f("up");
821-
} else {
822-
f(c)
820+
match c {
821+
Component::ParentDir => f("up"),
822+
Component::Normal(c) => f(c.to_str().unwrap()),
823+
_ => continue,
823824
}
824825
}
825826
}
@@ -871,7 +872,7 @@ impl<'a> DocFolder for SourceCollector<'a> {
871872
// entire crate. The other option is maintaining this mapping on a
872873
// per-file basis, but that's probably not worth it...
873874
self.cx
874-
.include_sources = match self.emit_source(&item.source .filename) {
875+
.include_sources = match self.emit_source(&item.source.filename) {
875876
Ok(()) => true,
876877
Err(e) => {
877878
println!("warning: source code was requested to be rendered, \
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-windows
12+
// compile-flags: --no-defaults
13+
14+
// @has src/issue_26995/dev/null.html
15+
// @has issue_26995/null/index.html '//a/@href' '../../src/issue_26995/dev/null.html'
16+
#[path="/dev/null"]
17+
pub mod null;

0 commit comments

Comments
 (0)