Skip to content

Commit

Permalink
Fix samples and improve driver
Browse files Browse the repository at this point in the history
  • Loading branch information
momvart committed Feb 7, 2025
1 parent 59bfee8 commit 2048246
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 8 additions & 2 deletions compiler/tests/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,17 @@ fn test_execution_rs(fic: &str) {
.current_dir(&work_dir)
.env(ENV_RUST_BACKTRACE, "1")
.status()
.expect("Failed to spawn and wait for the compiled binary");
.unwrap_or_else(|e| {
panic!(
"Failed to spawn and wait for the compiled binary: {}, output available in: {}",
e.to_string(),
work_dir.display()
)
});

assert!(
execution_status.success(),
"Failed to execute {} with exit code: {}, output available in {}",
"Failed to execute {} with exit code: {}, output available in: {}",
fic,
execution_status.code().unwrap_or(-1),
work_dir.display()
Expand Down
7 changes: 7 additions & 0 deletions samples/casting/dyn_star/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ impl Bar for Foo {
}
}

impl<T: Bar> Bar for Box<T> {
fn bar(&self) -> usize {
Bar::bar(self.as_ref())
}
}

fn main() {
let x = Foo(10);
let x = Box::new(x);
let bar = x as dyn* Bar;
foo(bar);
}
Expand Down
7 changes: 7 additions & 0 deletions samples/casting/dyn_star/symbolic_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ impl Bar for Foo {
}
}

impl<T: Bar> Bar for Box<T> {
fn bar(&self) -> usize {
Bar::bar(self.as_ref())
}
}

fn main() {
let x = Foo(10.mark_symbolic());
let x = Box::new(x);
let bar = x as dyn* Bar;
test(bar);
}
Expand Down

0 comments on commit 2048246

Please sign in to comment.