forked from model-checking/kani
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use fully-qualified name for size_of (model-checking#3838)
Add `core::mem::` prefix to all uses of `size_of`. Background: in some cases, I get errors of the form: ``` Compiling kani_core v0.58.0 (https://github.com/model-checking/kani#35015dce) error[E0425]: cannot find function `size_of` in this scope --> /home/ubuntu/.cargo/git/checkouts/kani-0ce0dacf5e98886d/35015dc/library/kani/src/lib.rs:54:1 | 54 | kani_core::kani_lib!(kani); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | = help: consider importing one of these items: core::mem::size_of crate::core_path::intrinsics::size_of crate::core_path::mem::size_of std::mem::size_of = note: this error originates in the macro `kani_core::ptr_generator` which comes from the expansion of the macro `kani_core::kani_lib` (in Nightly builds, run with -Z macro-backtrace for more info) ``` when adding the Kani library as a dependency. Adding `core::mem::` fixes those issues. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
- Loading branch information
1 parent
35015dc
commit 6f70c7d
Showing
7 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
[package] | ||
name = "kani_lib_dep" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
kani_core = { path = "../../../library/kani_core" } | ||
kani = { path = "../../../library/kani" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Test building a crate that has the Kani library as a dependency | ||
|
||
set -e | ||
|
||
rm -rf target | ||
|
||
set -e | ||
cargo build | ||
|
||
rm -rf target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
script: build.sh | ||
expected: expected | ||
exit_code: 0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use kani::Arbitrary; | ||
|
||
struct Foo { | ||
x: i32, | ||
y: i32, | ||
z: i32, | ||
} | ||
|
||
impl Arbitrary for Foo { | ||
fn any() -> Self { | ||
Foo { x: 3, y: 4, z: 5 } | ||
} | ||
} | ||
|
||
fn main() { | ||
let f: Foo = kani::any(); | ||
assert_eq!(f.x, 3); | ||
assert_eq!(f.y, 4); | ||
assert_eq!(f.z, 5); | ||
} |