diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 1294296840ebd..60245b5b39302 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2242,11 +2242,11 @@ pub enum PathParameters { AngleBracketed { lifetimes: Vec, types: Vec, - bindings: Vec + bindings: Vec, }, Parenthesized { inputs: Vec, - output: Option + output: Option, } } @@ -2261,14 +2261,14 @@ impl Clean for hir::PathParameters { data.lifetimes.clean(cx) }, types: data.types.clean(cx), - bindings: data.bindings.clean(cx) + bindings: data.bindings.clean(cx), } } hir::ParenthesizedParameters(ref data) => { PathParameters::Parenthesized { inputs: data.inputs.clean(cx), - output: data.output.clean(cx) + output: data.output.clean(cx), } } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index fc5507d4d5559..a255ba0ad4edf 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -481,7 +481,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, if is_not_debug { write!(w, "{:#}{:#}", HRef::new(did, &last.name), last.params)?; } else { - write!(w, "{:?}{:?}", HRef::new(did, &last.name), last.params)?; + write!(w, "{:?}{}", HRef::new(did, &last.name), last.params)?; } } else { if is_not_debug { @@ -507,7 +507,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, } else { format!("{:?}", HRef::new(did, &last.name)) }; - write!(w, "{}{:?}", path, last.params)?; + write!(w, "{}{}", path, last.params)?; } } Ok(()) diff --git a/src/test/rustdoc/const-doc.rs b/src/test/rustdoc/const-doc.rs new file mode 100644 index 0000000000000..9f70fe43175b9 --- /dev/null +++ b/src/test/rustdoc/const-doc.rs @@ -0,0 +1,31 @@ +// Copyright 2017 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. + +#![feature(associated_consts)] + +use std::marker::PhantomData; + +pub struct Foo<'a> { + f: PhantomData<&'a u32>, +} + +pub struct ContentType { + pub ttype: Foo<'static>, + pub subtype: Foo<'static>, + pub params: Option>, +} + +impl ContentType { + // @has const_doc/struct.ContentType.html + // @has - '//*[@class="docblock"]' 'Any: ContentType = ContentType{ttype: Foo{f: ' + pub const Any: ContentType = ContentType { ttype: Foo { f: PhantomData, }, + subtype: Foo { f: PhantomData, }, + params: None, }; +}