aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-06-01 20:33:14 +0100
committerJonas Schievink <[email protected]>2021-06-01 20:34:08 +0100
commit955064b6aaa5c24e980328f9d9fbe731cc29636c (patch)
tree533c9942faa54bb7859c0fb986c5699847c7cea2 /crates/hir_def/src
parentdbdfeeeff91b5e42d8687df09dda1d29f99b34f8 (diff)
Implement `#[rustc_skip_array_during_method_dispatch]`
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/data.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs
index d2bb381be..2f06a6e29 100644
--- a/crates/hir_def/src/data.rs
+++ b/crates/hir_def/src/data.rs
@@ -143,6 +143,7 @@ pub struct TraitData {
143 pub is_auto: bool, 143 pub is_auto: bool,
144 pub is_unsafe: bool, 144 pub is_unsafe: bool,
145 pub visibility: RawVisibility, 145 pub visibility: RawVisibility,
146 pub skip_array_during_method_dispatch: bool,
146} 147}
147 148
148impl TraitData { 149impl TraitData {
@@ -157,6 +158,10 @@ impl TraitData {
157 let container = AssocContainerId::TraitId(tr); 158 let container = AssocContainerId::TraitId(tr);
158 let visibility = item_tree[tr_def.visibility].clone(); 159 let visibility = item_tree[tr_def.visibility].clone();
159 let mut expander = Expander::new(db, tr_loc.id.file_id(), module_id); 160 let mut expander = Expander::new(db, tr_loc.id.file_id(), module_id);
161 let skip_array_during_method_dispatch = item_tree
162 .attrs(db, tr_loc.container.krate(), ModItem::from(tr_loc.id.value).into())
163 .by_key("rustc_skip_array_during_method_dispatch")
164 .exists();
160 165
161 let items = collect_items( 166 let items = collect_items(
162 db, 167 db,
@@ -168,7 +173,14 @@ impl TraitData {
168 100, 173 100,
169 ); 174 );
170 175
171 Arc::new(TraitData { name, items, is_auto, is_unsafe, visibility }) 176 Arc::new(TraitData {
177 name,
178 items,
179 is_auto,
180 is_unsafe,
181 visibility,
182 skip_array_during_method_dispatch,
183 })
172 } 184 }
173 185
174 pub fn associated_types(&self) -> impl Iterator<Item = TypeAliasId> + '_ { 186 pub fn associated_types(&self) -> impl Iterator<Item = TypeAliasId> + '_ {