generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Description
Update: the discrepancy is in fact due to Kani assuming panic=abort, but the Rust compiler assuming panic=unwind by default.
In #1378 (comment), it was observed that Kani sometimes reports a different size of a generator than the LLVM backend of rustc. Interestingly, the WASM backend seems to disagree with LLVM as well (see rust-lang/rust#62807).
The example code is the following:
#![feature(generators, generator_trait)]
use std::ops::Generator;
const FOO_SIZE: usize = 1024;
struct Foo([u8; FOO_SIZE]);
impl Drop for Foo {
fn drop(&mut self) {}
}
fn noop() {}
fn move_before_yield_with_noop() -> impl Generator<Yield = (), Return = ()> {
static || {
let first = Foo([0; FOO_SIZE]);
noop();
let _second = first;
yield;
// _second dropped here
}
}
fn main() {
// This fails for Kani: it thinks the size is 1025, and so does the WASM backend.
assert_eq!(1026, std::mem::size_of_val(&move_before_yield_with_noop()));
}Reactions are currently unavailable