diff options
| author | Mikhail Modin <mikhailm1@gmail.com> | 2017-11-10 14:11:25 +0300 |
|---|---|---|
| committer | Mikhail Modin <mikhailm1@gmail.com> | 2017-11-15 11:21:05 +0300 |
| commit | 830d65c1ffa2f19ada218d8a95b62042411b68a7 (patch) | |
| tree | f129fb45a983a806efee7d76f05bdf23d02be0ea /src/test | |
| parent | f93a4928c2168bcc475b4fe77ba9f9e5494ffe1c (diff) | |
| download | rust-830d65c1ffa2f19ada218d8a95b62042411b68a7.tar.gz rust-830d65c1ffa2f19ada218d8a95b62042411b68a7.zip | |
add `StorageDead` handling
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/borrowck/borrowck-storage-dead.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-storage-dead.rs b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs new file mode 100644 index 00000000000..5ef502acd81 --- /dev/null +++ b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs @@ -0,0 +1,30 @@ +// 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. + +// compile-flags: -Z emit-end-regions -Z borrowck-mir + +fn ok() { + loop { + let _x = 1; + } +} + +fn fail() { + loop { + let x: i32; + let _ = x + 1; //~ERROR (Ast) [E0381] + //~^ ERROR (Mir) [E0381] + } +} + +fn main() { + ok(); + fail(); +} |
