diff options
| author | Erin Moon <erin@hashbang.sh> | 2018-06-04 18:14:33 -0500 |
|---|---|---|
| committer | Erin Moon <erin@hashbang.sh> | 2018-06-04 18:15:48 -0500 |
| commit | c2825e134db01e2537d7c3ba7acb60f0c983e740 (patch) | |
| tree | 18a56568deff987c62b55172ac7936e9df6a6477 | |
| parent | 41affd03eb169830773cd1b11efda562ab81fad0 (diff) | |
| download | rust-c2825e134db01e2537d7c3ba7acb60f0c983e740.tar.gz rust-c2825e134db01e2537d7c3ba7acb60f0c983e740.zip | |
tests that #39963 is fixed on MIR borrowck
| -rw-r--r-- | src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs new file mode 100644 index 00000000000..f57a7bd7add --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test case from #39963. + +#![feature(nll)] + +#[derive(Clone)] +struct Foo(Option<Box<Foo>>, Option<Box<Foo>>); + +fn test(f: &mut Foo) { + match *f { + Foo(Some(ref mut left), Some(ref mut right)) => match **left { + Foo(Some(ref mut left), Some(ref mut right)) => panic!(), + _ => panic!(), + }, + _ => panic!(), + } +} + +fn main() { +} |
