|
12 | 12 | // re-export all std symbols
|
13 | 13 | pub use std::*;
|
14 | 14 |
|
| 15 | +// Bind `core::assert` to a different name to avoid possible name conflicts if a |
| 16 | +// crate uses `extern crate std as core`. See |
| 17 | +// https://github.com/model-checking/kani/issues/1949 |
| 18 | +#[allow(unused_imports)] |
| 19 | +use core::assert as __kani__workaround_core_assert; |
| 20 | + |
15 | 21 | // Override process calls with stubs.
|
16 | 22 | pub mod process;
|
17 | 23 |
|
@@ -54,7 +60,7 @@ macro_rules! assert {
|
54 | 60 | // strategy, which is tracked in
|
55 | 61 | // https://github.com/model-checking/kani/issues/692
|
56 | 62 | if false {
|
57 |
| - ::core::assert!(true, $($arg)+); |
| 63 | + __kani__workaround_core_assert!(true, $($arg)+); |
58 | 64 | }
|
59 | 65 | }};
|
60 | 66 | }
|
@@ -158,7 +164,7 @@ macro_rules! unreachable {
|
158 | 164 | // handle.
|
159 | 165 | ($fmt:expr, $($arg:tt)*) => {{
|
160 | 166 | if false {
|
161 |
| - ::core::assert!(true, $fmt, $($arg)+); |
| 167 | + __kani__workaround_core_assert!(true, $fmt, $($arg)+); |
162 | 168 | }
|
163 | 169 | kani::panic(concat!("internal error: entered unreachable code: ",
|
164 | 170 | stringify!($fmt, $($arg)*)))}};
|
@@ -190,7 +196,7 @@ macro_rules! panic {
|
190 | 196 | // `panic!("Error: {}", code);`
|
191 | 197 | ($($arg:tt)+) => {{
|
192 | 198 | if false {
|
193 |
| - ::core::assert!(true, $($arg)+); |
| 199 | + __kani__workaround_core_assert!(true, $($arg)+); |
194 | 200 | }
|
195 | 201 | kani::panic(stringify!($($arg)+));
|
196 | 202 | }};
|
|
0 commit comments