Fix invalid debug display for associated consts
This commit is contained in:
parent
0aeb9c1297
commit
5364acb418
3 changed files with 37 additions and 6 deletions
|
@ -2242,11 +2242,11 @@ pub enum PathParameters {
|
|||
AngleBracketed {
|
||||
lifetimes: Vec<Lifetime>,
|
||||
types: Vec<Type>,
|
||||
bindings: Vec<TypeBinding>
|
||||
bindings: Vec<TypeBinding>,
|
||||
},
|
||||
Parenthesized {
|
||||
inputs: Vec<Type>,
|
||||
output: Option<Type>
|
||||
output: Option<Type>,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2261,14 +2261,14 @@ impl Clean<PathParameters> 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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(())
|
||||
|
|
31
src/test/rustdoc/const-doc.rs
Normal file
31
src/test/rustdoc/const-doc.rs
Normal file
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<Foo<'static>>,
|
||||
}
|
||||
|
||||
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, };
|
||||
}
|
Loading…
Add table
Reference in a new issue