]> git.lizzy.rs Git - rust.git/commitdiff
Pass attributes to hir::TyParam
authorMrowqa <artur.jamro@gmail.com>
Tue, 20 Mar 2018 21:12:31 +0000 (22:12 +0100)
committerMrowqa <artur.jamro@gmail.com>
Tue, 20 Mar 2018 21:12:31 +0000 (22:12 +0100)
src/librustc/hir/lowering.rs
src/librustc/hir/map/mod.rs
src/librustc/hir/mod.rs

index 1439410f7e9aa2ac025f2d23b92363cc77a1f9ff..a35af56bd97b16569341651cd67a039901f3fa15 100644 (file)
@@ -1585,6 +1585,7 @@ fn lower_ty_param(&mut self, tp: &TyParam, add_bounds: &[TyParamBound]) -> hir::
                                .filter(|attr| attr.check_name("rustc_synthetic"))
                                .map(|_| hir::SyntheticTyParamKind::ImplTrait)
                                .nth(0),
+            attrs: self.lower_attrs(&tp.attrs),
         }
     }
 
index 61fae4609d54fe7813b76857c5baa5fb6e48ed09..e8bcbfbb77a1791cb03d6d65352566accc740c8a 100644 (file)
@@ -962,6 +962,7 @@ pub fn attrs(&self, id: NodeId) -> &'hir [ast::Attribute] {
             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(_)) => {
index 5ae84f5685eafca61a09c0716dd2de7ff76d7a56..d6810b2468bccbed8dc1d332e42847db7b3da388 100644 (file)
@@ -414,6 +414,7 @@ pub struct TyParam {
     pub span: Span,
     pub pure_wrt_drop: bool,
     pub synthetic: Option<SyntheticTyParamKind>,
+    pub attrs: HirVec<Attribute>,
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]