Skip to content

Commit

Permalink
auto merge of #17834 : sfackler/rust/rustdoc-cfgs, r=alexcrichton,ale…
Browse files Browse the repository at this point in the history
…xcrichton

Rustdoc would previously improperly handle key="value" style cfgs, which
are notably used for Cargo features.
  • Loading branch information
bors committed Oct 7, 2014
2 parents 683e40f + a585b4e commit 8881c35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc/driver/config.rs
Expand Up @@ -630,7 +630,7 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {


// Convert strings provided as --cfg [cfgspec] into a crate_cfg
fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
pub fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
cfgspecs.into_iter().map(|s| {
parse::parse_meta_from_source_str("cfgspec".to_string(),
s.to_string(),
Expand Down
9 changes: 2 additions & 7 deletions src/librustdoc/core.rs
Expand Up @@ -14,8 +14,6 @@ use rustc::lint;
use rustc::back::link;

use syntax::{ast, ast_map, codemap, diagnostic};
use syntax::parse::token;
use syntax::ptr::P;

use std::cell::RefCell;
use std::os;
Expand Down Expand Up @@ -95,6 +93,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
lint_opts: vec!((warning_lint, lint::Allow)),
externs: externs,
target_triple: triple.unwrap_or(driver::host_triple().to_string()),
cfg: config::parse_cfgspecs(cfgs),
..config::basic_options().clone()
};

Expand All @@ -108,11 +107,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
Some(cpath.clone()),
span_diagnostic_handler);

let mut cfg = config::build_configuration(&sess);
for cfg_ in cfgs.into_iter() {
let cfg_ = token::intern_and_get_ident(cfg_.as_slice());
cfg.push(P(codemap::dummy_spanned(ast::MetaWord(cfg_))));
}
let cfg = config::build_configuration(&sess);

let krate = driver::phase_1_parse_input(&sess, cfg, &input);

Expand Down

0 comments on commit 8881c35

Please sign in to comment.