11211: fix: Fix parsing of `#[derive]` paths r=jonas-schievink a=jonas-schievink

Currently this code produces an empty derive path for every `,`, which makes the IDE layer resolve derive paths to the wrong derive macro in the list. Skip `,`s to fix that. (nameres just ignored them, so it didn't cause problems there)

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
This commit is contained in:
bors[bot] 2022-01-06 12:41:02 +00:00 committed by GitHub
commit 7111c27cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -737,6 +737,7 @@ pub fn parse_path_comma_token_tree(&self) -> Option<impl Iterator<Item = ModPath
matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Punct(Punct { char: ',', .. }))) matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Punct(Punct { char: ',', .. })))
}) })
.into_iter() .into_iter()
.filter(|(comma, _)| !*comma)
.map(|(_, tts)| { .map(|(_, tts)| {
let segments = tts.filter_map(|tt| match tt { let segments = tts.filter_map(|tt| match tt {
tt::TokenTree::Leaf(tt::Leaf::Ident(id)) => Some(id.as_name()), tt::TokenTree::Leaf(tt::Leaf::Ident(id)) => Some(id.as_name()),