diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2017-11-27 08:07:58 +0000 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2017-11-27 08:07:58 +0000 |
| commit | d64a31882f6cdfcfbea82a257bb5cc64e6f7a7fc (patch) | |
| tree | b58cd8367f7577278a31ae1c9d9d79b5ba8d8287 /src/test/compile-fail/liveness-assign-imm-local-with-drop.rs | |
| parent | 6853b34f0ed922cae68d7e521b21ebd10d063e72 (diff) | |
| download | rust-d64a31882f6cdfcfbea82a257bb5cc64e6f7a7fc.tar.gz rust-d64a31882f6cdfcfbea82a257bb5cc64e6f7a7fc.zip | |
Update tests involving E0384 for mir-borrowck
Diffstat (limited to 'src/test/compile-fail/liveness-assign-imm-local-with-drop.rs')
| -rw-r--r-- | src/test/compile-fail/liveness-assign-imm-local-with-drop.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs b/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs new file mode 100644 index 00000000000..b4fb33ca15e --- /dev/null +++ b/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs @@ -0,0 +1,26 @@ +// Copyright 2012 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. + +// revisions: ast mir +//[mir]compile-flags: -Zborrowck=mir + +fn test() { + let b = Box::new(1); //[ast]~ NOTE first assignment + //[mir]~^ NOTE first assignment + drop(b); + b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable + //[mir]~^ ERROR cannot assign twice to immutable variable `b` + //[ast]~| NOTE cannot assign twice to immutable + //[mir]~| NOTE cannot assign twice to immutable + drop(b); +} + +fn main() { +} |
