mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Introduce proc_macro_srv::abis, impl 1.47 and 1.55
Rather than a "Stable" and "Nightly" ABI we instead name ABIs based on the version of the rust compiler in which they were introduced. We place these ABIs in a new module - `proc_macro_srv::abis` - where we also add some mchinery to abstract over ABIs. This should make it easy to add new ABIs at a later date as the rust compiler evolves.
This commit is contained in:
parent
14a51d28b5
commit
e240eb67a8
28 changed files with 390 additions and 327 deletions
|
@ -12,8 +12,14 @@ pub mod fixtures {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_string(code: &str) -> Option<crate::rustc_server::TokenStream> {
|
||||
Some(crate::rustc_server::TokenStream::from_str(code).unwrap())
|
||||
fn parse_string(code: &str) -> Option<crate::abis::abi_1_47::TokenStream> {
|
||||
// This is a bit strange. We need to parse a string into a token stream into
|
||||
// order to create a tt::SubTree from it in fixtures. `into_subtree` is
|
||||
// implemented by all the ABIs we have so we arbitrarily choose one ABI to
|
||||
// write a `parse_string` function for and use that. The tests don't really
|
||||
// care which ABI we're using as the `into_subtree` function isn't part of
|
||||
// the ABI and shouldn't change between ABI versions.
|
||||
crate::abis::abi_1_47::TokenStream::from_str(code).ok()
|
||||
}
|
||||
|
||||
pub fn assert_expand(macro_name: &str, ra_fixture: &str, expect: Expect) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue