The two relevant ARs for this are:
III. A33, an incoming substitute, enters the huddle or assumes a position
in a formation and (a) after approximately two seconds, A34 leaves
the huddle and departs the field of play at his sideline, or (b) after
approximately four seconds, A34 leaves the huddle and departs the
field of play at his sideline.
RULING: (a) Legal. (b) Foul. (Note: A
FI-16 Rule 3-5 / Periods, Time Factors and Substitutions
departing player who leaves the huddle or his position within three
seconds is considered to have left immediately.)
IV. After the ball is made ready for play, substitute B12 enters the huddle
or defensive formation and the departing player delays more than
three seconds before leaving the huddle or formation and departing
the field of play.
RULING: Violation of the substitution rule. Deadball
foul. (Note: The referee is not required to warn a departing
player to leave the huddle immediately.)