Skip to content

Commit 25539f7

Browse files
---
yaml --- r: 274823 b: refs/heads/stable c: eb7664b h: refs/heads/master i: 274821: ac87a63 274819: b53af74 274815: 22448c4
1 parent 59fa319 commit 25539f7

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
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 194f1ca3f12f6240e9eb63051eef8eba7dce4853
32+
refs/heads/stable: eb7664b445d4c2a44e31b6557931dda88e7dd071
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/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/stable/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)