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 Normal View History

//@ 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)]
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;
invoke_dyn_star(dyn_i)
}
fn main() {
println!("{}", make_and_invoke_dyn_star(42));
}