mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Some more typestate tests.
This commit is contained in:
@@ -451,6 +451,7 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
|
||||
u8-incr.rs \
|
||||
unit.rs \
|
||||
user.rs \
|
||||
use-uninit.rs \
|
||||
utf8.rs \
|
||||
vec-append.rs \
|
||||
vec-concat.rs \
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// error-pattern:Unsatisfied precondition
|
||||
|
||||
fn foo(int x) {
|
||||
log x;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let int x;
|
||||
if (1 > 2) {
|
||||
x = 10;
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// error-pattern:Unsatisfied precondition
|
||||
|
||||
fn foo(int x) {
|
||||
log x;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let int x;
|
||||
if (1 > 2) {
|
||||
log "whoops";
|
||||
} else {
|
||||
x = 10;
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
@@ -6,9 +6,5 @@ fn foo(int x) {
|
||||
|
||||
fn main() {
|
||||
let int x;
|
||||
if (1 > 2) {
|
||||
x = 10;
|
||||
} else {
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fn foo(int x) {
|
||||
log x;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let int x;
|
||||
if (1 > 2) {
|
||||
x = 12;
|
||||
} else {
|
||||
x = 10;
|
||||
}
|
||||
foo(x);
|
||||
}
|
||||
Reference in New Issue
Block a user