When Quicksmith Rebel enters the battlefield, target artifact you control gains "{T}: This artifact deals 2 damage to any target" for as long as you control Quicksmith Rebel.
If Quicksmith Rebel leaves the battlefield while its ability is on the stack, the artifact never gains the damage-dealing ability.
If Quicksmith Rebel leaves the battlefield, you no longer control it.
If Quicksmith Rebel or the artifact leaves the battlefield while the damage-dealing ability is on the stack, that ability resolves as normal.
If another player gains control of Quicksmith Rebel, the artifact will no longer have the damage-dealing ability, even if you regain control of Quicksmith Rebel.