diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 6c0e667d010f2..301ce2b6f14ed 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -1167,6 +1167,7 @@ fn document(config: &Config, props: &TestProps, testfile: &Path, extra_args: &[String]) -> (ProcRes, PathBuf) { let aux_dir = aux_output_dir_name(config, testfile); let out_dir = output_base_name(config, testfile); + let _ = fs::remove_dir_all(&out_dir); ensure_dir(&out_dir); let mut args = vec!["-L".to_string(), aux_dir.to_str().unwrap().to_string(), diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index a212e3a04357e..2acee8a97f59f 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -186,7 +186,8 @@ def concat_multi_lines(f): firstlineno = firstlineno or lineno if line.endswith('\\'): - lastline = line[:-1] + if lastline is None: + lastline = line[:-1] catenated += line[:-1] else: yield firstlineno, catenated + line diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index ff51e25fcbf25..10cd793a3d286 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -89,6 +89,7 @@ //! of unsafe pointers in Rust. #![stable(feature = "rust1", since = "1.0.0")] +#![doc(primitive = "pointer")] use mem; use clone::Clone; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 53824d088eeff..3248bb4d41d43 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1368,6 +1368,7 @@ pub enum PrimitiveType { Slice, Array, PrimitiveTuple, + PrimitiveRawPointer, } #[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)] @@ -1404,6 +1405,7 @@ impl PrimitiveType { "array" => Some(Array), "slice" => Some(Slice), "tuple" => Some(PrimitiveTuple), + "pointer" => Some(PrimitiveRawPointer), _ => None, } } @@ -1449,6 +1451,7 @@ impl PrimitiveType { Array => "array", Slice => "slice", PrimitiveTuple => "tuple", + PrimitiveRawPointer => "pointer", } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index ed37b973f787e..a52c996bdb7d4 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -491,7 +491,8 @@ impl fmt::Display for clean::Type { } clean::Bottom => f.write_str("!"), clean::RawPointer(m, ref t) => { - write!(f, "*{}{}", RawMutableSpace(m), **t) + primitive_link(f, clean::PrimitiveType::PrimitiveRawPointer, + &format!("*{}{}", RawMutableSpace(m), **t)) } clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => { let lt = match *l { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index da59ffd785a2d..40cc44d20eb1a 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1028,7 +1028,8 @@ impl DocFolder for Cache { clean::Item{ attrs, inner: clean::ImplItem(i), .. } => { use clean::{Primitive, Vector, ResolvedPath, BorrowedRef}; use clean::PrimitiveType::{Array, Slice, PrimitiveTuple}; - use clean::{FixedVector, Tuple}; + use clean::PrimitiveType::{PrimitiveRawPointer}; + use clean::{FixedVector, Tuple, RawPointer}; // extract relevant documentation for this impl let dox = match attrs.into_iter().find(|a| { @@ -1064,8 +1065,8 @@ impl DocFolder for Cache { Some(ast_util::local_def(Array.to_node_id())) } - // In a DST world, we may only need Vector, but for now we - // also pick up borrowed references + // In a DST world, we may only need Vector, but for + // now we also pick up borrowed references Vector(..) | BorrowedRef{ type_: box Vector(..), .. } => { @@ -1077,6 +1078,11 @@ impl DocFolder for Cache { Some(ast_util::local_def(id)) } + RawPointer(..) => { + let id = PrimitiveRawPointer.to_node_id(); + Some(ast_util::local_def(id)) + } + _ => None, }; diff --git a/src/test/auxiliary/issue-15318.rs b/src/test/auxiliary/issue-15318.rs new file mode 100644 index 0000000000000..9e42dbfbc6be4 --- /dev/null +++ b/src/test/auxiliary/issue-15318.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![doc(html_root_url = "http://example.com/")] + +/// dox +#[doc(primitive = "pointer")] +pub mod ptr {} diff --git a/src/test/rustdoc/issue-15318-2.rs b/src/test/rustdoc/issue-15318-2.rs new file mode 100644 index 0000000000000..29a8b4cea4c95 --- /dev/null +++ b/src/test/rustdoc/issue-15318-2.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-15318.rs + +extern crate issue_15318; + +pub use issue_15318::ptr; + +// @has issue_15318_2/fn.bar.html \ +// '//*[@href="primitive.pointer.html"]' \ +// '*mut T' +pub fn bar(ptr: *mut T) {} + diff --git a/src/test/rustdoc/issue-15318-3.rs b/src/test/rustdoc/issue-15318-3.rs new file mode 100644 index 0000000000000..a54824970c751 --- /dev/null +++ b/src/test/rustdoc/issue-15318-3.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// @has issue_15318_3/primitive.pointer.html + +/// dox +#[doc(primitive = "pointer")] +pub mod ptr {} diff --git a/src/test/rustdoc/issue-15318.rs b/src/test/rustdoc/issue-15318.rs new file mode 100644 index 0000000000000..86a0b1d72a350 --- /dev/null +++ b/src/test/rustdoc/issue-15318.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:issue-15318.rs + +#![feature(no_std)] +#![no_std] + +extern crate issue_15318; + +// @has issue_15318/fn.bar.html \ +// '//*[@href="http://example.com/issue_15318/primitive.pointer.html"]' \ +// '*mut T' +pub fn bar(ptr: *mut T) {}