Auto merge of #62679 - Xanewok:after-expansion, r=Zoxc
Auto merge of #62679 - Xanewok:after-expansion, r=Zoxc

Add an `after_expansion` callback in the driver

To format a given file RLS needs to know the Rust edition associated with it. It's not enough to look at the `edition` key in Cargo.toml - each crate target can have a different edition associated with it so the sure way to fetch a correct edition is to scan the input files used to compile a given crate target.

Right now this was done in the `after_analysis` callback of our shim, however this leads to other problems - if a crate cannot be successfully compiled (e.g. it has a type error) then a callback would not be invoked meaning we can't populate the files -> edition mapping.

However, doing this only after parsing is not enough, since expansion can pull in additional source files (e.g. by invoking `macro_rules! include_my_mod { () => { mod some_mod; }; }`).

Without copy-pasting the entire driver setup it's also not possible to expand the crate ourselves in the `after_parsing` callback - to expand crate we'd need to register plugins and initialize session ourselves. However, this is done normally after executing the callback itself, thus triggering the `Once::set` assertions in `Session::init_features`.

r? @Zoxc

cc @RalfJung @oli-obk this affects public driver interface used by Miri and Clippy

graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust