Skip to content

Commit b89d9ad

Browse files
redsun82Copilot
andcommitted
Rust: Drop locations for downgraded comments
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f4faf4c commit b89d9ad

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • rust/downgrades/109496fd2f20f28a35e50b110859e74882ee80d6

rust/downgrades/109496fd2f20f28a35e50b110859e74882ee80d6/upgrade.ql

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private predicate metaTokenTree(Element id, Element tokenTree) {
3939
token_tree_meta_token_trees(id, tokenTree)
4040
}
4141

42-
private predicate deletedElement(Element id) {
42+
private predicate deletedAstNode(Element id) {
4343
wrapperConstArg(id) or
4444
unsafeInnerMeta(id) or
4545
cfg_atoms(id) or
@@ -48,6 +48,12 @@ private predicate deletedElement(Element id) {
4848
try_block_modifiers(id)
4949
}
5050

51+
private predicate deletedElement(Element id) {
52+
deletedAstNode(id)
53+
or
54+
exists(Element parent, string text | comments(id, parent, text) and deletedAstNode(parent))
55+
}
56+
5157
query predicate new_block_expr_is_try(Element id) {
5258
exists(Element modifier | block_expr_try_block_modifiers(id, modifier) and try_block_modifier_is_try(modifier))
5359
}
@@ -69,7 +75,7 @@ query predicate new_const_arg_exprs(Element id, Element expr) {
6975
}
7076

7177
query predicate new_comments(Element id, Element parent, string text) {
72-
comments(id, parent, text) and not deletedElement(parent)
78+
comments(id, parent, text) and not deletedAstNode(parent)
7379
}
7480

7581
query predicate new_struct_field_defaults(Element id, Element expr) {

0 commit comments

Comments
 (0)