During an event at the Smithsonian Institute for Captain America: Civil War, the Russo Brothers mentioned Captain Marvel along with many other Marvel characters that would be featured in Infinity War.
Captain Marvel has been presumably confirmed for Infinity War in the past, through a casting call that featured this character, but also from the Russo Brothers themselves.
There have been rumors for months that Captain Marvel will be appearing in Avengers: Infinity War, which is why some thought Brie Larson was cast so early, but it seems that isn’t the case.
It’s worth noting that this revelation came just days after the Russos also confirmed that both movies, which at the time were known as Avengers: Infinity War Part 1 and Avengers: Infinity War Part 2, will get new titles.