rust/tests/ui/impl-trait/universal_in_trait_defn_parameters.rs

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

19 lines
346 B
Rust
Raw Normal View History

// run-pass
use std::fmt::Debug;
trait InTraitDefnParameters {
fn in_parameters(_: impl Debug) -> String;
}
impl InTraitDefnParameters for () {
fn in_parameters(v: impl Debug) -> String {
format!("() + {:?}", v)
}
}
fn main() {
let s = <() as InTraitDefnParameters>::in_parameters(22);
assert_eq!(s, "() + 22");
}