Ouch. Rust (and metal filings in general) is one of the hardest stains to get out of clothing. The particles are very rough if you were to look at them under a microscope, and they "tangle" themselves into most natural fibers so tightly you can't get them back out just by washing. Metals, unlike most other solids, also don't dissolve readily in water; the metal atoms are more attracted to their buddies in the particle than to the weak hydrogen bonds water offers to potential solutes.
The home remedy for rust stains is to lay the garment on a flat surface, pile a bunch of salt on the stain, then pour lemon juice over the salt. This will cause a chemical reaction that produces hydrous citric acid to dissolve and capture the metal particles, which should then wash away in a soluble form. Don't leave it too long as the citric acid can also bleach the fabric.
If it is a white shirt, you can also try a similar but more powerful method using hydrogen peroxide and cream of tartar. This combination of a base and an oxidizer will break down the rust particles allowing them to be rinsed away more easily; however, the peroxide WILL bleach the fabric, so you cannot use this trick on colored clothing.
There are more don'ts than dos:
- DON'T use chlorine bleach; it will set the rust stain and you will never get it out.
- DON'T put clothing with a rust stain in the dryer; that can also set the stain.
- DON'T wash the stain in hot water; you'll set it, yadda yadda yadda.
- DON'T try to use a lot of friction (scrubbing) to get the stain out; you'll just grind it deeper into the fibers.