mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Fix incorrect handling of cfg'd varargs
This commit is contained in:
parent
9cbafa2d49
commit
f2fa456a8c
8 changed files with 37 additions and 16 deletions
|
@ -73,6 +73,17 @@ impl FunctionData {
|
|||
flags.remove(FnFlags::HAS_SELF_PARAM);
|
||||
}
|
||||
}
|
||||
if flags.contains(FnFlags::IS_VARARGS) {
|
||||
if let Some((_, param)) = func.params.iter().enumerate().rev().find(|&(idx, _)| {
|
||||
item_tree.attrs(db, krate, attr_owner(idx)).is_cfg_enabled(cfg_options)
|
||||
}) {
|
||||
if param.type_ref.is_some() {
|
||||
flags.remove(FnFlags::IS_VARARGS);
|
||||
}
|
||||
} else {
|
||||
flags.remove(FnFlags::IS_VARARGS);
|
||||
}
|
||||
}
|
||||
|
||||
let attrs = item_tree.attrs(db, krate, ModItem::from(loc.id.value).into());
|
||||
let legacy_const_generics_indices = attrs
|
||||
|
@ -92,7 +103,7 @@ impl FunctionData {
|
|||
.filter(|&(idx, _)| {
|
||||
item_tree.attrs(db, krate, attr_owner(idx)).is_cfg_enabled(cfg_options)
|
||||
})
|
||||
.map(|(_, param)| param.type_ref.clone())
|
||||
.filter_map(|(_, param)| param.type_ref.clone())
|
||||
.collect(),
|
||||
ret_type: func.ret_type.clone(),
|
||||
attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue