This is a long-standing bug in FloatIn, which I somehow managed to
tickle (it's actually surprisingly hard to provoke which is why
it has not shown up before).
The problem was that we had a specialisation like this:
let
f_spec = ...
in let
{-# RULE f Int = f_spec #-}
f = ...
in
<body>
The 'f_spec' binding was being floated inside the binding for 'f',
which makes the RULE invalid becuase 'f_spec' isn't in scope.
We just need to add the free variables of the RULE in the right
places...