mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: drop crate_graph/modules.ql test
This commit is contained in:
committed by
Tom Hvitved
parent
e90ab7b881
commit
76da2e41f7
@@ -1,140 +0,0 @@
|
||||
#-----| Const
|
||||
|
||||
#-----| Static
|
||||
|
||||
#-----| enum X
|
||||
|
||||
#-----| fn as_string
|
||||
|
||||
#-----| fn as_string
|
||||
|
||||
#-----| fn fmt
|
||||
|
||||
#-----| fn from
|
||||
|
||||
#-----| fn length
|
||||
|
||||
#-----| impl ...::AsString for ...::X { ... }
|
||||
#-----| -> fn as_string
|
||||
|
||||
#-----| impl ...::Display for ...::X { ... }
|
||||
#-----| -> fn fmt
|
||||
|
||||
#-----| impl ...::From::<...> for ...::Thing::<...> { ... }
|
||||
#-----| -> fn from
|
||||
|
||||
lib.rs:
|
||||
# 0| mod crate
|
||||
#-----| -> mod module
|
||||
|
||||
#-----| mod module
|
||||
#-----| -> Const
|
||||
#-----| -> Static
|
||||
#-----| -> enum X
|
||||
#-----| -> fn length
|
||||
#-----| -> impl ...::AsString for ...::X { ... }
|
||||
#-----| -> impl ...::Display for ...::X { ... }
|
||||
#-----| -> impl ...::From::<...> for ...::Thing::<...> { ... }
|
||||
#-----| -> struct LocalKey<T>
|
||||
#-----| -> struct Thing<T>
|
||||
#-----| -> struct X_List
|
||||
#-----| -> trait AsString
|
||||
#-----| -> use ...::DirBuilder
|
||||
#-----| -> use ...::DirEntry
|
||||
#-----| -> use ...::File
|
||||
#-----| -> use ...::FileTimes
|
||||
#-----| -> use ...::FileType
|
||||
#-----| -> use ...::Metadata
|
||||
#-----| -> use ...::OpenOptions
|
||||
#-----| -> use ...::PathBuf
|
||||
#-----| -> use ...::Permissions
|
||||
#-----| -> use ...::ReadDir
|
||||
#-----| -> use ...::canonicalize
|
||||
#-----| -> use ...::copy
|
||||
#-----| -> use ...::create_dir
|
||||
#-----| -> use ...::create_dir as mkdir
|
||||
#-----| -> use ...::create_dir_all
|
||||
#-----| -> use ...::exists
|
||||
#-----| -> use ...::hard_link
|
||||
#-----| -> use ...::metadata
|
||||
#-----| -> use ...::read
|
||||
#-----| -> use ...::read_dir
|
||||
#-----| -> use ...::read_link
|
||||
#-----| -> use ...::read_to_string
|
||||
#-----| -> use ...::remove_dir
|
||||
#-----| -> use ...::remove_dir_all
|
||||
#-----| -> use ...::remove_file
|
||||
#-----| -> use ...::rename
|
||||
#-----| -> use ...::set_permissions
|
||||
#-----| -> use ...::soft_link
|
||||
#-----| -> use ...::symlink_metadata
|
||||
#-----| -> use ...::write
|
||||
|
||||
#-----| struct LocalKey<T>
|
||||
|
||||
#-----| struct Thing<T>
|
||||
|
||||
#-----| struct X_List
|
||||
|
||||
#-----| trait AsString
|
||||
#-----| -> fn as_string
|
||||
|
||||
#-----| use ...::DirBuilder
|
||||
|
||||
#-----| use ...::DirEntry
|
||||
|
||||
#-----| use ...::File
|
||||
|
||||
#-----| use ...::FileTimes
|
||||
|
||||
#-----| use ...::FileType
|
||||
|
||||
#-----| use ...::Metadata
|
||||
|
||||
#-----| use ...::OpenOptions
|
||||
|
||||
#-----| use ...::PathBuf
|
||||
|
||||
#-----| use ...::Permissions
|
||||
|
||||
#-----| use ...::ReadDir
|
||||
|
||||
#-----| use ...::canonicalize
|
||||
|
||||
#-----| use ...::copy
|
||||
|
||||
#-----| use ...::create_dir
|
||||
|
||||
#-----| use ...::create_dir as mkdir
|
||||
|
||||
#-----| use ...::create_dir_all
|
||||
|
||||
#-----| use ...::exists
|
||||
|
||||
#-----| use ...::hard_link
|
||||
|
||||
#-----| use ...::metadata
|
||||
|
||||
#-----| use ...::read
|
||||
|
||||
#-----| use ...::read_dir
|
||||
|
||||
#-----| use ...::read_link
|
||||
|
||||
#-----| use ...::read_to_string
|
||||
|
||||
#-----| use ...::remove_dir
|
||||
|
||||
#-----| use ...::remove_dir_all
|
||||
|
||||
#-----| use ...::remove_file
|
||||
|
||||
#-----| use ...::rename
|
||||
|
||||
#-----| use ...::set_permissions
|
||||
|
||||
#-----| use ...::soft_link
|
||||
|
||||
#-----| use ...::symlink_metadata
|
||||
|
||||
#-----| use ...::write
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* @id module-graph
|
||||
* @name Module and Item Graph
|
||||
* @kind graph
|
||||
*/
|
||||
|
||||
import rust
|
||||
import codeql.rust.internal.PathResolution
|
||||
|
||||
predicate nodes(Item i) { i instanceof RelevantNode }
|
||||
|
||||
class RelevantNode extends Element instanceof ItemNode {
|
||||
RelevantNode() {
|
||||
this.(ItemNode).getImmediateParentModule*() =
|
||||
any(Crate m | m.getName() = "test" and m.getVersion() = "0.0.1")
|
||||
.(CrateItemNode)
|
||||
.getModuleNode()
|
||||
}
|
||||
|
||||
string label() { result = this.toString() }
|
||||
}
|
||||
|
||||
class HasGenericParams extends RelevantNode {
|
||||
private GenericParamList params;
|
||||
|
||||
HasGenericParams() {
|
||||
params = this.(Function).getGenericParamList() or
|
||||
params = this.(Enum).getGenericParamList() or
|
||||
params = this.(Struct).getGenericParamList() or
|
||||
params = this.(Union).getGenericParamList() or
|
||||
params = this.(Impl).getGenericParamList() or
|
||||
params = this.(Trait).getGenericParamList() // or
|
||||
//params = this.(TraitAlias).getGenericParamList()
|
||||
}
|
||||
|
||||
override string label() {
|
||||
result =
|
||||
super.toString() + "<" +
|
||||
strictconcat(string part, int index |
|
||||
part = params.getGenericParam(index).toString()
|
||||
|
|
||||
part, ", " order by index
|
||||
) + ">"
|
||||
}
|
||||
}
|
||||
|
||||
predicate edges(RelevantNode container, RelevantNode element) {
|
||||
element = container.(Module).getItemList().getAnItem() or
|
||||
element = container.(Impl).getAssocItemList().getAnAssocItem() or
|
||||
element = container.(Trait).getAssocItemList().getAnAssocItem()
|
||||
}
|
||||
|
||||
query predicate nodes(RelevantNode node, string attr, string val) {
|
||||
nodes(node) and
|
||||
(
|
||||
attr = "semmle.label" and
|
||||
val = node.label()
|
||||
or
|
||||
attr = "semmle.order" and
|
||||
val =
|
||||
any(int i | node = rank[i](RelevantNode n | nodes(n) | n order by n.toString())).toString()
|
||||
)
|
||||
}
|
||||
|
||||
query predicate edges(RelevantNode pred, RelevantNode succ, string attr, string val) {
|
||||
edges(pred, succ) and
|
||||
(
|
||||
attr = "semmle.label" and
|
||||
val = ""
|
||||
or
|
||||
attr = "semmle.order" and
|
||||
val = any(int i | succ = rank[i](Item s | edges(pred, s) | s order by s.toString())).toString()
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user