about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-04-08 22:47:55 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-04-08 22:47:55 +0000
commit0ea66f35a95e3662498881398298dcc553294d5a (patch)
tree9057dccb8359c701cc212f50b41da7522bc2ad7b
parent7979dd6089ee5cba39cfbe6e880a3edeb7fff788 (diff)
downloadrust-0ea66f35a95e3662498881398298dcc553294d5a.tar.gz
rust-0ea66f35a95e3662498881398298dcc553294d5a.zip
Avoid gated feature checking unconfigured items
-rw-r--r--src/librustc_driver/driver.rs28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 67c52bb6c36..b6e7080f16c 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -625,21 +625,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
         ret
     });
 
-    // Needs to go *after* expansion to be able to check the results
-    // of macro expansion.  This runs before #[cfg] to try to catch as
-    // much as possible (e.g. help the programmer avoid platform
-    // specific differences)
-    time(time_passes, "complete gated feature checking 1", || {
-        sess.track_errors(|| {
-            let features = syntax::feature_gate::check_crate(sess.codemap(),
-                                                             &sess.parse_sess.span_diagnostic,
-                                                             &krate,
-                                                             &attributes,
-                                                             sess.opts.unstable_features);
-            *sess.features.borrow_mut() = features;
-        })
-    })?;
-
     // JBC: make CFG processing part of expansion to avoid this problem:
 
     // strip again, in case expansion added anything with a #[cfg].
@@ -662,6 +647,19 @@ pub fn phase_2_configure_and_expand(sess: &Session,
         krate
     })?;
 
+    // Needs to go *after* expansion to be able to check the results
+    // of macro expansion.
+    time(time_passes, "complete gated feature checking 1", || {
+        sess.track_errors(|| {
+            let features = syntax::feature_gate::check_crate(sess.codemap(),
+                                                             &sess.parse_sess.span_diagnostic,
+                                                             &krate,
+                                                             &attributes,
+                                                             sess.opts.unstable_features);
+            *sess.features.borrow_mut() = features;
+        })
+    })?;
+
     krate = time(time_passes, "maybe building test harness", || {
         syntax::test::modify_for_testing(&sess.parse_sess, &sess.opts.cfg, krate, sess.diagnostic())
     });