# Buggy code
def run_pass(self, state):
    # Determine whether to even attempt this pass... if there's no
    # `literal_unroll as a global or as a freevar then just skip.
    found = False
    func_ir = state.func_ir
    for blk in func_ir.blocks.values():
        for asgn in blk.find_insts(ir.Assign):
            if isinstance(asgn.value, (ir.Global, ir.FreeVar)):
                if asgn.value.value is literal_unroll:
                    found = True
                    break
        if found:
            break
    if not found:
        return False

    # run as subpipeline
    from numba.core.compiler_machinery import PassManager
    from numba.core.typed_passes import PartialTypeInference

    pm = PassManager("literal_unroll_subpipeline")
    # get types where possible to help with list->tuple change
    pm.add_pass(PartialTypeInference, "performs partial type inference")
    # make const lists tuples
    pm.add_pass(TransformLiteralUnrollConstListToTuple, "switch const list for tuples")
    # recompute partial typemap following IR change
    pm.add_pass(PartialTypeInference, "performs partial type inference")
    # canonicalise loops
    pm.add_pass(IterLoopCanonicalization, "switch iter loops for range driven loops")
    # rewrite consts
    pm.add_pass(RewriteSemanticConstants, "rewrite semantic constants")
    # do the unroll
    pm.add_pass(MixedContainerUnroller, "performs mixed container unroll")
    pm.finalize()
    pm.run(state)
    return True


# Traceback (TypingError)
Using matplotlib backend: Qt5Agg
Populating the interactive namespace from numpy and matplotlib
0.26156099390229226
0.4919898206995005
0.363624558244539
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
<ipython-input-1-56c6c55bddcf> in <module>
26
27 recarriterator2(rec)
---> 28 recarriterator(rec)

~\anaconda3\lib\site-packages\numba\core\dispatcher.py in _compile_for_args(self, *args, **kws)
413                 e.patch_message(msg)
414
--> 415             error_rewrite(e, 'typing')
416         except errors.UnsupportedError as e:
417             # Something unsupported is present in the user code, add help info

~\anaconda3\lib\site-packages\numba\core\dispatcher.py in error_rewrite(e, issue_type)
356                 raise e
357             else:
--> 358                 reraise(type(e), e, None)
359
360         argtypes = []

~\anaconda3\lib\site-packages\numba\core\utils.py in reraise(tp, value, tb)
78         value = tp()
79     if value.__traceback__ is not tb:
---> 80         raise value.with_traceback(tb)
81     raise value
82

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function getitem>) found for signature:

>>> getitem(unaligned array(Record(a[type=float64;offset=0],b[type=float64;offset=8],c[type=float64;offset=16];24;False), 1d, C), unicode_type)

There are 22 candidate implementations:
- Of which 20 did not match due to:
Overload of function 'getitem': File: <numerous>: Line N/A.
With argument(s): '(unaligned array(Record(a[type=float64;offset=0],b[type=float64;offset=8],c[type=float64;offset=16];24;False), 1d, C), unicode_type)':
No match.
- Of which 2 did not match due to:
Overload in function 'GetItemBuffer.generic': File: numba\core\typing\arraydecl.py: Line 162.
With argument(s): '(unaligned array(Record(a[type=float64;offset=0],b[type=float64;offset=8],c[type=float64;offset=16];24;False), 1d, C), unicode_type)':
Rejected as the implementation raised a specific error:
TypeError: unsupported array index type unicode_type in [unicode_type]
raised from C:\Users\leopo\anaconda3\lib\site-packages\numba\core\typing\arraydecl.py:68

During: typing of intrinsic-call at <ipython-input-1-56c6c55bddcf> (8)

File "<ipython-input-1-56c6c55bddcf>", line 8:
def recarriterator(rec):
<source elided>
for o in 'a','b','c':
print(rec[o][0])
^

# Fixed code
def run_pass(self, state):
    # Determine whether to even attempt this pass... if there's no
    # `literal_unroll as a global or as a freevar then just skip.
    found = False
    func_ir = state.func_ir
    for blk in func_ir.blocks.values():
        for asgn in blk.find_insts(ir.Assign):
            if isinstance(asgn.value, (ir.Global, ir.FreeVar)):
                if asgn.value.value is literal_unroll:
                    found = True
                    break
        if found:
            break
    if not found:
        return False

    # run as subpipeline
    from numba.core.compiler_machinery import PassManager
    from numba.core.typed_passes import PartialTypeInference

    pm = PassManager("literal_unroll_subpipeline")
    # get types where possible to help with list->tuple change
    pm.add_pass(PartialTypeInference, "performs partial type inference")
    # make const lists tuples
    pm.add_pass(TransformLiteralUnrollConstListToTuple, "switch const list for tuples")
    # recompute partial typemap following IR change
    pm.add_pass(PartialTypeInference, "performs partial type inference")
    # canonicalise loops
    pm.add_pass(IterLoopCanonicalization, "switch iter loops for range driven loops")
    # rewrite consts
    pm.add_pass(RewriteSemanticConstants, "rewrite semantic constants")
    # do the unroll
    pm.add_pass(MixedContainerUnroller, "performs mixed container unroll")
    # rewrite dynamic getitem to static getitem as it's possible some more
    # getitems will now be statically resolvable
    pm.add_pass(GenericRewrites, "Generic Rewrites")
    pm.finalize()
    pm.run(state)
    return True