Skip to content

Commit 9b07a28

Browse files
committed
---
yaml --- r: 208531 b: refs/heads/snap-stage3 c: daabc8a h: refs/heads/master i: 208529: 7b294c8 208527: 7eabaf3 v: v3
1 parent 2ba0b00 commit 9b07a28

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6df13d4d886361776ebd8173c60adb4161d315b7
4+
refs/heads/snap-stage3: daabc8a0c70693aaec3a424768ee216f59997acb
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc_driver/driver.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
383383
-> Option<ast::Crate> {
384384
let time_passes = sess.time_passes();
385385

386-
*sess.crate_types.borrow_mut() =
387-
collect_crate_types(sess, &krate.attrs);
388-
*sess.crate_metadata.borrow_mut() =
389-
collect_crate_metadata(sess, &krate.attrs);
390-
391-
time(time_passes, "recursion limit", (), |_| {
392-
middle::recursion_limit::update_recursion_limit(sess, &krate);
393-
});
394-
395-
// strip before expansion to allow macros to depend on
396-
// configuration variables e.g/ in
386+
// strip before anything else because crate metadata may use #[cfg_attr]
387+
// and so macros can depend on configuration variables, such as
397388
//
398389
// #[macro_use] #[cfg(foo)]
399390
// mod bar { macro_rules! baz!(() => {{}}) }
@@ -403,6 +394,15 @@ pub fn phase_2_configure_and_expand(sess: &Session,
403394
krate = time(time_passes, "configuration 1", krate, |krate|
404395
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
405396

397+
*sess.crate_types.borrow_mut() =
398+
collect_crate_types(sess, &krate.attrs);
399+
*sess.crate_metadata.borrow_mut() =
400+
collect_crate_metadata(sess, &krate.attrs);
401+
402+
time(time_passes, "recursion limit", (), |_| {
403+
middle::recursion_limit::update_recursion_limit(sess, &krate);
404+
});
405+
406406
time(time_passes, "gated macro checking", (), |_| {
407407
let features =
408408
syntax::feature_gate::check_crate_macros(sess.codemap(),
Lines changed: 16 additions & 0 deletions
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+
// no-prefer-dynamic
12+
// compile-flags: --cfg foo
13+
14+
#![cfg_attr(foo, crate_type="lib")]
15+
16+
pub fn foo() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
// aux-build:crate-attributes-using-cfg_attr.rs
12+
13+
extern crate crate_attributes_using_cfg_attr;
14+
15+
pub fn main() {}

0 commit comments

Comments
 (0)