about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAustin Bonander <austin.bonander@gmail.com>2017-01-15 22:58:17 -0800
committerAustin Bonander <austin.bonander@gmail.com>2017-01-16 22:41:23 -0800
commit04ecee158c2c56f4a6d81ad17ac3547848ec1e4c (patch)
treefa4cad5272cd06c30a025603b3e5476202554cf8
parent68439614bad206570f0958fc672a3e11cccebf53 (diff)
downloadrust-04ecee158c2c56f4a6d81ad17ac3547848ec1e4c.tar.gz
rust-04ecee158c2c56f4a6d81ad17ac3547848ec1e4c.zip
Move "completed feature gate checking" pass to after "name resolution" pass so proc-macro-attribute feature gate check can use resolve
-rw-r--r--src/librustc_driver/driver.rs22
-rw-r--r--src/test/compile-fail/const-fn-stability.rs3
-rw-r--r--src/test/compile-fail/feature-gate-no-debug.rs2
3 files changed, 16 insertions, 11 deletions
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index f34d1203a3d..d8c68c340b6 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -737,17 +737,6 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
          "checking for inline asm in case the target doesn't support it",
          || no_asm::check_crate(sess, &krate));
 
-    // Needs to go *after* expansion to be able to check the results of macro expansion.
-    time(time_passes, "complete gated feature checking", || {
-        sess.track_errors(|| {
-            syntax::feature_gate::check_crate(&krate,
-                                              &sess.parse_sess,
-                                              &sess.features.borrow(),
-                                              &attributes,
-                                              sess.opts.unstable_features);
-        })
-    })?;
-
     time(sess.time_passes(),
          "early lint checks",
          || lint::check_ast_crate(sess, &krate));
@@ -765,6 +754,17 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
         Ok(())
     })?;
 
+    // Needs to go *after* expansion to be able to check the results of macro expansion.
+    time(time_passes, "complete gated feature checking", || {
+        sess.track_errors(|| {
+            syntax::feature_gate::check_crate(&krate,
+                                              &sess.parse_sess,
+                                              &sess.features.borrow(),
+                                              &attributes,
+                                              sess.opts.unstable_features);
+        })
+    })?;
+
     // Lower ast -> hir.
     let hir_forest = time(sess.time_passes(), "lowering ast -> hir", || {
         let hir_crate = lower_crate(sess, &krate, &mut resolver);
diff --git a/src/test/compile-fail/const-fn-stability.rs b/src/test/compile-fail/const-fn-stability.rs
index 436244525e1..d093364497a 100644
--- a/src/test/compile-fail/const-fn-stability.rs
+++ b/src/test/compile-fail/const-fn-stability.rs
@@ -16,7 +16,9 @@ const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
 
 trait Foo {
     const fn foo() -> u32; //~ ERROR const fn is unstable
+                           //~| ERROR trait fns cannot be declared const
     const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
+                                //~| ERROR trait fns cannot be declared const
 }
 
 impl Foo {
@@ -25,6 +27,7 @@ impl Foo {
 
 impl Foo for u32 {
     const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
+                                //~| ERROR trait fns cannot be declared const
 }
 
 static FOO: usize = foo();
diff --git a/src/test/compile-fail/feature-gate-no-debug.rs b/src/test/compile-fail/feature-gate-no-debug.rs
index e185056026c..9815db6550d 100644
--- a/src/test/compile-fail/feature-gate-no-debug.rs
+++ b/src/test/compile-fail/feature-gate-no-debug.rs
@@ -8,5 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![allow(deprecated)]
+
 #[no_debug] //~ ERROR the `#[no_debug]` attribute is
 fn main() {}