and, as i hit the character limit in the original post by including these, here are excerpts of the RBI logs for the relevant function:
🪵 expand for pre-dataflow logs 🪵
╾──────────────────────────────╼
Performing pre-dataflow scan to gather flow insensitive information $s6output27mutableLocalCaptureDataRaceyyF:
╾──────────────────────────────╼
PartialApplyReachability::add.
Value: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
User: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Propagating Captures Result!
(BitNo, Value):
0: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
(Block,GenBits):
bb0.
Entry: 0[]
Gen: 1[0]
Exit: 1[0]
Initializing Function Args:
None.
╾──────────────────────────────╼
Compiling basic block for function $s6output27mutableLocalCaptureDataRaceyyF: bb0
╾──────────────────────────────╼
sil_scope 1 { loc "<source>":2:6 parent @$s6output27mutableLocalCaptureDataRaceyyF : $@convention(thin) () -> () }
sil_scope 2 { loc "<source>":3:7 parent 1 }
sil_scope 3 { loc "<source>":3:11 parent 1 }
bb0:
%0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
%1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
%2 = project_box %1 : ${ var Int }, 0 // users: %24, %7
%3 = integer_literal $Builtin.IntLiteral, 0 // user: %6
%4 = metatype $@thin Int.Type // user: %6
// function_ref Int.init(_builtinIntegerLiteral:)
%5 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
%6 = apply %5(%3, %4) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %7
store %6 to [trivial] %2 : $*Int // id: %7
%8 = metatype $@thin Task<(), Never>.Type // user: %16
%9 = alloc_stack $Optional<TaskPriority> // users: %18, %17, %16, %10
inject_enum_addr %9 : $*Optional<TaskPriority>, #Optional.none!enumelt // id: %10
// function_ref closure #1 in mutableLocalCaptureDataRace()
%11 = function_ref @$s6output27mutableLocalCaptureDataRaceyyFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %14
%12 = copy_value %1 : ${ var Int } // user: %14
%13 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %14
%14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
// function_ref static Task<>.detached(priority:operation:)
%15 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYAcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %16
%16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
destroy_addr %9 : $*Optional<TaskPriority> // id: %17
dealloc_stack %9 : $*Optional<TaskPriority> // id: %18
destroy_value %16 : $Task<(), Never> // id: %19
%20 = integer_literal $Builtin.IntLiteral, 2 // user: %23
%21 = metatype $@thin Int.Type // user: %23
// function_ref Int.init(_builtinIntegerLiteral:)
%22 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %23
%23 = apply %22(%20, %21) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %25
%24 = begin_access [modify] [dynamic] %2 : $*Int // users: %25, %26
store %23 to [trivial] %24 : $*Int // id: %25
end_access %24 : $*Int // id: %26
end_borrow %1 : ${ var Int } // id: %27
destroy_value %0 : ${ var Int } // id: %28
%29 = tuple () // user: %30
return %29 : $() // id: %30
╾──────────────────────────────╼
Results:
Visiting: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
Semantics: assign_fresh
┌─┬─╼ %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
│ └─╼ line:3:7
├─────╼ assign_fresh %%0: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
└─────╼ Used Values
└╼ State: %%0. TrackableValueState[id: 0][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
Type: ${ var Int }
Visiting: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
Semantics: assign
┌─┬─╼ %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
│ └─╼ line:3:7
├─────╼ require %%0: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
│ └╼ assign %%1 = %%0: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
└─────╼ Used Values
└╼ State: %%0. TrackableValueState[id: 0][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
Type: ${ var Int }
└╼ State: %%1. TrackableValueState[id: 1][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
Type: ${ var Int }
Visiting: %2 = project_box %1 : ${ var Int }, 0 // users: %24, %7
Semantics: look_through
Visiting: %3 = integer_literal $Builtin.IntLiteral, 0 // user: %6
Semantics: assign_fresh
Visiting: %4 = metatype $@thin Int.Type // user: %6
Semantics: ignored
Visiting: // function_ref Int.init(_builtinIntegerLiteral:)
%5 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
Semantics: assign_fresh
Visiting: %6 = apply %5(%3, %4) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %7
Semantics: apply
Visiting: store %6 to [trivial] %2 : $*Int // id: %7
Semantics: store
Visiting: %8 = metatype $@thin Task<(), Never>.Type // user: %16
Semantics: ignored
Visiting: %9 = alloc_stack $Optional<TaskPriority> // users: %18, %17, %16, %10
Semantics: assign_fresh
Visiting: inject_enum_addr %9 : $*Optional<TaskPriority>, #Optional.none!enumelt // id: %10
Semantics: ignored
Visiting: // function_ref closure #1 in mutableLocalCaptureDataRace()
%11 = function_ref @$s6output27mutableLocalCaptureDataRaceyyFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %14
Semantics: assign_fresh
Visiting: %12 = copy_value %1 : ${ var Int } // user: %14
Semantics: look_through
Visiting: %13 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %14
Semantics: assign_fresh
Visiting: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Semantics: special
┌─┬─╼ %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
│ └─╼ line:5:17
├─────╼ require %%1: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
│ └╼ assign %%10 = %%1: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
└─────╼ Used Values
└╼ State: %%1. TrackableValueState[id: 1][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
Type: ${ var Int }
└╼ State: %%10. TrackableValueState[id: 10][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Type: $@isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
Visiting: // function_ref static Task<>.detached(priority:operation:)
%15 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYAcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %16
Semantics: assign_fresh
Visiting: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
Semantics: apply
┌─┬─╼ %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
│ └─╼ line:5:8
├─────╼ require %%10: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
│ └╼ send %%10: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
└─────╼ Used Values
└╼ State: %%10. TrackableValueState[id: 10][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Type: $@isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
Visiting: destroy_addr %9 : $*Optional<TaskPriority> // id: %17
Semantics: ignored
Visiting: dealloc_stack %9 : $*Optional<TaskPriority> // id: %18
Semantics: ignored
Visiting: destroy_value %16 : $Task<(), Never> // id: %19
Semantics: ignored
Visiting: %20 = integer_literal $Builtin.IntLiteral, 2 // user: %23
Semantics: assign_fresh
Visiting: %21 = metatype $@thin Int.Type // user: %23
Semantics: ignored
Visiting: // function_ref Int.init(_builtinIntegerLiteral:)
%22 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %23
Semantics: assign_fresh
Visiting: %23 = apply %22(%20, %21) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %25
Semantics: apply
Visiting: %24 = begin_access [modify] [dynamic] %2 : $*Int // users: %25, %26
Semantics: look_through
Visiting: store %23 to [trivial] %24 : $*Int // id: %25
Semantics: store
Visiting: end_access %24 : $*Int // id: %26
Semantics: ignored
Visiting: end_borrow %1 : ${ var Int } // id: %27
Semantics: ignored
Visiting: destroy_value %0 : ${ var Int } // id: %28
Semantics: ignored
Visiting: %29 = tuple () // user: %30
Semantics: assign
Visiting: return %29 : $() // id: %30
Semantics: require
🪵 expand for dataflow logs 🪵
╾──────────────────────────────╼
Performing Dataflow!
╾──────────────────────────────╼
Values!
%%0: TrackableValue. State: TrackableValueState[id: 0][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
%%1: TrackableValue. State: TrackableValueState[id: 1][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
%%2: TrackableValue. State: TrackableValueState[id: 2][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %2 = project_box %1 : ${ var Int }, 0 // users: %24, %7
%%3: TrackableValue. State: TrackableValueState[id: 3][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %3 = integer_literal $Builtin.IntLiteral, 0 // user: %6
%%4: TrackableValue. State: TrackableValueState[id: 4][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: // function_ref Int.init(_builtinIntegerLiteral:)
%5 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %6
%%5: TrackableValue. State: TrackableValueState[id: 5][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %4 = metatype $@thin Int.Type // user: %6
%%6: TrackableValue. State: TrackableValueState[id: 6][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %6 = apply %5(%3, %4) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %7
%%7: TrackableValue. State: TrackableValueState[id: 7][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %9 = alloc_stack $Optional<TaskPriority> // users: %18, %17, %16, %10
%%8: TrackableValue. State: TrackableValueState[id: 8][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: // function_ref closure #1 in mutableLocalCaptureDataRace()
%11 = function_ref @$s6output27mutableLocalCaptureDataRaceyyFyyYacfU_ : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %14
%%9: TrackableValue. State: TrackableValueState[id: 9][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %13 = enum $Optional<any Actor>, #Optional.none!enumelt // user: %14
%%10: TrackableValue. State: TrackableValueState[id: 10][is_no_alias: no][is_sendable: no][region_value_kind: disconnected].
Rep Value: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
%%11: TrackableValue. State: TrackableValueState[id: 11][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: // function_ref static Task<>.detached(priority:operation:)
%15 = function_ref @$sScTss5NeverORs_rlE8detached8priority9operationScTyxABGScPSg_xyYaYAcntFZ : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %16
%%12: TrackableValue. State: TrackableValueState[id: 12][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %8 = metatype $@thin Task<(), Never>.Type // user: %16
%%13: TrackableValue. State: TrackableValueState[id: 13][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
%%14: TrackableValue. State: TrackableValueState[id: 14][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %20 = integer_literal $Builtin.IntLiteral, 2 // user: %23
%%15: TrackableValue. State: TrackableValueState[id: 15][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: // function_ref Int.init(_builtinIntegerLiteral:)
%22 = function_ref @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %23
%%16: TrackableValue. State: TrackableValueState[id: 16][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %21 = metatype $@thin Int.Type // user: %23
%%17: TrackableValue. State: TrackableValueState[id: 17][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %23 = apply %22(%20, %21) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int // user: %25
%%18: TrackableValue. State: TrackableValueState[id: 18][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %24 = begin_access [modify] [dynamic] %2 : $*Int // users: %25, %26
%%19: TrackableValue. State: TrackableValueState[id: 19][is_no_alias: no][is_sendable: yes][region_value_kind: disconnected].
Rep Value: %29 = tuple () // user: %30
Block: bb0
Visiting Preds!
Applying: assign_fresh %%0: %0 = alloc_box ${ var Int }, var, name "x" // users: %28, %1
Before: []
After: [(0)]
Applying: require %%0: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
Before: [(0)]
After: [(0)]
Applying: assign %%1 = %%0: %1 = begin_borrow [var_decl] %0 : ${ var Int } // users: %27, %12, %2
Before: [(0)]
After: [(0 1)]
Applying: require %%1: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Before: [(0 1)]
After: [(0 1)]
Applying: assign %%10 = %%1: %14 = partial_apply [callee_guaranteed] [isolated_any] %11(%13, %12) : $@convention(thin) @async @substituted <τ_0_0> (@guaranteed Optional<any Actor>, @guaranteed { var Int }) -> @out τ_0_0 for <()> // user: %16
Before: [(0 1)]
After: [(0 1 10)]
Applying: require %%10: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
Before: [(0 1 10)]
After: [(0 1 10)]
Applying: send %%10: %16 = apply %15<(), Never>(%9, %14, %8) : $@convention(method) <τ_0_0, τ_0_1 where τ_0_0 : Sendable, τ_0_1 == Never> (@in_guaranteed Optional<TaskPriority>, @sil_sending @owned @isolated(any) @async @callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <τ_0_0>, @thin Task<τ_0_0, Never>.Type) -> @owned Task<τ_0_0, Never> // user: %19
Before: [(0 1 10)]
After: [{0 1 10}]
Working Partition: [{0 1 10}]
Exit Partition: [{0 1 10}]
Updated Partition: yes