It takes a while for an actor to lose a significant amount of weight, which is usually a big problem for the production schedule, so it’s rare to handle it that way.
One example is Tom Hanks in Castaway (2000). Hanks actually needed to lose the weight to make the part work, so the producers booked everyone for 2 movies. They shot the first part of Castaway with heavy Hanks – he actually gained weight in preproduction to look heavier. Then, while he was losing weight, Zemeckis shot What Lies Beneath with the same production crew. Then they came back and finished Castaway with the “skinny” Hanks. By booking everyone for 2 films, they were able to split the production of Castaway and allow Hanks time to trim down.
I’ve found one interview that indicates that Damon was willing to lose weight for The Martian, but Ridley Scott wasn’t willing to do it, so they used either CGI or a body double for the “emaciated” Damon shot. –