File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
test/run-make/issue-22131 Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,8 @@ use rustc::session::{self, config};
2424use rustc:: session:: config:: get_unstable_features_setting;
2525use rustc:: session:: search_paths:: { SearchPaths , PathKind } ;
2626use rustc_driver:: { driver, Compilation } ;
27- use syntax:: ast;
28- use syntax:: codemap:: { CodeMap , dummy_spanned} ;
27+ use syntax:: codemap:: CodeMap ;
2928use syntax:: diagnostic;
30- use syntax:: parse:: token;
31- use syntax:: ptr:: P ;
3229
3330use core;
3431use clean;
@@ -67,10 +64,7 @@ pub fn run(input: &str,
6764 span_diagnostic_handler) ;
6865
6966 let mut cfg = config:: build_configuration ( & sess) ;
70- cfg. extend ( cfgs. into_iter ( ) . map ( |cfg_| {
71- let cfg_ = token:: intern_and_get_ident ( & cfg_) ;
72- P ( dummy_spanned ( ast:: MetaWord ( cfg_) ) )
73- } ) ) ;
67+ cfg. extend ( config:: parse_cfgspecs ( cfgs) . into_iter ( ) ) ;
7468 let krate = driver:: phase_1_parse_input ( & sess, cfg, & input) ;
7569 let krate = driver:: phase_2_configure_and_expand ( & sess, krate,
7670 "rustdoc-test" , None )
Original file line number Diff line number Diff line change 1+ -include ../tools.mk
2+
3+ all : foo.rs
4+ $(RUSTC ) --cfg ' feature="bar"' --crate-type lib foo.rs
5+ $(RUSTDOC ) --test --cfg ' feature="bar"' -L $(TMPDIR ) foo.rs | \
6+ grep --quiet ' test foo_0 ... ok'
Original file line number Diff line number Diff line change 1+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ #![ crate_name="foo" ]
12+
13+ /// ```rust
14+ /// assert_eq!(foo::foo(), 1);
15+ /// ```
16+ #[ cfg( feature = "bar" ) ]
17+ pub fn foo ( ) -> i32 { 1 }
You can’t perform that action at this time.
0 commit comments