2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2014-06-03 19:38:00 +00:00
|
|
|
// All 3 expressions should work in that the argument gets
|
|
|
|
// coerced to a trait object
|
|
|
|
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-06-03 19:38:00 +00:00
|
|
|
fn main() {
|
2019-05-28 18:47:21 +00: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 19:38:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn send<T>(_: T) {}
|
|
|
|
|
2015-02-12 15:29:52 +00:00
|
|
|
struct Test<T> { marker: std::marker::PhantomData<T> }
|
2014-06-03 19:38:00 +00:00
|
|
|
impl<T> Test<T> {
|
2015-02-12 15:29:52 +00:00
|
|
|
fn new() -> Test<T> { Test { marker: ::std::marker::PhantomData } }
|
2014-06-03 19:38:00 +00:00
|
|
|
fn foo(_: T) {}
|
|
|
|
fn send(&self, _: T) {}
|
|
|
|
}
|
|
|
|
|
2024-02-07 02:42:01 +00:00
|
|
|
trait Foo { fn dummy(&self) { }} //~ WARN method `dummy` is never used
|
2023-12-27 22:11:58 +00:00
|
|
|
struct Output(#[allow(dead_code)] isize);
|
2014-06-03 19:38:00 +00:00
|
|
|
impl Foo for Output {}
|