diff options
Diffstat (limited to 'src/test/compile-fail/liveness-if-with-else.rs')
| -rw-r--r-- | src/test/compile-fail/liveness-if-with-else.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/compile-fail/liveness-if-with-else.rs b/src/test/compile-fail/liveness-if-with-else.rs new file mode 100644 index 00000000000..dbb3e6b1645 --- /dev/null +++ b/src/test/compile-fail/liveness-if-with-else.rs @@ -0,0 +1,11 @@ +fn foo(x: int) { log(debug, x); } + +fn main() { + let x: int; + if 1 > 2 { + #debug("whoops"); + } else { + x = 10; + } + foo(x); //! ERROR use of possibly uninitialized variable: `x` +} |
