Skip to content

Commit

Permalink
WIPvariance
Browse files Browse the repository at this point in the history
  • Loading branch information
douglas-raillard-arm committed Nov 14, 2023
1 parent 07f102c commit 4c5bee2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/analysis/traceevent/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@ where
// tried to get the event_desc before and it failed.
let desc_map = self.desc_map().ok_or_else(not_found)?;
let (desc, user) = desc_map.lookup(event_id).ok_or_else(not_found)?;
Ok((desc as *const EventDesc, user))
}).map(|(desc, user): &(*const EventDesc, *const T)| {
Ok((desc, user))
}).map(|(desc, user)| {
let user: *const T = *user;
let desc: *const EventDesc = *desc;
// SAFETY: EventDescMap contains &'h EventDesc, which we store as *const EventDesc
// to avoid variance issues. It's therefore completely safe to just cast it back to
// &'h EventDesc.
// SAFETY: EventDescMap::lookup() returns (&'h EventDesc, &'edm T), which we store
// as (*const EventDesc, *const T) to avoid variance issues. It's therefore
// completely safe to just cast it back to &'h EventDesc.
let desc: &'h EventDesc = unsafe{ &*desc };
let user: &'edm T = unsafe{ &*user};
(desc, user)
Expand Down

0 comments on commit 4c5bee2

Please sign in to comment.