mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Make UsageMap::get_user_items
infallible.
It's nicer this way.
This commit is contained in:
parent
d9c13cd453
commit
142075a9fb
@ -231,8 +231,8 @@ impl<'tcx> UsageMap<'tcx> {
|
||||
assert!(self.used_map.insert(user_item, used_items).is_none());
|
||||
}
|
||||
|
||||
pub fn get_user_items(&self, item: MonoItem<'tcx>) -> Option<&[MonoItem<'tcx>]> {
|
||||
self.user_map.get(&item).map(|items| items.as_slice())
|
||||
pub fn get_user_items(&self, item: MonoItem<'tcx>) -> &[MonoItem<'tcx>] {
|
||||
self.user_map.get(&item).map(|items| items.as_slice()).unwrap_or(&[])
|
||||
}
|
||||
|
||||
/// Internally iterate over all inlined items used by `item`.
|
||||
|
@ -495,8 +495,9 @@ fn internalize_symbols<'tcx>(
|
||||
if !single_codegen_unit {
|
||||
debug_assert_eq!(mono_item_placements[item], home_cgu);
|
||||
|
||||
if let Some(user_items) = cx.usage_map.get_user_items(*item) {
|
||||
if user_items
|
||||
if cx
|
||||
.usage_map
|
||||
.get_user_items(*item)
|
||||
.iter()
|
||||
.filter_map(|user_item| {
|
||||
// Some user mono items might not have been
|
||||
@ -510,7 +511,6 @@ fn internalize_symbols<'tcx>(
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got here, we did not find any uses from other CGUs, so
|
||||
// it's fine to make this monomorphization internal.
|
||||
|
Loading…
Reference in New Issue
Block a user