rust/tests/ui/dyn-star/method.rs

28 lines
413 B
Rust
Raw Normal View History

// run-pass
2022-09-14 18:20:03 -05:00
2022-08-29 14:02:03 -05:00
#![feature(dyn_star)]
2022-08-30 14:44:00 -05:00
#![allow(incomplete_features)]
trait Foo {
fn get(&self) -> usize;
}
impl Foo for usize {
fn get(&self) -> usize {
*self
}
}
fn invoke_dyn_star(i: dyn* Foo) -> usize {
i.get()
}
fn make_and_invoke_dyn_star(i: usize) -> usize {
2022-09-14 18:20:03 -05:00
let dyn_i: dyn* Foo = i;
invoke_dyn_star(dyn_i)
}
fn main() {
println!("{}", make_and_invoke_dyn_star(42));
}