mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: fix <X as Y> path extraction
This works around a quirk in rust-analyzer's AST generation machinery, where for an `<X as Y>` path there might be no way to directly get `Y` from the path segment.
This commit is contained in:
@@ -166,6 +166,162 @@ struct FieldInfo {
|
||||
name: String,
|
||||
ty: FieldType,
|
||||
}
|
||||
|
||||
fn get_additional_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
|
||||
match node.name.as_str() {
|
||||
"Name" | "NameRef" | "Lifetime" => vec![FieldInfo {
|
||||
name: "text".to_string(),
|
||||
ty: FieldType::String,
|
||||
}],
|
||||
"Abi" => vec![FieldInfo {
|
||||
name: "abi_string".to_string(),
|
||||
ty: FieldType::String,
|
||||
}],
|
||||
"Literal" => vec![FieldInfo {
|
||||
name: "text_value".to_string(),
|
||||
ty: FieldType::String,
|
||||
}],
|
||||
"PrefixExpr" => vec![FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
}],
|
||||
"BinExpr" => vec![
|
||||
FieldInfo {
|
||||
name: "lhs".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "rhs".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
},
|
||||
],
|
||||
"IfExpr" => vec![
|
||||
FieldInfo {
|
||||
name: "then_branch".to_string(),
|
||||
ty: FieldType::Optional("BlockExpr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "else_branch".to_string(),
|
||||
ty: FieldType::Optional("ElseBranch".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
],
|
||||
"RangeExpr" => vec![
|
||||
FieldInfo {
|
||||
name: "start".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "end".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
},
|
||||
],
|
||||
"RangePat" => vec![
|
||||
FieldInfo {
|
||||
name: "start".to_string(),
|
||||
ty: FieldType::Optional("Pat".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "end".to_string(),
|
||||
ty: FieldType::Optional("Pat".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
},
|
||||
],
|
||||
"IndexExpr" => vec![
|
||||
FieldInfo {
|
||||
name: "index".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "base".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
},
|
||||
],
|
||||
"Impl" => vec![
|
||||
FieldInfo {
|
||||
name: "trait_".to_string(),
|
||||
ty: FieldType::Optional("Type".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "self_ty".to_string(),
|
||||
ty: FieldType::Optional("Type".to_string()),
|
||||
},
|
||||
],
|
||||
"ForExpr" => vec![FieldInfo {
|
||||
name: "iterable".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"WhileExpr" => vec![FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"MatchGuard" => vec![FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"MacroDef" => vec![
|
||||
FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::Optional("TokenTree".to_string()),
|
||||
},
|
||||
FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("TokenTree".to_string()),
|
||||
},
|
||||
],
|
||||
"FormatArgsExpr" => vec![FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::List("FormatArgsArg".to_string()),
|
||||
}],
|
||||
"ArgList" => vec![FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::List("Expr".to_string()),
|
||||
}],
|
||||
"Fn" => vec![FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("BlockExpr".to_string()),
|
||||
}],
|
||||
"Const" => vec![FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"Static" => vec![FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"ClosureExpr" => vec![FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
}],
|
||||
"ArrayExpr" => vec![FieldInfo {
|
||||
name: "is_semicolon".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
}],
|
||||
"SelfParam" => vec![FieldInfo {
|
||||
name: "is_amp".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
}],
|
||||
"UseTree" => vec![FieldInfo {
|
||||
name: "is_star".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
}],
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
|
||||
let mut result = Vec::new();
|
||||
let predicates = [
|
||||
@@ -183,196 +339,14 @@ fn get_fields(node: &AstNodeSrc) -> Vec<FieldInfo> {
|
||||
}
|
||||
}
|
||||
|
||||
match node.name.as_str() {
|
||||
"Name" | "NameRef" | "Lifetime" => {
|
||||
result.push(FieldInfo {
|
||||
name: "text".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"Abi" => {
|
||||
result.push(FieldInfo {
|
||||
name: "abi_string".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"Literal" => {
|
||||
result.push(FieldInfo {
|
||||
name: "text_value".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"PrefixExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"BinExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "lhs".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "rhs".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"IfExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "then_branch".to_string(),
|
||||
ty: FieldType::Optional("BlockExpr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "else_branch".to_string(),
|
||||
ty: FieldType::Optional("ElseBranch".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"RangeExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "start".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "end".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"RangePat" => {
|
||||
result.push(FieldInfo {
|
||||
name: "start".to_string(),
|
||||
ty: FieldType::Optional("Pat".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "end".to_string(),
|
||||
ty: FieldType::Optional("Pat".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "operator_name".to_string(),
|
||||
ty: FieldType::String,
|
||||
});
|
||||
}
|
||||
"IndexExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "index".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "base".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"Impl" => {
|
||||
result.push(FieldInfo {
|
||||
name: "trait_".to_string(),
|
||||
ty: FieldType::Optional("Type".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "self_ty".to_string(),
|
||||
ty: FieldType::Optional("Type".to_string()),
|
||||
});
|
||||
}
|
||||
"ForExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "iterable".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"WhileExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"MatchGuard" => {
|
||||
result.push(FieldInfo {
|
||||
name: "condition".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"MacroDef" => {
|
||||
result.push(FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::Optional("TokenTree".to_string()),
|
||||
});
|
||||
result.push(FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("TokenTree".to_string()),
|
||||
});
|
||||
}
|
||||
"FormatArgsExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::List("FormatArgsArg".to_string()),
|
||||
});
|
||||
}
|
||||
"ArgList" => {
|
||||
result.push(FieldInfo {
|
||||
name: "args".to_string(),
|
||||
ty: FieldType::List("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"Fn" => {
|
||||
result.push(FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("BlockExpr".to_string()),
|
||||
});
|
||||
}
|
||||
"Const" => {
|
||||
result.push(FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"Static" => {
|
||||
result.push(FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"ClosureExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "body".to_string(),
|
||||
ty: FieldType::Optional("Expr".to_string()),
|
||||
});
|
||||
}
|
||||
"ArrayExpr" => {
|
||||
result.push(FieldInfo {
|
||||
name: "is_semicolon".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
});
|
||||
}
|
||||
"SelfParam" => {
|
||||
result.push(FieldInfo {
|
||||
name: "is_amp".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
});
|
||||
}
|
||||
"UseTree" => {
|
||||
result.push(FieldInfo {
|
||||
name: "is_star".to_string(),
|
||||
ty: FieldType::Predicate,
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
result.extend(get_additional_fields(node));
|
||||
|
||||
for field in &node.fields {
|
||||
// The ArrayExpr type also has an 'exprs' field
|
||||
if node.name == "ArrayExpr" && field.method_name() == "expr" {
|
||||
continue;
|
||||
match (node.name.as_str(), field.method_name().as_str()) {
|
||||
("ArrayExpr", "expr") // The ArrayExpr type also has an 'exprs' field
|
||||
| ("PathSegment", "ty" | "path_type") // these are broken, handling them manually
|
||||
=> continue,
|
||||
_ => {}
|
||||
}
|
||||
let ty = match field {
|
||||
Field::Token(_) => continue,
|
||||
|
||||
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
||||
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
|
||||
top.rs 952b0987d831566762f61f9303ef573438ec0b17c01874b2e46c5cacc26d81d5 952b0987d831566762f61f9303ef573438ec0b17c01874b2e46c5cacc26d81d5
|
||||
top.rs 18702be33d768cc6f723201fce8c2bf2125df192c0336db9711a99f8fa7b074f 18702be33d768cc6f723201fce8c2bf2125df192c0336db9711a99f8fa7b074f
|
||||
|
||||
17
rust/extractor/src/generated/top.rs
generated
17
rust/extractor/src/generated/top.rs
generated
@@ -1996,10 +1996,8 @@ pub struct PathSegment {
|
||||
pub generic_arg_list: Option<trap::Label<GenericArgList>>,
|
||||
pub name_ref: Option<trap::Label<NameRef>>,
|
||||
pub parenthesized_arg_list: Option<trap::Label<ParenthesizedArgList>>,
|
||||
pub path_type: Option<trap::Label<PathTypeRepr>>,
|
||||
pub ret_type: Option<trap::Label<RetTypeRepr>>,
|
||||
pub return_type_syntax: Option<trap::Label<ReturnTypeSyntax>>,
|
||||
pub type_repr: Option<trap::Label<TypeRepr>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for PathSegment {
|
||||
@@ -2018,18 +2016,21 @@ impl trap::TrapEntry for PathSegment {
|
||||
if let Some(v) = self.parenthesized_arg_list {
|
||||
out.add_tuple("path_segment_parenthesized_arg_lists", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.path_type {
|
||||
out.add_tuple("path_segment_path_types", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.ret_type {
|
||||
out.add_tuple("path_segment_ret_types", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.return_type_syntax {
|
||||
out.add_tuple("path_segment_return_type_syntaxes", vec![id.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.type_repr {
|
||||
out.add_tuple("path_segment_type_reprs", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PathSegment {
|
||||
pub fn emit_type_repr(id: trap::Label<Self>, value: trap::Label<TypeRepr>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_segment_type_reprs", vec![id.into(), value.into()]);
|
||||
}
|
||||
pub fn emit_trait_type_repr(id: trap::Label<Self>, value: trap::Label<PathTypeRepr>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_segment_trait_type_reprs", vec![id.into(), value.into()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ macro_rules! emit_detached {
|
||||
(MethodCallExpr, $self:ident, $node:ident, $label:ident) => {
|
||||
$self.extract_method_canonical_destination(&$node, $label);
|
||||
};
|
||||
(PathSegment, $self:ident, $node:ident, $label:ident) => {
|
||||
$self.extract_types_from_path_segment(&$node, $label.into());
|
||||
};
|
||||
($($_:tt)*) => {};
|
||||
}
|
||||
|
||||
@@ -584,4 +587,36 @@ impl<'a> Translator<'a> {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn extract_types_from_path_segment(
|
||||
&mut self,
|
||||
item: &ast::PathSegment,
|
||||
label: Label<generated::PathSegment>,
|
||||
) {
|
||||
// work around a bug in rust-analyzer AST generation machinery
|
||||
// this code was inspired by rust-analyzer's own workaround for this:
|
||||
// https://github.com/rust-lang/rust-analyzer/blob/1f86729f29ea50e8491a1516422df4fd3d1277b0/crates/syntax/src/ast/node_ext.rs#L268-L277
|
||||
if item.l_angle_token().is_some() {
|
||||
// <T> or <T as Trait>
|
||||
// T is any TypeRef, Trait has to be a PathType
|
||||
let mut type_refs = item
|
||||
.syntax()
|
||||
.children()
|
||||
.filter(|node| ast::Type::can_cast(node.kind()));
|
||||
if let Some(t) = type_refs
|
||||
.next()
|
||||
.and_then(ast::Type::cast)
|
||||
.and_then(|t| self.emit_type(t))
|
||||
{
|
||||
generated::PathSegment::emit_type_repr(label, t, &mut self.trap.writer)
|
||||
}
|
||||
if let Some(t) = type_refs
|
||||
.next()
|
||||
.and_then(ast::PathType::cast)
|
||||
.and_then(|t| self.emit_path_type(t))
|
||||
{
|
||||
generated::PathSegment::emit_trait_type_repr(label, t, &mut self.trap.writer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
rust/extractor/src/translate/generated.rs
generated
4
rust/extractor/src/translate/generated.rs
generated
@@ -1702,19 +1702,15 @@ impl Translator<'_> {
|
||||
let generic_arg_list = node.generic_arg_list().and_then(|x| self.emit_generic_arg_list(x));
|
||||
let name_ref = node.name_ref().and_then(|x| self.emit_name_ref(x));
|
||||
let parenthesized_arg_list = node.parenthesized_arg_list().and_then(|x| self.emit_parenthesized_arg_list(x));
|
||||
let path_type = node.path_type().and_then(|x| self.emit_path_type(x));
|
||||
let ret_type = node.ret_type().and_then(|x| self.emit_ret_type(x));
|
||||
let return_type_syntax = node.return_type_syntax().and_then(|x| self.emit_return_type_syntax(x));
|
||||
let type_repr = node.ty().and_then(|x| self.emit_type(x));
|
||||
let label = self.trap.emit(generated::PathSegment {
|
||||
id: TrapId::Star,
|
||||
generic_arg_list,
|
||||
name_ref,
|
||||
parenthesized_arg_list,
|
||||
path_type,
|
||||
ret_type,
|
||||
return_type_syntax,
|
||||
type_repr,
|
||||
});
|
||||
self.emit_location(label, &node);
|
||||
emit_detached!(PathSegment, self, node, label);
|
||||
|
||||
10
rust/ql/.generated.list
generated
10
rust/ql/.generated.list
generated
@@ -574,7 +574,7 @@ lib/codeql/rust/elements/internal/generated/ParamList.qll c808c9d84dd7800573832b
|
||||
lib/codeql/rust/elements/internal/generated/ParenExpr.qll bc0731505bfe88516205ec360582a4222d2681d11342c93e15258590ddee82f2 d4bd6e0c80cf1d63746c88d4bcb3a01d4c75732e5da09e3ebd9437ced227fb60
|
||||
lib/codeql/rust/elements/internal/generated/ParenPat.qll 4f168ef5d5bb87a903251cc31b2e44a759b099ec69c90af31783fbb15778c940 0e34f94a45a13396fd57d94c245dc64d1adde2ab0e22b56946f7e94c04e297fc
|
||||
lib/codeql/rust/elements/internal/generated/ParenTypeRepr.qll 40ab5c592e7699c621787793743e33988de71ff42ca27599f5ab3ddb70e3f7d8 12c0a6eed2202ee3e892f61da3b3ce77ac3190854cdf3097e8d2be98aa3cb91d
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll a180b0d0c8c33503dc4c013c3f568eaa628d24204bfc36a7484c56a701a79f95 df002e5540bfe5de4e6849879f334b09c2ffb4893ff8364146c6c505f4b2d090
|
||||
lib/codeql/rust/elements/internal/generated/ParentChild.qll 1df63bfa8268f7db25eab70abedb8d424d892b56e92ceee8c7900cd33b1af07f cfa3d31a89303e60f4ed60ed5ca5fd04973202828aa674205d333f9fa784705f
|
||||
lib/codeql/rust/elements/internal/generated/ParenthesizedArgList.qll c5fa328ea60d3a3333d7c7bb3480969c1873166c7ac8ebb9d0afad7a8099d1a8 2dbbb6200d96f7db7dea4a55bdeab8d67b14d39a43e0bd54ada019f7e466f163
|
||||
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
|
||||
lib/codeql/rust/elements/internal/generated/Path.qll 8e47e91aff3f8c60f1ee8cb3887b8e4936c38e4665d052f2c92a939a969aac29 2c28beb89cabd7c7c91a5bc65c874f414cb96bbefde37b25811b61089a8a0053
|
||||
@@ -582,14 +582,14 @@ lib/codeql/rust/elements/internal/generated/PathAstNode.qll e6d4d5bffd3c623baaae
|
||||
lib/codeql/rust/elements/internal/generated/PathExpr.qll 34ebad4d062ce8b7e517f2ab09d52745fb8455203f4a936df7284ad296638387 ba66781cdbdeb89c27a4bfb2be0f27f85fb34978d699b4e343446fb0d7ad2aa6
|
||||
lib/codeql/rust/elements/internal/generated/PathExprBase.qll d8218e201b8557fa6d9ca2c30b764e5ad9a04a2e4fb695cc7219bbd7636a6ac2 4ef178426d7095a156f4f8c459b4d16f63abc64336cb50a6cf883a5f7ee09113
|
||||
lib/codeql/rust/elements/internal/generated/PathPat.qll 003d10a4d18681da67c7b20fcb16b15047cf9cc4b1723e7674ef74e40589cc5a 955e66f6d317ca5562ad1b5b13e1cd230c29e2538b8e86f072795b0fdd8a1c66
|
||||
lib/codeql/rust/elements/internal/generated/PathSegment.qll 274159f68ad9cd8a441efc8f2e3726858c458b51b3954742d5e09b4c6751ae86 ad274517dae84035995bea41b1b81d6d54cabe7aefae414433ecc2b54b6c808c
|
||||
lib/codeql/rust/elements/internal/generated/PathSegment.qll 10cad4c93ef8046b757c1dd9f0eb7be2d53117159ebc7c43eb071f182bff7c4b 189de31d2dc4ef76859509ce06dfab7aa58b2114176c04140bd2841c425d5b5f
|
||||
lib/codeql/rust/elements/internal/generated/PathTypeRepr.qll b847fabe7059485c5194cbc144f38dae2433057771ff10fe0b6ae9876b33afd4 ee2fdcd86d78c389a2276ebe7e889f042b7bb39c3c611f56b951591600a60e8a
|
||||
lib/codeql/rust/elements/internal/generated/PrefixExpr.qll c9ede5f2deb7b41bc8240969e8554f645057018fe96e7e9ad9c2924c8b14722b 5ae2e3c3dc8fa73e7026ef6534185afa6b0b5051804435d8b741dd3640c864e1
|
||||
lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 51d1e9e683fc79dddbffadee9015b5351bf03ce48f879da98b1f6931a61166f8 122a9c4887aa24e3f3a587b2f37c4db32633f56df3c8b696db4b8a609d9d4a98
|
||||
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f
|
||||
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
|
||||
lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll 5f812a8c841d33127bccca5d3939ad63d0a084cc4df22f43eb84df04f874b2e1 917369eb790c67405d4c32737204bcf919c5c52c5581a48f79b0d35909bb1160
|
||||
lib/codeql/rust/elements/internal/generated/Raw.qll 17037cbf4b911c74b45453d733726218512c5c8f5e890a6f0e3290fab894a237 5fb11b239f210c30823b8862385f8b9f459ef8b62d47b6b50ba560e4ce2cac7c
|
||||
lib/codeql/rust/elements/internal/generated/RecordExpr.qll 2131b2cb336caa76170082e69776011bf02576bbfdd34ba68ca84af24209250a 39a2e3ec32352b594c43cc1295e0e8b3f9808173322d3d73cb7d48ef969d5565
|
||||
lib/codeql/rust/elements/internal/generated/RecordExprField.qll 7e9f8663d3b74ebbc9603b10c9912f082febba6bd73d344b100bbd3edf837802 fbe6b578e7fd5d5a6f21bbb8c388957ab7210a6a249ec71510a50fb35b319ea1
|
||||
lib/codeql/rust/elements/internal/generated/RecordExprFieldList.qll 179a97211fe7aa6265085d4d54115cdbc0e1cd7c9b2135591e8f36d6432f13d3 dd44bbbc1e83a1ed3a587afb729d7debf7aeb7b63245de181726af13090e50c0
|
||||
@@ -989,13 +989,13 @@ test/extractor-tests/generated/Path/PathPat.ql 6b9d973009f1b4963c7c83b0f5051eda7
|
||||
test/extractor-tests/generated/Path/PathPat_getPath.ql 6c0c71c80a6e631ea7775ec8660b470ff6b264bab14a399606cf113b1fb190fc 8e34cbb4d064db929e94652e1901ec4f26affa71e30e556b7acdff71dd622cbb
|
||||
test/extractor-tests/generated/Path/PathPat_getResolvedCrateOrigin.ql f690fd9a8773e7c73b70f2d64ee919fef8eee243c5a315c4a6d2713d43ea0e43 f37817427c36cec14a2e07f99d3a32f37f3f27a8eafdf170749ec2780054729b
|
||||
test/extractor-tests/generated/Path/PathPat_getResolvedPath.ql 55df4541a7b0e82198acfcedd7dc99eb564908270e4fb2b032bf05e40fba6fef a5932d884903da901263f88644c8585a45045190d7204f630506c5aece798288
|
||||
test/extractor-tests/generated/Path/PathSegment.ql efd7f32edbd71f86b905fd63b8cbe4d6fcd6176390fc460a3a5a9375281c296e fb30126596a51e6f6c7470ef79b6c90b7057c5399f0de2d45787c60db74dbfb4
|
||||
test/extractor-tests/generated/Path/PathSegment.ql e75c820f7cf8c94cae72053ee3cadd6b60e342b78d03d310fa94f16a5776a096 b90af2408bbfc684f156ce053be91639f9f011c0aeff9a1f51a5865b285f6e66
|
||||
test/extractor-tests/generated/Path/PathSegment_getGenericArgList.ql 8f6e67b3e316309f20e21d7e7944accf66b0256b76fa50ee9a714044c6ec8cea 15f10a701fc4d3f9fd6734da90790cdbc8a1ddd57bf52695740acedcb2e6e485
|
||||
test/extractor-tests/generated/Path/PathSegment_getNameRef.ql 799d284e2f9267d6bbe67aa7035e525ef347dc74cb3e2180e7b2171b5cb49674 592130bc2358989536abf62e8a261272c851483ede4f19783f7d61ffc1803e4b
|
||||
test/extractor-tests/generated/Path/PathSegment_getParenthesizedArgList.ql 0d5919b0a240678d84dc687de954ef6dc11fe4a20f54c56578c541c573bdf3f2 5d2094ad5c0b0b7f298260511c5072b129b121928394b27c49d39e69ba6a5870
|
||||
test/extractor-tests/generated/Path/PathSegment_getPathType.ql 01942da6d0b10c1d15caec6abb8c53f1dc7f8c04a91a797f572063aa003dbc4b cb21e6cb160652527ba571265297dae86beffe191dd7dfc4d0beee45cb0cda29
|
||||
test/extractor-tests/generated/Path/PathSegment_getRetType.ql 36386a514bc925f5b17ad87afba9fef7986900c1b791732de061213c6e86743f f38bcee68c1da19e70bb1e1c4a4047c763a466f1b8ef2c4f65f8c724c0b58197
|
||||
test/extractor-tests/generated/Path/PathSegment_getReturnTypeSyntax.ql d1db51208a311c30af369ce2fdc3a3296e7d598b27bf4960b8b34622a9d9163b 561b1e38c6d8b301fdc016e1d012dd805fde1b42b0720c17d7b15535715047f2
|
||||
test/extractor-tests/generated/Path/PathSegment_getTraitTypeRepr.ql d7ea6ee3f6b7539786d8de92db1b5e3bb88f0da9096293107e39065a09aad20e 19e05a303472c25115a9e3cb60943109eaf4788d6ed1d37ac2114b58bb94ef04
|
||||
test/extractor-tests/generated/Path/PathSegment_getTypeRepr.ql d9d8ff43a55671616bd5b98ff2c03690ec2661817d19a61edcc4b37d23e312d0 b4dc0ae4d7f03c98c23312b358d214565b34c7a028ba8983826c6bf5c1177eeb
|
||||
test/extractor-tests/generated/Path/PathTypeRepr.ql c2e069acc5111088a7287d98b4bd4bf44bd79c5a786b275f7448ebafc3613500 6e016750e5fef92a98bc5cc60bfd40d85fbb5eb2d251b4d69ffe600813f81df0
|
||||
test/extractor-tests/generated/Path/PathTypeRepr_getPath.ql 49e96ea2aa482e3b80cb0e2d944055f8298f7fc55b36cea7468586c94bacf686 29b3c2140ac1bc6e0e6160140e292e2b84e13145c1553480e2a582cd7f7bd3fd
|
||||
|
||||
2
rust/ql/.gitattributes
generated
vendored
2
rust/ql/.gitattributes
generated
vendored
@@ -995,9 +995,9 @@
|
||||
/test/extractor-tests/generated/Path/PathSegment_getGenericArgList.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getNameRef.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getParenthesizedArgList.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getPathType.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getRetType.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getReturnTypeSyntax.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getTraitTypeRepr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathSegment_getTypeRepr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathTypeRepr.ql linguist-generated
|
||||
/test/extractor-tests/generated/Path/PathTypeRepr_getPath.ql linguist-generated
|
||||
|
||||
@@ -45,7 +45,7 @@ module Impl {
|
||||
ps = this.getPart() and
|
||||
not ps.hasGenericArgList() and
|
||||
not ps.hasParenthesizedArgList() and
|
||||
not ps.hasPathType() and
|
||||
not ps.hasTypeRepr() and
|
||||
not ps.hasReturnTypeSyntax() and
|
||||
name = ps.getNameRef().getText()
|
||||
)
|
||||
|
||||
@@ -24,9 +24,7 @@ module Impl {
|
||||
|
||||
private string toAbbreviatedStringPart(int index) {
|
||||
index = 0 and
|
||||
if this.hasPathType() or this.hasTypeRepr()
|
||||
then result = "<...>"
|
||||
else result = this.getNameRef().getText()
|
||||
if this.hasTypeRepr() then result = "<...>" else result = this.getNameRef().getText()
|
||||
or
|
||||
index = 1 and result = this.getGenericArgList().toAbbreviatedString()
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ private module Impl {
|
||||
) {
|
||||
exists(
|
||||
int b, int bAstNode, int n, int nGenericArgList, int nNameRef, int nParenthesizedArgList,
|
||||
int nPathType, int nRetType, int nReturnTypeSyntax, int nTypeRepr
|
||||
int nRetType, int nReturnTypeSyntax, int nTypeRepr, int nTraitTypeRepr
|
||||
|
|
||||
b = 0 and
|
||||
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
|
||||
@@ -813,10 +813,10 @@ private module Impl {
|
||||
nGenericArgList = n + 1 and
|
||||
nNameRef = nGenericArgList + 1 and
|
||||
nParenthesizedArgList = nNameRef + 1 and
|
||||
nPathType = nParenthesizedArgList + 1 and
|
||||
nRetType = nPathType + 1 and
|
||||
nRetType = nParenthesizedArgList + 1 and
|
||||
nReturnTypeSyntax = nRetType + 1 and
|
||||
nTypeRepr = nReturnTypeSyntax + 1 and
|
||||
nTraitTypeRepr = nTypeRepr + 1 and
|
||||
(
|
||||
none()
|
||||
or
|
||||
@@ -831,10 +831,8 @@ private module Impl {
|
||||
partialPredicateCall = "ParenthesizedArgList()"
|
||||
or
|
||||
index = nParenthesizedArgList and
|
||||
result = e.getPathType() and
|
||||
partialPredicateCall = "PathType()"
|
||||
or
|
||||
index = nPathType and result = e.getRetType() and partialPredicateCall = "RetType()"
|
||||
result = e.getRetType() and
|
||||
partialPredicateCall = "RetType()"
|
||||
or
|
||||
index = nRetType and
|
||||
result = e.getReturnTypeSyntax() and
|
||||
@@ -843,6 +841,10 @@ private module Impl {
|
||||
index = nReturnTypeSyntax and
|
||||
result = e.getTypeRepr() and
|
||||
partialPredicateCall = "TypeRepr()"
|
||||
or
|
||||
index = nTypeRepr and
|
||||
result = e.getTraitTypeRepr() and
|
||||
partialPredicateCall = "TraitTypeRepr()"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -73,21 +73,6 @@ module Generated {
|
||||
*/
|
||||
final predicate hasParenthesizedArgList() { exists(this.getParenthesizedArgList()) }
|
||||
|
||||
/**
|
||||
* Gets the path type of this path segment, if it exists.
|
||||
*/
|
||||
PathTypeRepr getPathType() {
|
||||
result =
|
||||
Synth::convertPathTypeReprFromRaw(Synth::convertPathSegmentToRaw(this)
|
||||
.(Raw::PathSegment)
|
||||
.getPathType())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getPathType()` exists.
|
||||
*/
|
||||
final predicate hasPathType() { exists(this.getPathType()) }
|
||||
|
||||
/**
|
||||
* Gets the ret type of this path segment, if it exists.
|
||||
*/
|
||||
@@ -132,5 +117,20 @@ module Generated {
|
||||
* Holds if `getTypeRepr()` exists.
|
||||
*/
|
||||
final predicate hasTypeRepr() { exists(this.getTypeRepr()) }
|
||||
|
||||
/**
|
||||
* Gets the trait type representation of this path segment, if it exists.
|
||||
*/
|
||||
PathTypeRepr getTraitTypeRepr() {
|
||||
result =
|
||||
Synth::convertPathTypeReprFromRaw(Synth::convertPathSegmentToRaw(this)
|
||||
.(Raw::PathSegment)
|
||||
.getTraitTypeRepr())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `getTraitTypeRepr()` exists.
|
||||
*/
|
||||
final predicate hasTraitTypeRepr() { exists(this.getTraitTypeRepr()) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,11 +698,6 @@ module Raw {
|
||||
path_segment_parenthesized_arg_lists(this, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path type of this path segment, if it exists.
|
||||
*/
|
||||
PathTypeRepr getPathType() { path_segment_path_types(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the ret type of this path segment, if it exists.
|
||||
*/
|
||||
@@ -717,6 +712,11 @@ module Raw {
|
||||
* Gets the type representation of this path segment, if it exists.
|
||||
*/
|
||||
TypeRepr getTypeRepr() { path_segment_type_reprs(this, result) }
|
||||
|
||||
/**
|
||||
* Gets the trait type representation of this path segment, if it exists.
|
||||
*/
|
||||
PathTypeRepr getTraitTypeRepr() { path_segment_trait_type_reprs(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -754,12 +754,6 @@ path_segment_parenthesized_arg_lists(
|
||||
int parenthesized_arg_list: @parenthesized_arg_list ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
path_segment_path_types(
|
||||
int id: @path_segment ref,
|
||||
int path_type: @path_type_repr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
path_segment_ret_types(
|
||||
int id: @path_segment ref,
|
||||
@@ -778,6 +772,12 @@ path_segment_type_reprs(
|
||||
int type_repr: @type_repr ref
|
||||
);
|
||||
|
||||
#keyset[id]
|
||||
path_segment_trait_type_reprs(
|
||||
int id: @path_segment ref,
|
||||
int trait_type_repr: @path_type_repr ref
|
||||
);
|
||||
|
||||
record_expr_fields(
|
||||
unique int id: @record_expr_field
|
||||
);
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
| gen_path_expr.rs:7:13:7:15 | <...> | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:7:13:7:20 | ...::foo | hasQualifier: | yes | hasPart: | yes |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:8:13:8:31 | <...> | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:8:13:8:36 | ...::foo | hasQualifier: | yes | hasPart: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_pat.rs:5:11:5:11 | x | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_pat.rs:6:9:6:11 | Foo | hasQualifier: | no | hasPart: | yes |
|
||||
| gen_path_pat.rs:6:9:6:16 | ...::Bar | hasQualifier: | yes | hasPart: | yes |
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
| gen_path.rs:5:9:5:18 | some_crate | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path.rs:5:21:5:31 | some_module | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path.rs:5:34:5:42 | some_item | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path.rs:6:5:6:7 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path.rs:6:10:6:12 | bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:5:13:5:20 | variable | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:6:13:6:15 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:6:18:6:20 | bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:13:7:15 | <...> | hasGenericArgList: | no | hasNameRef: | no | hasParenthesizedArgList: | no | hasPathType: | yes | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | yes |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:18:7:20 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:13:8:31 | <...> | hasGenericArgList: | no | hasNameRef: | no | hasParenthesizedArgList: | no | hasPathType: | yes | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:34:8:36 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_pat.rs:5:11:5:11 | x | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_pat.rs:6:9:6:11 | Foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_pat.rs:6:14:6:16 | Bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:14:5:16 | std | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:19:5:29 | collections | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:32:5:48 | HashMap::<...> | hasGenericArgList: | yes | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:40:5:42 | i32 | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:45:5:47 | i32 | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:6:14:6:14 | X | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:6:17:6:20 | Item | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasPathType: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no |
|
||||
| gen_path.rs:5:9:5:18 | some_crate | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path.rs:5:21:5:31 | some_module | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path.rs:5:34:5:42 | some_item | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path.rs:6:5:6:7 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path.rs:6:10:6:12 | bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:5:13:5:20 | variable | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:6:13:6:15 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:6:18:6:20 | bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:13:7:15 | <...> | hasGenericArgList: | no | hasNameRef: | no | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | yes | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:7:18:7:20 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:13:8:31 | <...> | hasGenericArgList: | no | hasNameRef: | no | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | yes | hasTraitTypeRepr: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_expr.rs:8:34:8:36 | foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_pat.rs:5:11:5:11 | x | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_pat.rs:6:9:6:11 | Foo | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_pat.rs:6:14:6:16 | Bar | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:14:5:16 | std | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:19:5:29 | collections | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:32:5:48 | HashMap::<...> | hasGenericArgList: | yes | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:40:5:42 | i32 | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:5:45:5:47 | i32 | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:6:14:6:14 | X | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
| gen_path_type_repr.rs:6:17:6:20 | Item | hasGenericArgList: | no | hasNameRef: | yes | hasParenthesizedArgList: | no | hasRetType: | no | hasReturnTypeSyntax: | no | hasTypeRepr: | no | hasTraitTypeRepr: | no |
|
||||
|
||||
@@ -4,7 +4,7 @@ import TestUtils
|
||||
|
||||
from
|
||||
PathSegment x, string hasGenericArgList, string hasNameRef, string hasParenthesizedArgList,
|
||||
string hasPathType, string hasRetType, string hasReturnTypeSyntax, string hasTypeRepr
|
||||
string hasRetType, string hasReturnTypeSyntax, string hasTypeRepr, string hasTraitTypeRepr
|
||||
where
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -15,10 +15,11 @@ where
|
||||
then hasParenthesizedArgList = "yes"
|
||||
else hasParenthesizedArgList = "no"
|
||||
) and
|
||||
(if x.hasPathType() then hasPathType = "yes" else hasPathType = "no") and
|
||||
(if x.hasRetType() then hasRetType = "yes" else hasRetType = "no") and
|
||||
(if x.hasReturnTypeSyntax() then hasReturnTypeSyntax = "yes" else hasReturnTypeSyntax = "no") and
|
||||
if x.hasTypeRepr() then hasTypeRepr = "yes" else hasTypeRepr = "no"
|
||||
(if x.hasTypeRepr() then hasTypeRepr = "yes" else hasTypeRepr = "no") and
|
||||
if x.hasTraitTypeRepr() then hasTraitTypeRepr = "yes" else hasTraitTypeRepr = "no"
|
||||
select x, "hasGenericArgList:", hasGenericArgList, "hasNameRef:", hasNameRef,
|
||||
"hasParenthesizedArgList:", hasParenthesizedArgList, "hasPathType:", hasPathType, "hasRetType:",
|
||||
hasRetType, "hasReturnTypeSyntax:", hasReturnTypeSyntax, "hasTypeRepr:", hasTypeRepr
|
||||
"hasParenthesizedArgList:", hasParenthesizedArgList, "hasRetType:", hasRetType,
|
||||
"hasReturnTypeSyntax:", hasReturnTypeSyntax, "hasTypeRepr:", hasTypeRepr, "hasTraitTypeRepr:",
|
||||
hasTraitTypeRepr
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
| gen_path_expr.rs:6:13:6:15 | foo | gen_path_expr.rs:6:13:6:15 | foo |
|
||||
| gen_path_expr.rs:6:18:6:20 | bar | gen_path_expr.rs:6:18:6:20 | bar |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:7:18:7:20 | foo | gen_path_expr.rs:7:18:7:20 | foo |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | gen_path_expr.rs:8:26:8:30 | Trait |
|
||||
| gen_path_expr.rs:8:34:8:36 | foo | gen_path_expr.rs:8:34:8:36 | foo |
|
||||
| gen_path_pat.rs:5:11:5:11 | x | gen_path_pat.rs:5:11:5:11 | x |
|
||||
| gen_path_pat.rs:6:9:6:11 | Foo | gen_path_pat.rs:6:9:6:11 | Foo |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| gen_path_expr.rs:8:13:8:31 | <...> | gen_path_expr.rs:8:26:8:30 | Trait |
|
||||
@@ -4,4 +4,4 @@ import TestUtils
|
||||
|
||||
from PathSegment x
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, x.getPathType()
|
||||
select x, x.getTraitTypeRepr()
|
||||
@@ -1,7 +1,6 @@
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasPath: | yes |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | hasPath: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasPath: | yes |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | hasPath: | yes |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | hasPath: | yes |
|
||||
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | hasPath: | yes |
|
||||
| gen_path_type_repr.rs:5:40:5:42 | i32 | hasPath: | yes |
|
||||
| gen_path_type_repr.rs:5:45:5:47 | i32 | hasPath: | yes |
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | gen_path_expr.rs:8:26:8:30 | Trait |
|
||||
| gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> | gen_path_type_repr.rs:5:14:5:48 | ...::HashMap::<...> |
|
||||
| gen_path_type_repr.rs:5:40:5:42 | i32 | gen_path_type_repr.rs:5:40:5:42 | i32 |
|
||||
| gen_path_type_repr.rs:5:45:5:47 | i32 | gen_path_type_repr.rs:5:45:5:47 | i32 |
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
| gen_path_expr.rs:7:13:7:15 | <...> | gen_path_expr.rs:7:13:7:15 | <...> |
|
||||
| gen_path_expr.rs:7:13:7:20 | ...::foo | gen_path_expr.rs:7:18:7:20 | foo |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:7:14:7:14 | T | gen_path_expr.rs:7:14:7:14 | T |
|
||||
| gen_path_expr.rs:8:13:8:31 | <...> | gen_path_expr.rs:8:13:8:31 | <...> |
|
||||
| gen_path_expr.rs:8:13:8:36 | ...::foo | gen_path_expr.rs:8:34:8:36 | foo |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:14:8:21 | TypeRepr | gen_path_expr.rs:8:14:8:21 | TypeRepr |
|
||||
| gen_path_expr.rs:8:26:8:30 | Trait | gen_path_expr.rs:8:26:8:30 | Trait |
|
||||
| gen_path_pat.rs:5:11:5:11 | x | gen_path_pat.rs:5:11:5:11 | x |
|
||||
| gen_path_pat.rs:6:9:6:11 | Foo | gen_path_pat.rs:6:9:6:11 | Foo |
|
||||
| gen_path_pat.rs:6:9:6:16 | ...::Bar | gen_path_pat.rs:6:14:6:16 | Bar |
|
||||
|
||||
@@ -1439,7 +1439,8 @@ class _:
|
||||
"""
|
||||
A path segment, which is one part of a whole path.
|
||||
"""
|
||||
|
||||
type_repr: optional["TypeRepr"] | child | rust.detach
|
||||
trait_type_repr: optional["PathTypeRepr"] | child | rust.detach
|
||||
|
||||
@annotate(PathTypeRepr)
|
||||
@qltest.test_with(Path)
|
||||
|
||||
2
rust/schema/ast.py
generated
2
rust/schema/ast.py
generated
@@ -492,10 +492,8 @@ class PathSegment(AstNode, ):
|
||||
generic_arg_list: optional["GenericArgList"] | child
|
||||
name_ref: optional["NameRef"] | child
|
||||
parenthesized_arg_list: optional["ParenthesizedArgList"] | child
|
||||
path_type: optional["PathTypeRepr"] | child
|
||||
ret_type: optional["RetTypeRepr"] | child
|
||||
return_type_syntax: optional["ReturnTypeSyntax"] | child
|
||||
type_repr: optional["TypeRepr"] | child
|
||||
|
||||
class PathTypeRepr(TypeRepr, ):
|
||||
path: optional["Path"] | child
|
||||
|
||||
Reference in New Issue
Block a user