2011-06-29 19:38:40 -05:00
|
|
|
// xfail-stage0
|
|
|
|
|
2011-06-30 13:22:10 -05:00
|
|
|
#[cfg(bogus)]
|
|
|
|
const bool b = false;
|
|
|
|
|
|
|
|
const bool b = true;
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
native "rust" mod rustrt {
|
|
|
|
// This symbol doesn't exist and would be a link error if this
|
|
|
|
// module was translated
|
|
|
|
fn bogus();
|
|
|
|
}
|
|
|
|
|
|
|
|
native "rust" mod rustrt {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
type t = int;
|
|
|
|
|
|
|
|
type t = bool;
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
tag tg {
|
|
|
|
foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
tag tg {
|
|
|
|
bar;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
obj o() {
|
|
|
|
fn f() { ret bogus; }
|
|
|
|
}
|
|
|
|
|
|
|
|
obj o() {
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
resource r(int i) {}
|
|
|
|
|
|
|
|
resource r(int i) {}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
mod m {
|
|
|
|
// This needs to parse but would fail in typeck. Since it's not in
|
|
|
|
// the current config it should not be typechecked.
|
|
|
|
fn bogus() { ret 0; }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod m {
|
|
|
|
|
|
|
|
// Submodules have slightly different code paths than the top-level
|
|
|
|
// module, so let's make sure this jazz works here as well
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn f() {}
|
|
|
|
|
|
|
|
fn f() {}
|
|
|
|
}
|
|
|
|
|
2011-06-29 19:38:40 -05:00
|
|
|
// Since the bogus configuration isn't defined main will just be
|
|
|
|
// parsed, but nothing further will be done with it
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn main() { fail }
|
|
|
|
|
2011-06-30 13:22:10 -05:00
|
|
|
fn main() {
|
|
|
|
// Exercise some of the configured items in ways that wouldn't be possible
|
|
|
|
// if they had the bogus definition
|
|
|
|
assert b;
|
|
|
|
let t x = true;
|
|
|
|
let tg y = bar;
|
2011-06-30 15:04:02 -05:00
|
|
|
|
|
|
|
test_in_fn_ctxt();
|
2011-06-30 13:22:10 -05:00
|
|
|
}
|
|
|
|
|
2011-06-30 15:04:02 -05:00
|
|
|
fn test_in_fn_ctxt() {
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn f() { fail }
|
|
|
|
fn f() {}
|
|
|
|
f();
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
const int i = 0;
|
|
|
|
const int i = 1;
|
|
|
|
assert i == 1;
|
|
|
|
}
|