Skip to content

Commit 218b12c

Browse files
committed
---
yaml --- r: 103580 b: refs/heads/auto c: 8e90412 h: refs/heads/master v: v3
1 parent 7d84463 commit 218b12c

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 7a70ec1ba6e64949cab5edcad33b0d7538065884
16+
refs/heads/auto: 8e904120487f67172eb2d509531ed8f9e230af3a
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustdoc/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int
163163
pub fn test(input: &str, libs: @RefCell<HashSet<Path>>, mut test_args: ~[~str]) -> int {
164164
let input_str = load_or_return!(input, 1, 2);
165165

166-
let mut collector = Collector::new(input.to_owned(), libs, true);
166+
let mut collector = Collector::new(input.to_owned(), libs, true, true);
167167
find_testable_code(input_str, &mut collector);
168168
test_args.unshift(~"rustdoctest");
169169
testing::test_main(test_args, collector.tests);

branches/auto/src/librustdoc/test.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn run(input: &str, libs: @RefCell<HashSet<Path>>, mut test_args: ~[~str]) -
7777
let (krate, _) = passes::unindent_comments(krate);
7878
let (krate, _) = passes::collapse_docs(krate);
7979

80-
let mut collector = Collector::new(krate.name.to_owned(), libs, false);
80+
let mut collector = Collector::new(krate.name.to_owned(), libs, false, false);
8181
collector.fold_crate(krate);
8282

8383
test_args.unshift(~"rustdoctest");
@@ -88,8 +88,8 @@ pub fn run(input: &str, libs: @RefCell<HashSet<Path>>, mut test_args: ~[~str]) -
8888
}
8989

9090
fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
91-
no_run: bool) {
92-
let test = maketest(test, cratename);
91+
no_run: bool, loose_feature_gating: bool) {
92+
let test = maketest(test, cratename, loose_feature_gating);
9393
let parsesess = parse::new_parse_sess();
9494
let input = driver::StrInput(test);
9595

@@ -162,11 +162,18 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
162162
}
163163
}
164164

165-
fn maketest(s: &str, cratename: &str) -> ~str {
165+
fn maketest(s: &str, cratename: &str, loose_feature_gating: bool) -> ~str {
166166
let mut prog = ~r"
167167
#[deny(warnings)];
168168
#[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)];
169169
";
170+
171+
if loose_feature_gating {
172+
// FIXME #12773: avoid inserting these when the tutorial & manual
173+
// etc. have been updated to not use them so prolifically.
174+
prog.push_str("#[ feature(macro_rules, globs, struct_variant, managed_boxes) ];\n");
175+
}
176+
170177
if !s.contains("extern crate") {
171178
if s.contains("extra") {
172179
prog.push_str("extern crate extra;\n");
@@ -194,18 +201,23 @@ pub struct Collector {
194201
priv use_headers: bool,
195202
priv current_header: Option<~str>,
196203
priv cratename: ~str,
204+
205+
priv loose_feature_gating: bool
197206
}
198207

199208
impl Collector {
200-
pub fn new(cratename: ~str, libs: @RefCell<HashSet<Path>>, use_headers: bool) -> Collector {
209+
pub fn new(cratename: ~str, libs: @RefCell<HashSet<Path>>,
210+
use_headers: bool, loose_feature_gating: bool) -> Collector {
201211
Collector {
202212
tests: ~[],
203213
names: ~[],
204214
libs: libs,
205215
cnt: 0,
206216
use_headers: use_headers,
207217
current_header: None,
208-
cratename: cratename
218+
cratename: cratename,
219+
220+
loose_feature_gating: loose_feature_gating
209221
}
210222
}
211223

@@ -220,6 +232,7 @@ impl Collector {
220232
let libs = self.libs.borrow();
221233
let libs = (*libs.get()).clone();
222234
let cratename = self.cratename.to_owned();
235+
let loose_feature_gating = self.loose_feature_gating;
223236
debug!("Creating test {}: {}", name, test);
224237
self.tests.push(testing::TestDescAndFn {
225238
desc: testing::TestDesc {
@@ -228,7 +241,7 @@ impl Collector {
228241
should_fail: false, // compiler failures are test failures
229242
},
230243
testfn: testing::DynTestFn(proc() {
231-
runtest(test, cratename, libs, should_fail, no_run);
244+
runtest(test, cratename, libs, should_fail, no_run, loose_feature_gating);
232245
}),
233246
});
234247
}

0 commit comments

Comments
 (0)