Support const generics in derive

Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
varkor
2019-02-05 16:50:00 +01:00
parent 0a8d98a270
commit d7695abb76
3 changed files with 34 additions and 2 deletions

View File

@@ -560,6 +560,7 @@ impl<'a> TraitDef<'a> {
cx.typaram(self.span, param.ident, vec![], bounds, None)
}
GenericParamKind::Const { .. } => param.clone(),
}));
// and similarly for where clauses
@@ -657,6 +658,9 @@ impl<'a> TraitDef<'a> {
GenericParamKind::Type { .. } => {
GenericArg::Type(cx.ty_ident(self.span, param.ident))
}
GenericParamKind::Const { .. } => {
GenericArg::Const(cx.const_ident(self.span, param.ident))
}
}).collect();
// Create the type of `self`.