mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
fix: don't panic in semantics due to cfg_attr
disrupting offsets
This commit is contained in:
parent
baa5cd9527
commit
ebd723995a
2 changed files with 7 additions and 1 deletions
|
@ -931,7 +931,8 @@ impl<'db> SemanticsImpl<'db> {
|
||||||
file.with_value(derive.clone()),
|
file.with_value(derive.clone()),
|
||||||
)?;
|
)?;
|
||||||
let attrs = adt_def.attrs(self.db);
|
let attrs = adt_def.attrs(self.db);
|
||||||
let mut derive_paths = attrs[attr_id].parse_path_comma_token_tree()?;
|
// FIXME: https://github.com/rust-analyzer/rust-analyzer/issues/11298
|
||||||
|
let mut derive_paths = attrs.get(attr_id)?.parse_path_comma_token_tree()?;
|
||||||
|
|
||||||
let derive_idx = tt
|
let derive_idx = tt
|
||||||
.syntax()
|
.syntax()
|
||||||
|
|
|
@ -72,6 +72,11 @@ impl ops::Deref for RawAttrs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl Attrs {
|
||||||
|
pub fn get(&self, AttrId { ast_index, .. }: AttrId) -> Option<&Attr> {
|
||||||
|
(**self).get(ast_index as usize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ops::Deref for Attrs {
|
impl ops::Deref for Attrs {
|
||||||
type Target = [Attr];
|
type Target = [Attr];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue