Skip to content

Commit 75cab96

Browse files
committed
Rust: Make AnyTraitFn abstract
1 parent 78b88d3 commit 75cab96

File tree

1 file changed

+6
-4
lines changed
  • rust/ql/lib/codeql/rust/frameworks/stdlib

1 file changed

+6
-4
lines changed

rust/ql/lib/codeql/rust/frameworks/stdlib/Stdlib.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,19 @@ class FutureTrait extends Trait {
144144
}
145145

146146
/** A function trait `FnOnce`, `FnMut`, or `Fn`. */
147-
class AnyFnTrait extends Trait {
147+
abstract private class AnyFnTraitImpl extends Trait {
148148
/** Gets the `Args` type parameter of this trait. */
149149
TypeParam getTypeParam() { result = this.getGenericParamList().getGenericParam(0) }
150150
}
151151

152+
final class AnyFnTrait = AnyFnTraitImpl;
153+
152154
/**
153155
* The [`FnOnce` trait][1].
154156
*
155157
* [1]: https://doc.rust-lang.org/std/ops/trait.FnOnce.html
156158
*/
157-
class FnOnceTrait extends AnyFnTrait {
159+
class FnOnceTrait extends AnyFnTraitImpl {
158160
pragma[nomagic]
159161
FnOnceTrait() { this.getCanonicalPath() = "core::ops::function::FnOnce" }
160162

@@ -168,7 +170,7 @@ class FnOnceTrait extends AnyFnTrait {
168170
*
169171
* [1]: https://doc.rust-lang.org/std/ops/trait.FnMut.html
170172
*/
171-
class FnMutTrait extends AnyFnTrait {
173+
class FnMutTrait extends AnyFnTraitImpl {
172174
pragma[nomagic]
173175
FnMutTrait() { this.getCanonicalPath() = "core::ops::function::FnMut" }
174176
}
@@ -178,7 +180,7 @@ class FnMutTrait extends AnyFnTrait {
178180
*
179181
* [1]: https://doc.rust-lang.org/std/ops/trait.Fn.html
180182
*/
181-
class FnTrait extends AnyFnTrait {
183+
class FnTrait extends AnyFnTraitImpl {
182184
pragma[nomagic]
183185
FnTrait() { this.getCanonicalPath() = "core::ops::function::Fn" }
184186
}

0 commit comments

Comments
 (0)