2022-08-17 23:51:16 +00:00
|
|
|
//@ run-pass
|
2022-09-14 23:20:03 +00:00
|
|
|
|
2022-08-29 19:02:03 +00:00
|
|
|
#![feature(dyn_star)]
|
2022-08-30 19:44:00 +00:00
|
|
|
#![allow(incomplete_features)]
|
2022-08-17 23:51:16 +00: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 23:20:03 +00:00
|
|
|
let dyn_i: dyn* Foo = i;
|
2022-08-17 23:51:16 +00:00
|
|
|
invoke_dyn_star(dyn_i)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
println!("{}", make_and_invoke_dyn_star(42));
|
|
|
|
}
|