The ability of Flying Carpet reads, "Target creature gains flying until end of turn. If that creature is put into any graveyard this turn, bury Flying Carpet." If a player responds to the use of this ability by killing its target, Flying Carpet is buried when its effect resolves.