Skip to content

Commit 6e03039

Browse files
markrtuttleMark R. Tuttle
authored andcommitted
Add box mut dyn trait regression test (rust-lang#108)
This resolves issue model-checking/kani#34 Co-authored-by: Mark R. Tuttle <[email protected]>
1 parent 05c8ed9 commit 6e03039

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
use std::io::{sink, Write};
5+
6+
fn main() {
7+
let mut log: Box<dyn Write + Send> = Box::new(sink());
8+
let dest: Box<dyn Write + Send> = Box::new(log.as_mut());
9+
10+
let mut log2: Box<dyn Write + Send> = Box::new(sink());
11+
let buffer = vec![1, 2, 3, 5, 8];
12+
let num_bytes = log2.write(&buffer).unwrap();
13+
assert!(num_bytes == 5);
14+
}

0 commit comments

Comments
 (0)