Skip to content

Commit 04ecee1

Browse files
committed
Move "completed feature gate checking" pass to after "name resolution" pass so proc-macro-attribute feature gate check can use resolve
1 parent 6843961 commit 04ecee1

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/librustc_driver/driver.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -737,17 +737,6 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
737737
"checking for inline asm in case the target doesn't support it",
738738
|| no_asm::check_crate(sess, &krate));
739739

740-
// Needs to go *after* expansion to be able to check the results of macro expansion.
741-
time(time_passes, "complete gated feature checking", || {
742-
sess.track_errors(|| {
743-
syntax::feature_gate::check_crate(&krate,
744-
&sess.parse_sess,
745-
&sess.features.borrow(),
746-
&attributes,
747-
sess.opts.unstable_features);
748-
})
749-
})?;
750-
751740
time(sess.time_passes(),
752741
"early lint checks",
753742
|| lint::check_ast_crate(sess, &krate));
@@ -765,6 +754,17 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
765754
Ok(())
766755
})?;
767756

757+
// Needs to go *after* expansion to be able to check the results of macro expansion.
758+
time(time_passes, "complete gated feature checking", || {
759+
sess.track_errors(|| {
760+
syntax::feature_gate::check_crate(&krate,
761+
&sess.parse_sess,
762+
&sess.features.borrow(),
763+
&attributes,
764+
sess.opts.unstable_features);
765+
})
766+
})?;
767+
768768
// Lower ast -> hir.
769769
let hir_forest = time(sess.time_passes(), "lowering ast -> hir", || {
770770
let hir_crate = lower_crate(sess, &krate, &mut resolver);

src/test/compile-fail/const-fn-stability.rs

+3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
1616

1717
trait Foo {
1818
const fn foo() -> u32; //~ ERROR const fn is unstable
19+
//~| ERROR trait fns cannot be declared const
1920
const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
21+
//~| ERROR trait fns cannot be declared const
2022
}
2123

2224
impl Foo {
@@ -25,6 +27,7 @@ impl Foo {
2527

2628
impl Foo for u32 {
2729
const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
30+
//~| ERROR trait fns cannot be declared const
2831
}
2932

3033
static FOO: usize = foo();

src/test/compile-fail/feature-gate-no-debug.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(deprecated)]
12+
1113
#[no_debug] //~ ERROR the `#[no_debug]` attribute is
1214
fn main() {}

0 commit comments

Comments
 (0)