|
6 | 6 | use std::cell::Cell;
|
7 | 7 |
|
8 | 8 | use crate::abi::{FnAbi, Layout, LayoutShape};
|
| 9 | +use crate::crate_def::Attribute; |
9 | 10 | use crate::mir::alloc::{AllocId, GlobalAlloc};
|
10 | 11 | use crate::mir::mono::{Instance, InstanceDef, StaticDef};
|
11 | 12 | use crate::mir::{BinOp, Body, Place, UnOp};
|
12 | 13 | use crate::target::MachineInfo;
|
13 | 14 | use crate::ty::{
|
14 |
| - AdtDef, AdtKind, Allocation, Attribute, ClosureDef, ClosureKind, FieldDef, FnDef, ForeignDef, |
| 15 | + AdtDef, AdtKind, Allocation, ClosureDef, ClosureKind, FieldDef, FnDef, ForeignDef, |
15 | 16 | ForeignItemKind, ForeignModule, ForeignModuleDef, GenericArgs, GenericPredicates, Generics,
|
16 | 17 | ImplDef, ImplTrait, IntrinsicDef, LineInfo, MirConst, PolyFnSig, RigidTy, Span, TraitDecl,
|
17 | 18 | TraitDef, Ty, TyConst, TyConstId, TyKind, UintTy, VariantDef,
|
@@ -55,9 +56,15 @@ pub trait Context {
|
55 | 56 | /// Returns the name of given `DefId`
|
56 | 57 | fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol;
|
57 | 58 |
|
58 |
| - /// Get all attributes with the given attribute name. |
| 59 | + /// Return attributes with the given attribute name. |
| 60 | + /// |
| 61 | + /// Single segmented name like `#[inline]` is specified as `&["inline".to_string()]`. |
| 62 | + /// Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`. |
59 | 63 | fn get_attrs_by_path(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute>;
|
60 | 64 |
|
| 65 | + /// Get all attributes of a definition. |
| 66 | + fn get_all_attrs(&self, def_id: DefId) -> Vec<Attribute>; |
| 67 | + |
61 | 68 | /// Returns printable, human readable form of `Span`
|
62 | 69 | fn span_to_string(&self, span: Span) -> String;
|
63 | 70 |
|
|
0 commit comments