Auto merge of #48523 - varkor:generics-ty-generalisations, r=nikomatsakis

The Great Generics Generalisation: Ty Edition

Part of the generic parameter refactoring effort, split off from https://github.com/rust-lang/rust/pull/48149. Contains the `ty`-relative refactoring.

r? @eddyb
This commit is contained in:
bors 2018-05-15 23:03:04 +00:00
commit e44fc6c52d
48 changed files with 985 additions and 825 deletions

View file

@ -117,11 +117,11 @@ impl<'a> fmt::Display for TyParamBounds<'a> {
}
}
impl fmt::Display for clean::GenericParam {
impl fmt::Display for clean::GenericParamDef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
clean::GenericParam::Lifetime(ref lp) => write!(f, "{}", lp),
clean::GenericParam::Type(ref tp) => {
clean::GenericParamDef::Lifetime(ref lp) => write!(f, "{}", lp),
clean::GenericParamDef::Type(ref tp) => {
f.write_str(&tp.name)?;
if !tp.bounds.is_empty() {

View file

@ -1453,8 +1453,11 @@ impl DocFolder for Cache {
impl<'a> Cache {
fn generics(&mut self, generics: &clean::Generics) {
for param in &generics.params {
if let clean::GenericParam::Type(ref typ) = *param {
self.typarams.insert(typ.did, typ.name.clone());
match *param {
clean::GenericParamDef::Type(ref typ) => {
self.typarams.insert(typ.did, typ.name.clone());
}
clean::GenericParamDef::Lifetime(_) => {}
}
}
}