-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
508 additions
and
131 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
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
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,50 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// Check drop implementation for a boxed dynamic trait object. | ||
|
||
include!("../../rmc-prelude.rs"); | ||
|
||
static mut CELL: i32 = 0; | ||
|
||
trait T { | ||
fn t(&self) {} | ||
} | ||
|
||
struct Concrete1; | ||
|
||
impl T for Concrete1 {} | ||
|
||
impl Drop for Concrete1 { | ||
fn drop(&mut self) { | ||
unsafe { | ||
CELL = 1; | ||
} | ||
} | ||
} | ||
|
||
struct Concrete2; | ||
|
||
impl T for Concrete2 {} | ||
|
||
impl Drop for Concrete2 { | ||
fn drop(&mut self) { | ||
unsafe { | ||
CELL = 2; | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
{ | ||
let x: Box<dyn T>; | ||
if __nondet() { | ||
x = Box::new(Concrete1 {}); | ||
} else { | ||
x = Box::new(Concrete2 {}); | ||
} | ||
} | ||
unsafe { | ||
assert!(CELL == 1 || CELL == 2); | ||
} | ||
} |
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,25 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// Check drop implementation for a concrete, non-trait object. | ||
|
||
static mut CELL: i32 = 0; | ||
|
||
struct Concrete1; | ||
|
||
impl Drop for Concrete1 { | ||
fn drop(&mut self) { | ||
unsafe { | ||
CELL = 1; | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
{ | ||
let _x1 = Concrete1 {}; | ||
} | ||
unsafe { | ||
assert!(CELL == 1); | ||
} | ||
} |
Oops, something went wrong.