Pasty and pastry are easily confused words.
The spell-check application of most word processing software programs would not catch a slip-up of these two words. Spell-check is looking for words that aren’t in its dictionary, and words that resemble words in its dictionary but are possibly spelled wrong. Spell-check isn’t perfect. It doesn’t know and can’t guess what word you wanted or what word you meant, it can only judge the words on the page. If you used words that are all spelled correctly, it gives you a pass anyway.
Autocorrect suggests words that start with the same letters. It suggests what word you may want to save time, but quite often, its suggestions couldn’t be more off base and produces humorous results.
Pasty is an adjective. It means sticky, tacky, or resembling the texture of glue.
Pasty can also be a noun. In burlesque and adult entertainment circles (aka red light districts), pasties are adhesive, decorative coverings worn on the nipples.
Pastry is a noun. It means any snack made with flour. But when you dine out in the US, it typically means the elegant breads often served with coffee, typically in the early part of the day: bear claws, croissants, danishes. Pastries often incorporate cheese, preserved fruit, nuts, and glaze or frosting. Technically by definition, donuts, cookies, biscotti are pastries, too, but they are listed separately on US menus. Donuts often have their own shops, and cookies are considered a dessert, not a breakfast item.
The following story uses both words correctly:
Patsy held multiple jobs to be able to pay her way through school. She was a pasty-wearing burlesque dancer every other night, and an early morning pastry baker. Needless to say, between classes and two jobs, she didn’t sleep much.