Pass attributes to hir::TyParam
Required by https://github.com/servo/servo/pull/20264
Discussed here: https://gitter.im/servo/servo?at=
5aafdcd1012ff2bf681da97a
CC @nikomatsakis
}
}
- fn lower_attrs(&mut self, attrs: &Vec<Attribute>) -> hir::HirVec<Attribute> {
+ fn lower_attrs(&mut self, attrs: &[Attribute]) -> hir::HirVec<Attribute> {
attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>().into()
}
span,
pure_wrt_drop: false,
synthetic: Some(hir::SyntheticTyParamKind::ImplTrait),
+ attrs: P::new(),
});
hir::TyPath(hir::QPath::Resolved(None, P(hir::Path {
.filter(|attr| attr.check_name("rustc_synthetic"))
.map(|_| hir::SyntheticTyParamKind::ImplTrait)
.nth(0),
+ attrs: self.lower_attrs(&tp.attrs),
}
}
Some(NodeField(ref f)) => Some(&f.attrs[..]),
Some(NodeExpr(ref e)) => Some(&*e.attrs),
Some(NodeStmt(ref s)) => Some(s.node.attrs()),
+ Some(NodeTyParam(tp)) => Some(&tp.attrs[..]),
// unit/tuple structs take the attributes straight from
// the struct definition.
Some(NodeStructCtor(_)) => {
pub span: Span,
pub pure_wrt_drop: bool,
pub synthetic: Option<SyntheticTyParamKind>,
+ pub attrs: HirVec<Attribute>,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
default,
span,
pure_wrt_drop,
- synthetic
+ synthetic,
+ attrs
});
impl_stable_hash_for!(enum hir::GenericParam {