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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
414 B
Rust
Raw Permalink 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));
}