blob: 5ddea6055870443ff186044cff88934194ff5b87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
// xfail-fast
// 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.
// Crate use statements
#[cfg(bogus)]
use flippity;
#[cfg(bogus)]
const b: bool = false;
const b: bool = true;
#[cfg(bogus)]
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
// This symbol doesn't exist and would be a link error if this
// module was translated
fn bogus();
}
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports]; }
#[cfg(bogus)]
type t = int;
type t = bool;
#[cfg(bogus)]
enum tg { foo, }
enum tg { bar, }
#[cfg(bogus)]
struct r {
i: int,
}
#[cfg(bogus)]
fn r(i:int) -> r {
r {
i: i
}
}
struct r {
i: int,
}
fn r(i:int) -> r {
r {
i: i
}
}
#[cfg(bogus)]
mod m {
#[legacy_exports];
// This needs to parse but would fail in typeck. Since it's not in
// the current config it should not be typechecked.
fn bogus() { return 0; }
}
mod m {
#[legacy_exports];
// 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() { }
}
// 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 }
fn main() {
// Exercise some of the configured items in ways that wouldn't be possible
// if they had the bogus definition
assert (b);
let x: t = true;
let y: tg = bar;
test_in_fn_ctxt();
}
fn test_in_fn_ctxt() {
#[cfg(bogus)]
fn f() { fail }
fn f() { }
f();
#[cfg(bogus)]
const i: int = 0;
const i: int = 1;
assert (i == 1);
}
mod test_foreign_items {
#[legacy_exports];
#[abi = "cdecl"]
extern mod rustrt {
#[legacy_exports];
#[cfg(bogus)]
fn rust_getcwd() -> ~str;
fn rust_getcwd() -> ~str;
}
}
mod test_use_statements {
#[legacy_exports];
#[cfg(bogus)]
use flippity_foo;
extern mod rustrt {
#[legacy_exports];
#[cfg(bogus)]
use flippity_foo;
}
}
mod test_methods {
struct Foo {
bar: uint
}
impl Foo: Fooable {
#[cfg(bogus)]
static fn what() { }
static fn what() { }
#[cfg(bogus)]
fn the() { }
fn the() { }
}
trait Fooable {
#[cfg(bogus)]
static fn what();
static fn what();
#[cfg(bogus)]
fn the();
fn the();
}
}
|