diff options
| author | bors <bors@rust-lang.org> | 2016-07-07 02:42:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-07 02:42:45 -0700 |
| commit | a7f5d8a2ef56dca21ff4df3f88fa0436e32de643 (patch) | |
| tree | ee688211159590e1d35b906b44aac683fb1f1ec4 /src/test | |
| parent | b4e11c2af8fce4f72fc896bfb6215c446d593cda (diff) | |
| parent | a9c7a415763563e394e469ac88e5f6665b7b1a86 (diff) | |
Auto merge of #34672 - luqmana:27021-reassign-match-body, r=eddyb
Make match discriminant reassignment check more accurate. Fixes #27021.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/issue-27021.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-27021.rs b/src/test/run-pass/issue-27021.rs new file mode 100644 index 00000000000..eb7d529f0ad --- /dev/null +++ b/src/test/run-pass/issue-27021.rs @@ -0,0 +1,21 @@ +// Copyright 2016 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. + +fn main() { + let mut c = (1, (1, "".to_owned())); + match c { + c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); } + } + + let mut c = (1, (1, (1, "".to_owned()))); + match c.1 { + c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); } + } +} |
