From 0afbe48131359d2091734bac1bf6a1d54d48b914 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 4 Nov 2016 11:03:01 -0700 Subject: Use a temporary for the return value in IteId::next() This adds a temporary binding for the newly allocated id so that we can use it in conditional breakpoints when debugging dangling `ItemId` references. I believe that we will want the ability to set conditional breakpoints in this method every single time we end up debugging dangling references, so it is worth landing in master. --- src/ir/item.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ir/item.rs b/src/ir/item.rs index 23090739..ecb86374 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -86,7 +86,8 @@ impl ItemId { /// Allocate the next `ItemId`. pub fn next() -> Self { static NEXT_ITEM_ID: AtomicUsize = ATOMIC_USIZE_INIT; - ItemId(NEXT_ITEM_ID.fetch_add(1, Ordering::Relaxed)) + let next_id = NEXT_ITEM_ID.fetch_add(1, Ordering::Relaxed); + ItemId(next_id) } } -- cgit v1.2.3