diff options
Diffstat (limited to 'tests/ui/borrowck/copy-suggestion-region-vid.rs')
-rw-r--r-- | tests/ui/borrowck/copy-suggestion-region-vid.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.rs b/tests/ui/borrowck/copy-suggestion-region-vid.rs new file mode 100644 index 000000000..dff952834 --- /dev/null +++ b/tests/ui/borrowck/copy-suggestion-region-vid.rs @@ -0,0 +1,17 @@ +pub struct DataStruct(); + +pub struct HelperStruct<'n> { + pub helpers: [Vec<&'n i64>; 2], + pub is_empty: bool, +} + +impl DataStruct { + pub fn f(&self) -> HelperStruct { + let helpers = [vec![], vec![]]; + + HelperStruct { helpers, is_empty: helpers[0].is_empty() } + //~^ ERROR borrow of moved value + } +} + +fn main() {} |