Added From<Ident> for TyParam
@@ -93,6 +93,7 @@ impl LifetimeDef {
}
}
+/// A generic type parameter, e.g. `T: Into<String>`.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct TyParam {
pub attrs: Vec<Attribute>,
@@ -101,6 +102,17 @@ pub struct TyParam {
pub default: Option<Ty>,
}
+impl From<Ident> for TyParam {
+ fn from(ident: Ident) -> Self {
+ TyParam {
+ attrs: vec![],
+ ident: ident,
+ bounds: vec![],
+ default: None,
+ }
+ }
+}
+
/// The AST represents all type param bounds as types.
/// `typeck::collect::compute_bounds` matches these against
/// the "special" built-in traits (see `middle::lang_items`) and
