File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ static ADMONITION_RE: Lazy<Regex> = Lazy::new(|| {
23
23
} ) ;
24
24
25
25
pub fn handle_preprocessing ( ) -> Result < ( ) , Error > {
26
- let pre = Spec :: new ( ) ?;
26
+ let pre = Spec :: new ( None ) ?;
27
27
let ( ctx, book) = CmdPreprocessor :: parse_input ( io:: stdin ( ) ) ?;
28
28
29
29
let book_version = Version :: parse ( & ctx. mdbook_version ) ?;
@@ -57,9 +57,16 @@ pub struct Spec {
57
57
}
58
58
59
59
impl Spec {
60
- fn new ( ) -> Result < Spec > {
60
+ /// Creates a new `Spec` preprocessor.
61
+ ///
62
+ /// The `rust_root` parameter specifies an optional path to the root of
63
+ /// the rust git checkout. If `None`, it will use the `SPEC_RUST_ROOT`
64
+ /// environment variable. If the root is not specified, then no tests will
65
+ /// be linked unless `SPEC_DENY_WARNINGS` is set in which case this will
66
+ /// return an error..
67
+ pub fn new ( rust_root : Option < PathBuf > ) -> Result < Spec > {
61
68
let deny_warnings = std:: env:: var ( "SPEC_DENY_WARNINGS" ) . as_deref ( ) == Ok ( "1" ) ;
62
- let rust_root = std:: env:: var_os ( "SPEC_RUST_ROOT" ) . map ( PathBuf :: from) ;
69
+ let rust_root = rust_root . or_else ( || std:: env:: var_os ( "SPEC_RUST_ROOT" ) . map ( PathBuf :: from) ) ;
63
70
if deny_warnings && rust_root. is_none ( ) {
64
71
bail ! ( "SPEC_RUST_ROOT environment variable must be set" ) ;
65
72
}
You can’t perform that action at this time.
0 commit comments