Skip to content
Merged
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
7 changes: 7 additions & 0 deletions rust/ql/lib/codeql/rust/internal/typeinference/Type.qll
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ abstract class Type extends TType {
class TupleType extends StructType {
private int arity;

pragma[nomagic]
TupleType() { arity = this.getTypeItem().(Builtins::TupleType).getArity() }

/** Gets the arity of this tuple type. */
Expand Down Expand Up @@ -203,6 +204,7 @@ class TraitType extends Type, TTrait {
* Array types like `[i64; 5]` are modeled as normal generic types.
*/
class ArrayType extends StructType {
pragma[nomagic]
ArrayType() { this.getTypeItem() instanceof Builtins::ArrayType }

override string toString() { result = "[;]" }
Expand All @@ -216,12 +218,14 @@ TypeParamTypeParameter getArrayTypeParameter() {
abstract class RefType extends StructType { }

class RefMutType extends RefType {
pragma[nomagic]
RefMutType() { this.getTypeItem() instanceof Builtins::RefMutType }

override string toString() { result = "&mut" }
}

class RefSharedType extends RefType {
pragma[nomagic]
RefSharedType() { this.getTypeItem() instanceof Builtins::RefSharedType }

override string toString() { result = "&" }
Expand Down Expand Up @@ -312,6 +316,7 @@ class ImplTraitReturnType extends ImplTraitType {
* with a single type argument.
*/
class SliceType extends StructType {
pragma[nomagic]
SliceType() { this.getTypeItem() instanceof Builtins::SliceType }

override string toString() { result = "[]" }
Expand All @@ -338,12 +343,14 @@ TypeParamTypeParameter getPtrTypeParameter() {
}

class PtrMutType extends PtrType {
pragma[nomagic]
PtrMutType() { this.getTypeItem() instanceof Builtins::PtrMutType }

override string toString() { result = "*mut" }
}

class PtrConstType extends PtrType {
pragma[nomagic]
PtrConstType() { this.getTypeItem() instanceof Builtins::PtrConstType }

override string toString() { result = "*const" }
Expand Down
Loading