File tree 3 files changed +25
-8
lines changed
test/run-make/issue-22131 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};
24
24
use rustc:: session:: config:: get_unstable_features_setting;
25
25
use rustc:: session:: search_paths:: { SearchPaths , PathKind } ;
26
26
use rustc_driver:: { driver, Compilation } ;
27
- use syntax:: ast;
28
- use syntax:: codemap:: { CodeMap , dummy_spanned} ;
27
+ use syntax:: codemap:: CodeMap ;
29
28
use syntax:: diagnostic;
30
- use syntax:: parse:: token;
31
- use syntax:: ptr:: P ;
32
29
33
30
use core;
34
31
use clean;
@@ -67,10 +64,7 @@ pub fn run(input: &str,
67
64
span_diagnostic_handler) ;
68
65
69
66
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 ( ) ) ;
74
68
let krate = driver:: phase_1_parse_input ( & sess, cfg, & input) ;
75
69
let krate = driver:: phase_2_configure_and_expand ( & sess, krate,
76
70
"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