Skip to content

Commit 9ef2eb3

Browse files
---
yaml --- r: 262519 b: refs/heads/snap-stage3 c: eb7664b h: refs/heads/master i: 262517: d4e8edf 262515: 53bb3ab 262511: 7b2097c
1 parent cb204b7 commit 9ef2eb3

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 5a0308abadce38396f27122d5c8639ffb2a21469
3-
refs/heads/snap-stage3: 194f1ca3f12f6240e9eb63051eef8eba7dce4853
3+
refs/heads/snap-stage3: eb7664b445d4c2a44e31b6557931dda88e7dd071
44
refs/heads/try: 29d24a3b02cb805da19450bf9830a8f0a6bd859c
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/src/librustdoc/html/markdown.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
#![allow(non_camel_case_types)]
2828

2929
use libc;
30+
use rustc::session::config::get_unstable_features_setting;
3031
use std::ascii::AsciiExt;
3132
use std::cell::RefCell;
3233
use std::default::Default;
3334
use std::ffi::CString;
3435
use std::fmt;
3536
use std::slice;
3637
use std::str;
37-
use std::env;
38+
use syntax::feature_gate::UnstableFeatures;
3839

3940
use html::render::derive_id;
4041
use html::toc::TocBuilder;
@@ -440,18 +441,6 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) {
440441
}
441442
}
442443

443-
fn get_unstable_features_setting() -> bool {
444-
// Check if we can activate compile_fail option or not.
445-
//
446-
// It is done to ensure that it won't be used out-of-tree
447-
// because it's not ready yet for production.
448-
match (option_env!("CFG_BOOTSTRAP_KEY"),
449-
env::var("RUSTC_BOOTSTRAP_KEY").ok()) {
450-
(Some(ref cfg), Some(ref r_key)) => cfg == r_key,
451-
_ => false,
452-
}
453-
}
454-
455444
#[derive(Eq, PartialEq, Clone, Debug)]
456445
struct LangString {
457446
should_panic: bool,
@@ -478,7 +467,10 @@ impl LangString {
478467
let mut seen_rust_tags = false;
479468
let mut seen_other_tags = false;
480469
let mut data = LangString::all_false();
481-
let allow_compile_fail = get_unstable_features_setting();
470+
let allow_compile_fail = match get_unstable_features_setting() {
471+
UnstableFeatures::Allow | UnstableFeatures::Cheat=> true,
472+
_ => false,
473+
};
482474

483475
let tokens = string.split(|c: char|
484476
!(c == '_' || c == '-' || c.is_alphanumeric())
@@ -487,11 +479,7 @@ impl LangString {
487479
for token in tokens {
488480
match token {
489481
"" => {},
490-
"should_panic" => {
491-
data.should_panic = true;
492-
seen_rust_tags = true;
493-
data.no_run = true;
494-
},
482+
"should_panic" => { data.should_panic = true; seen_rust_tags = true; },
495483
"no_run" => { data.no_run = true; seen_rust_tags = true; },
496484
"ignore" => { data.ignore = true; seen_rust_tags = true; },
497485
"rust" => { data.rust = true; seen_rust_tags = true; },
@@ -600,10 +588,10 @@ mod tests {
600588
t("rust", false, false, false, true, false, false);
601589
t("sh", false, false, false, false, false, false);
602590
t("ignore", false, false, true, true, false, false);
603-
t("should_panic", true, true, false, true, false, false);
591+
t("should_panic", true, false, false, true, false, false);
604592
t("no_run", false, true, false, true, false, false);
605593
t("test_harness", false, false, false, true, true, false);
606-
t("compile_fail", false, false, false, true, false, true);
594+
t("compile_fail", false, true, false, true, false, true);
607595
t("{.no_run .example}", false, true, false, true, false, false);
608596
t("{.sh .should_panic}", true, false, false, true, false, false);
609597
t("{.example .rust}", false, false, false, true, false, false);

branches/snap-stage3/src/librustdoc/test.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,16 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
257257
let b_sess = AssertRecoverSafe::new(&sess);
258258
let b_cstore = AssertRecoverSafe::new(&cstore);
259259
let b_cfg = AssertRecoverSafe::new(cfg.clone());
260-
let b_input = AssertRecoverSafe::new(&input);
261-
let b_out = AssertRecoverSafe::new(&out);
262260
let b_control = AssertRecoverSafe::new(&control);
263261

264262
panic::recover(|| {
265-
AssertRecoverSafe::new(driver::compile_input(&b_sess, &b_cstore, (*b_cfg).clone(),
266-
&b_input, &b_out,
267-
&None, None, &b_control))
263+
driver::compile_input(&b_sess, &b_cstore, (*b_cfg).clone(),
264+
&input, &out,
265+
&None, None, &b_control)
268266
})
269267
} {
270268
Ok(r) => {
271-
match *r {
269+
match r {
272270
Err(count) if count > 0 && compile_fail == false => {
273271
sess.fatal("aborting due to previous error(s)")
274272
}

0 commit comments

Comments
 (0)