]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-14589.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-14589.rs
1 // run-pass
2 // All 3 expressions should work in that the argument gets
3 // coerced to a trait object
4
5 // pretty-expanded FIXME #23616
6
7 fn main() {
8 send::<Box<dyn Foo>>(Box::new(Output(0)));
9 Test::<Box<dyn Foo>>::foo(Box::new(Output(0)));
10 Test::<Box<dyn Foo>>::new().send(Box::new(Output(0)));
11 }
12
13 fn send<T>(_: T) {}
14
15 struct Test<T> { marker: std::marker::PhantomData<T> }
16 impl<T> Test<T> {
17 fn new() -> Test<T> { Test { marker: ::std::marker::PhantomData } }
18 fn foo(_: T) {}
19 fn send(&self, _: T) {}
20 }
21
22 trait Foo { fn dummy(&self) { }}
23 struct Output(isize);
24 impl Foo for Output {}