diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2016-11-04 11:03:01 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2016-11-04 11:03:01 -0700 |
commit | 0afbe48131359d2091734bac1bf6a1d54d48b914 (patch) | |
tree | a60a9809103a9695f268747e6fe629c8e390a56a /src | |
parent | 624c32c93ccdd4ed34a6e827b063f272fbad36b0 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/item.rs | 3 |
1 files changed, 2 insertions, 1 deletions
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) } } |