Skip to content

Commit 0ea66f3

Browse files
committed
Avoid gated feature checking unconfigured items
1 parent 7979dd6 commit 0ea66f3

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/librustc_driver/driver.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -625,21 +625,6 @@ pub fn phase_2_configure_and_expand(sess: &Session,
625625
ret
626626
});
627627

628-
// Needs to go *after* expansion to be able to check the results
629-
// of macro expansion. This runs before #[cfg] to try to catch as
630-
// much as possible (e.g. help the programmer avoid platform
631-
// specific differences)
632-
time(time_passes, "complete gated feature checking 1", || {
633-
sess.track_errors(|| {
634-
let features = syntax::feature_gate::check_crate(sess.codemap(),
635-
&sess.parse_sess.span_diagnostic,
636-
&krate,
637-
&attributes,
638-
sess.opts.unstable_features);
639-
*sess.features.borrow_mut() = features;
640-
})
641-
})?;
642-
643628
// JBC: make CFG processing part of expansion to avoid this problem:
644629

645630
// strip again, in case expansion added anything with a #[cfg].
@@ -662,6 +647,19 @@ pub fn phase_2_configure_and_expand(sess: &Session,
662647
krate
663648
})?;
664649

650+
// Needs to go *after* expansion to be able to check the results
651+
// of macro expansion.
652+
time(time_passes, "complete gated feature checking 1", || {
653+
sess.track_errors(|| {
654+
let features = syntax::feature_gate::check_crate(sess.codemap(),
655+
&sess.parse_sess.span_diagnostic,
656+
&krate,
657+
&attributes,
658+
sess.opts.unstable_features);
659+
*sess.features.borrow_mut() = features;
660+
})
661+
})?;
662+
665663
krate = time(time_passes, "maybe building test harness", || {
666664
syntax::test::modify_for_testing(&sess.parse_sess, &sess.opts.cfg, krate, sess.diagnostic())
667665
});

0 commit comments

Comments
 (0)