Lines Matching full:used
1 //! Discover which template type parameters are actually used.
39 //! Given that we have to properly track which template parameters ended up used
44 //! ### How do we determine which template parameters are used?
46 //! Determining which template parameters are actually used is a trickier
57 //! It gets harder when determining if one template parameter is used depends on
58 //! determining if another template parameter is used. In this example, whether
59 //! `U` is used depends on whether `T` is used.
73 //! We can express the set of used template parameters as a constraint solving
74 //! problem (where the set of template parameters used by a given IR item is the
75 //! union of its sub-item's used template parameters) and iterate to a
84 //! parameters. Our analysis only adds members to each item's set of used
116 /// turn used by the template definition:
138 /// template parameter is always used.
154 used: HashMap<ItemId, Option<ItemSet>>, field
186 // we must ignore template parameters that are only used by in consider_edge()
194 // that every template parameter always used. in consider_edge()
211 self.used in take_this_id_usage_set()
214 "Should have a set of used template params for every item \ in take_this_id_usage_set()
219 "Should maintain the invariant that all used template param \ in take_this_id_usage_set()
252 self.used in constrain_instantiation_of_blocklisted_template()
254 .expect("Should have a used entry for the template arg") in constrain_instantiation_of_blocklisted_template()
257 "Because a != this_id, and all used template \ in constrain_instantiation_of_blocklisted_template()
259 a's used template param set should be `Some`", in constrain_instantiation_of_blocklisted_template()
268 /// A template instantiation's concrete template argument is only used if
284 let used_by_def = self.used in constrain_instantiation()
286 .expect("Should have a used entry for instantiation's template definition") in constrain_instantiation()
294 " instantiation's argument {:?} is used if definition's \ in constrain_instantiation()
295 parameter {:?} is used", in constrain_instantiation()
301 trace!(" param is used by template definition"); in constrain_instantiation()
315 .used in constrain_instantiation()
317 .expect("Should have a used entry for the template arg") in constrain_instantiation()
320 "Because arg != this_id, and all used template \ in constrain_instantiation()
322 arg's used template param set should be \ in constrain_instantiation()
348 .used in constrain_join()
350 .expect("Should have a used set for the sub_id successor") in constrain_join()
353 "Because sub_id != id, and all used template \ in constrain_join()
355 sub_id's used template param set should be \ in constrain_join()
380 let mut used = HashMap::default(); in new() localVariable
403 used.entry(item).or_insert_with(|| Some(ItemSet::new())); in new()
411 used.entry(sub_item) in new()
423 // arguments are used depends on whether the template declaration's in new()
424 // generic template parameters are used. in new()
451 used.entry(arg).or_insert_with(|| Some(ItemSet::new())); in new()
452 used.entry(param).or_insert_with(|| Some(ItemSet::new())); in new()
463 // Invariant: The `used` map has an entry for every allowlisted in new()
474 extra_assert!(used.contains_key(item)); in new()
479 extra_assert!(used.contains_key(&sub_item)); in new()
489 used, in new()
519 extra_assert!(self.used.values().all(|v| v.is_some())); in constrain()
528 trace!(" initially, used set is {:?}", used_by_this_id); in constrain()
565 trace!(" finally, used set is {:?}", used_by_this_id); in constrain()
575 debug_assert!(self.used[&id].is_none()); in constrain()
576 self.used.insert(id, Some(used_by_this_id)); in constrain()
577 extra_assert!(self.used.values().all(|v| v.is_some())); in constrain()
602 .used in from()