2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-06-03 14:38:00 -05:00
|
|
|
// All 3 expressions should work in that the argument gets
|
|
|
|
// coerced to a trait object
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-06-03 14:38:00 -05:00
|
|
|
fn main() {
|
2019-05-28 13:47:21 -05:00
|
|
|
send::<Box<dyn Foo>>(Box::new(Output(0)));
|
|
|
|
Test::<Box<dyn Foo>>::foo(Box::new(Output(0)));
|
|
|
|
Test::<Box<dyn Foo>>::new().send(Box::new(Output(0)));
|
2014-06-03 14:38:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn send<T>(_: T) {}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
struct Test<T> { marker: std::marker::PhantomData<T> }
|
2014-06-03 14:38:00 -05:00
|
|
|
impl<T> Test<T> {
|
2015-02-12 09:29:52 -06:00
|
|
|
fn new() -> Test<T> { Test { marker: ::std::marker::PhantomData } }
|
2014-06-03 14:38:00 -05:00
|
|
|
fn foo(_: T) {}
|
|
|
|
fn send(&self, _: T) {}
|
|
|
|
}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Foo { fn dummy(&self) { }}
|
2022-07-25 15:36:03 -05:00
|
|
|
struct Output(#[allow(unused_tuple_struct_fields)] isize);
|
2014-06-03 14:38:00 -05:00
|
|
|
impl Foo for Output {}
|