diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-4972.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-4972.rs b/src/test/ui/issues/issue-4972.rs new file mode 100644 index 000000000..fab258f13 --- /dev/null +++ b/src/test/ui/issues/issue-4972.rs @@ -0,0 +1,18 @@ +#![feature(box_patterns)] +#![feature(box_syntax)] + +trait MyTrait { + fn dummy(&self) {} +} + +pub enum TraitWrapper { + A(Box<dyn MyTrait + 'static>), +} + +fn get_tw_map(tw: &TraitWrapper) -> &dyn MyTrait { + match *tw { + TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced + } +} + +pub fn main() {} |