2022-08-17 18:51:16 -05:00
|
|
|
//@ 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)]
|
2022-08-17 18:51:16 -05:00
|
|
|
|
|
|
|
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;
|
2022-08-17 18:51:16 -05:00
|
|
|
invoke_dyn_star(dyn_i)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{}", make_and_invoke_dyn_star(42));
|
|
|
|
}
|