2015-02-10 21:52:00 +00:00
|
|
|
#![feature(box_patterns)]
|
2014-05-06 01:56:44 +00:00
|
|
|
|
2015-02-12 15:29:52 +00:00
|
|
|
trait MyTrait {
|
|
|
|
fn dummy(&self) {}
|
|
|
|
}
|
2013-05-23 02:51:21 +00:00
|
|
|
|
|
|
|
pub enum TraitWrapper {
|
2019-05-28 18:46:13 +00:00
|
|
|
A(Box<dyn MyTrait + 'static>),
|
2013-05-23 02:51:21 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait {
|
2013-05-23 02:51:21 +00:00
|
|
|
match *tw {
|
2014-11-06 08:05:53 +00:00
|
|
|
TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced
|
2013-05-23 02:51:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-23 06:44:51 +00:00
|
|
|
pub fn main() {}
|