There are all kinds of cases where this reveals interesting things about how someone pronounces things.
An American will speak of “an herb” because the h is still silent there (“an ’erb”), whereas an Australian (and most other English dialects) will speak of “a herb” because it’s no longer silent.
In the KJV, 1 Kings 10:29 gets two in one verse, speaking of “an horse for an hundred and fifty”, showing that in the English of the early 1600s, you had “an ’orse” and “an ’undred” by pronunciation, whereas all major dialects now sound the h. (For reading aloud, I personally say “a horse for a hundred and fifty”, having decided that a/an are the same word just with context-dependent spelling and pronunciation, like “the” has two context-dependent pronunciations (“thuh dog” versus “thee elephant”, likewise based on the next syllable’s sound), though they’re both spelled the same way.)
If a Rust developer writes “an &str”, they’re probably pronouncing it “an ampersand str” or “an and str”, but if they write “a &str”, they might be pronouncing it “a str slice” or “a reference to a str”.