2012-12-13 15:05:22 -06:00
|
|
|
// xfail-fast
|
|
|
|
|
2012-12-10 19:32:48 -06:00
|
|
|
// 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.
|
|
|
|
|
2012-11-01 17:48:37 -05:00
|
|
|
// Crate use statements
|
|
|
|
#[cfg(bogus)]
|
|
|
|
use flippity;
|
|
|
|
|
2011-06-30 13:22:10 -05:00
|
|
|
#[cfg(bogus)]
|
2013-03-22 16:00:15 -05:00
|
|
|
static b: bool = false;
|
2011-06-30 13:22:10 -05:00
|
|
|
|
2013-03-22 16:00:15 -05:00
|
|
|
static b: bool = true;
|
2011-06-30 13:22:10 -05:00
|
|
|
|
2013-03-05 16:42:58 -06:00
|
|
|
mod rustrt {
|
|
|
|
#[cfg(bogus)]
|
|
|
|
#[abi = "cdecl"]
|
|
|
|
pub extern {
|
|
|
|
// This symbol doesn't exist and would be a link error if this
|
|
|
|
// module was translated
|
|
|
|
pub fn bogus();
|
|
|
|
}
|
2013-05-03 18:25:04 -05:00
|
|
|
|
2013-03-05 16:42:58 -06:00
|
|
|
#[abi = "cdecl"]
|
|
|
|
pub extern {}
|
2011-06-30 13:22:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
type t = int;
|
|
|
|
|
|
|
|
type t = bool;
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2012-01-19 20:31:08 -06:00
|
|
|
enum tg { foo, }
|
2011-06-30 13:22:10 -05:00
|
|
|
|
2012-01-19 20:31:08 -06:00
|
|
|
enum tg { bar, }
|
2011-06-30 13:22:10 -05:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2012-08-15 20:46:55 -05:00
|
|
|
struct r {
|
2012-09-06 21:40:15 -05:00
|
|
|
i: int,
|
2012-09-05 17:58:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn r(i:int) -> r {
|
|
|
|
r {
|
|
|
|
i: i
|
|
|
|
}
|
2012-05-15 22:33:59 -05:00
|
|
|
}
|
2011-06-30 13:22:10 -05:00
|
|
|
|
2012-08-15 20:46:55 -05:00
|
|
|
struct r {
|
2012-09-06 21:40:15 -05:00
|
|
|
i: int,
|
2012-09-05 17:58:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn r(i:int) -> r {
|
|
|
|
r {
|
|
|
|
i: i
|
|
|
|
}
|
2012-05-15 22:33:59 -05:00
|
|
|
}
|
2011-06-30 13:22:10 -05:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
mod m {
|
2011-07-27 07:19:39 -05:00
|
|
|
// This needs to parse but would fail in typeck. Since it's not in
|
|
|
|
// the current config it should not be typechecked.
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn bogus() { return 0; }
|
2011-06-30 13:22:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod m {
|
2011-07-27 07:19:39 -05:00
|
|
|
// Submodules have slightly different code paths than the top-level
|
|
|
|
// module, so let's make sure this jazz works here as well
|
|
|
|
#[cfg(bogus)]
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn f() { }
|
2011-06-30 13:22:10 -05:00
|
|
|
|
2013-01-30 17:56:40 -06:00
|
|
|
pub fn f() { }
|
2011-06-30 13:22:10 -05:00
|
|
|
}
|
|
|
|
|
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)]
|
2013-02-11 21:26:38 -06:00
|
|
|
pub fn main() { fail!() }
|
2011-06-29 19:38:40 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
// Exercise some of the configured items in ways that wouldn't be possible
|
|
|
|
// if they had the bogus definition
|
2013-03-28 20:39:09 -05:00
|
|
|
assert!((b));
|
2011-07-27 07:19:39 -05:00
|
|
|
let x: t = true;
|
|
|
|
let y: tg = bar;
|
2011-06-30 15:04:02 -05:00
|
|
|
|
2011-07-27 07:19:39 -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() {
|
2011-07-27 07:19:39 -05:00
|
|
|
#[cfg(bogus)]
|
2013-02-11 21:26:38 -06:00
|
|
|
fn f() { fail!() }
|
2011-07-27 07:19:39 -05:00
|
|
|
fn f() { }
|
|
|
|
f();
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2013-03-22 16:00:15 -05:00
|
|
|
static i: int = 0;
|
|
|
|
static i: int = 1;
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(i, 1);
|
2011-06-30 15:04:02 -05:00
|
|
|
}
|
2011-07-05 15:29:21 -05:00
|
|
|
|
2012-06-26 18:18:37 -05:00
|
|
|
mod test_foreign_items {
|
2013-03-05 16:42:58 -06:00
|
|
|
pub mod rustrt {
|
|
|
|
#[abi = "cdecl"]
|
|
|
|
pub extern {
|
|
|
|
#[cfg(bogus)]
|
2013-02-21 00:46:26 -06:00
|
|
|
pub fn rust_get_stdin() -> ~str;
|
|
|
|
pub fn rust_get_stdin() -> ~str;
|
2013-03-05 16:42:58 -06:00
|
|
|
}
|
2011-07-27 07:19:39 -05:00
|
|
|
}
|
2011-08-10 11:27:22 -05:00
|
|
|
}
|
2012-07-09 16:02:39 -05:00
|
|
|
|
|
|
|
mod test_use_statements {
|
|
|
|
#[cfg(bogus)]
|
|
|
|
use flippity_foo;
|
2012-11-01 17:48:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod test_methods {
|
|
|
|
struct Foo {
|
|
|
|
bar: uint
|
|
|
|
}
|
|
|
|
|
2013-02-14 13:47:00 -06:00
|
|
|
impl Fooable for Foo {
|
2012-11-01 17:48:37 -05:00
|
|
|
#[cfg(bogus)]
|
2013-03-21 21:07:54 -05:00
|
|
|
fn what(&self) { }
|
2012-11-01 17:48:37 -05:00
|
|
|
|
2013-03-21 21:07:54 -05:00
|
|
|
fn what(&self) { }
|
2012-11-01 17:48:37 -05:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2013-03-12 21:32:14 -05:00
|
|
|
fn the(&self) { }
|
2012-11-01 17:48:37 -05:00
|
|
|
|
2013-03-12 21:32:14 -05:00
|
|
|
fn the(&self) { }
|
2012-11-01 17:48:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
trait Fooable {
|
|
|
|
#[cfg(bogus)]
|
2013-03-21 21:07:54 -05:00
|
|
|
fn what(&self);
|
2012-11-01 17:48:37 -05:00
|
|
|
|
2013-03-21 21:07:54 -05:00
|
|
|
fn what(&self);
|
2012-11-01 17:48:37 -05:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2013-03-12 21:32:14 -05:00
|
|
|
fn the(&self);
|
2012-11-01 17:48:37 -05:00
|
|
|
|
2013-03-12 21:32:14 -05:00
|
|
|
fn the(&self);
|
2012-11-01 17:48:37 -05:00
|
|
|
}
|
|
|
|
}
|