Skip to content

Commit 7350ce8

Browse files
committed
Strip configuration before checking feature gates of macros
closes #24434
1 parent dabf0c6 commit 7350ce8

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Diff for: src/librustc_driver/driver.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ pub fn phase_2_configure_and_expand(sess: &Session,
395395
//
396396
// baz! should not use this definition unless foo is enabled.
397397

398+
krate = time(time_passes, "configuration 1", krate, |krate|
399+
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
400+
398401
time(time_passes, "gated macro checking", (), |_| {
399402
let features =
400403
syntax::feature_gate::check_crate_macros(sess.codemap(),
@@ -406,8 +409,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
406409
sess.abort_if_errors();
407410
});
408411

409-
krate = time(time_passes, "configuration 1", krate, |krate|
410-
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
411412

412413
krate = time(time_passes, "crate injection", krate, |krate|
413414
syntax::std_inject::maybe_inject_crates_ref(krate,

Diff for: src/test/run-pass/issue-24434.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 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+
// compile-flags:--cfg set1
12+
13+
#![cfg_attr(set1, feature(custom_attribute))]
14+
15+
#![foobar]
16+
fn main() {}

0 commit comments

Comments
 (0)