Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions rust/ql/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions rust/ql/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ module Impl {
predicate isInReturnPos() {
exists(Function f | f.getRetType().getTypeRepr() = this.getFunctionTypeRepr(f))
}

override string toStringImpl() {
result = "impl " + this.getTypeBoundList().toAbbreviatedString()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ module Impl {
* ```
*/
class Lifetime extends Generated::Lifetime {
override string toStringImpl() {
override string toStringImpl() { result = this.toAbbreviatedString() }

override string toAbbreviatedString() {
result = this.getText()
or
not this.hasText() and result = "'_"
Expand Down
11 changes: 9 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/TypeBoundImpl.qll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `TypeBound`.
*
Expand All @@ -12,6 +11,7 @@ private import codeql.rust.elements.internal.generated.TypeBound
* be referenced directly.
*/
module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* A type bound in a trait or generic parameter.
*
Expand All @@ -23,5 +23,12 @@ module Impl {
* // ^^^^^^^^^^^^^^^^^^^^^
* ```
*/
class TypeBound extends Generated::TypeBound { }
class TypeBound extends Generated::TypeBound {
override string toAbbreviatedString() {
result = this.getLifetime().toAbbreviatedString()
or
not this.hasLifetime() and
result = "..."
}
}
}
14 changes: 12 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/TypeBoundListImpl.qll
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `TypeBoundList`.
*
Expand All @@ -12,6 +11,7 @@ private import codeql.rust.elements.internal.generated.TypeBoundList
* be referenced directly.
*/
module Impl {
// the following QLdoc is generated: if you need to edit it, do it in the schema file
/**
* A list of type bounds.
*
Expand All @@ -21,5 +21,15 @@ module Impl {
* // ^^^^^^^^^^^^^
* ```
*/
class TypeBoundList extends Generated::TypeBoundList { }
class TypeBoundList extends Generated::TypeBoundList {
override string toStringImpl() { result = this.toAbbreviatedString() }

private string toAbbreviatedStringPart(int index) {
result = this.getBound(index).toAbbreviatedString()
}

override string toAbbreviatedString() {
result = strictconcat(int i | | this.toAbbreviatedStringPart(i), " + " order by i)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ getRetType
getReturnTypeSyntax
getTypeRepr
getTypeBoundList
| gen_assoc_type_arg.rs:9:21:9:31 | AssocTypeArg | gen_assoc_type_arg.rs:9:27:9:31 | TypeBoundList |
| gen_assoc_type_arg.rs:9:21:9:31 | AssocTypeArg | gen_assoc_type_arg.rs:9:27:9:31 | ... |
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
instances
| gen_dyn_trait_type_repr.rs:7:13:7:21 | DynTraitTypeRepr |
getTypeBoundList
| gen_dyn_trait_type_repr.rs:7:13:7:21 | DynTraitTypeRepr | gen_dyn_trait_type_repr.rs:7:17:7:21 | TypeBoundList |
| gen_dyn_trait_type_repr.rs:7:13:7:21 | DynTraitTypeRepr | gen_dyn_trait_type_repr.rs:7:17:7:21 | ... |
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
instances
| gen_impl_trait_type_repr.rs:7:17:7:41 | ImplTraitTypeRepr |
| gen_impl_trait_type_repr.rs:7:17:7:41 | impl ... |
getTypeBoundList
| gen_impl_trait_type_repr.rs:7:17:7:41 | ImplTraitTypeRepr | gen_impl_trait_type_repr.rs:7:22:7:41 | TypeBoundList |
| gen_impl_trait_type_repr.rs:7:17:7:41 | impl ... | gen_impl_trait_type_repr.rs:7:22:7:41 | ... |
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ getGenericParamList
getName
| gen_trait_alias.rs:7:5:7:26 | TraitAlias | gen_trait_alias.rs:7:11:7:13 | Foo |
getTypeBoundList
| gen_trait_alias.rs:7:5:7:26 | TraitAlias | gen_trait_alias.rs:7:17:7:25 | TypeBoundList |
| gen_trait_alias.rs:7:5:7:26 | TraitAlias | gen_trait_alias.rs:7:17:7:25 | ... + ... |
getVisibility
getWhereClause
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
instances
| gen_type_bound_list.rs:7:15:7:27 | TypeBoundList |
| gen_type_bound_list.rs:7:15:7:27 | ... + ... |
getBound
| gen_type_bound_list.rs:7:15:7:27 | TypeBoundList | 0 | gen_type_bound_list.rs:7:15:7:19 | TypeBound |
| gen_type_bound_list.rs:7:15:7:27 | TypeBoundList | 1 | gen_type_bound_list.rs:7:23:7:27 | TypeBound |
| gen_type_bound_list.rs:7:15:7:27 | ... + ... | 0 | gen_type_bound_list.rs:7:15:7:19 | TypeBound |
| gen_type_bound_list.rs:7:15:7:27 | ... + ... | 1 | gen_type_bound_list.rs:7:23:7:27 | TypeBound |
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ getTypeRepr
| gen_where_pred.rs:7:46:7:53 | WherePred | gen_where_pred.rs:7:46:7:46 | U |
| gen_where_pred.rs:9:31:9:54 | WherePred | gen_where_pred.rs:9:39:9:39 | T |
getTypeBoundList
| gen_where_pred.rs:7:36:7:43 | WherePred | gen_where_pred.rs:7:39:7:43 | TypeBoundList |
| gen_where_pred.rs:7:46:7:53 | WherePred | gen_where_pred.rs:7:49:7:53 | TypeBoundList |
| gen_where_pred.rs:9:31:9:54 | WherePred | gen_where_pred.rs:9:42:9:54 | TypeBoundList |
| gen_where_pred.rs:7:36:7:43 | WherePred | gen_where_pred.rs:7:39:7:43 | ... |
| gen_where_pred.rs:7:46:7:53 | WherePred | gen_where_pred.rs:7:49:7:53 | ... |
| gen_where_pred.rs:9:31:9:54 | WherePred | gen_where_pred.rs:9:42:9:54 | ... |
Loading
Loading