Skip to content

Commit 0610a4e

Browse files
committed
fix tests (sort of)
1 parent 51f2c95 commit 0610a4e

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
541541
// feature-gate the macro invocation
542542
if let Some((feature, issue)) = unstable_feature {
543543
// only if the outer span doesn't allow unstable invocations
544+
// TODO: compare crates of span and def_site_span (can't figure out how)
544545
if !span.allows_unstable() && self_.cx.ecfg.features.map_or(true, |feats| {
545546
// macro features will count as lib features
546547
!feats.declared_lib_features.iter().any(|&(feat, _)| feat == feature)

src/test/compile-fail-fulldeps/auxiliary/macro-stability.rs renamed to src/test/compile-fail-fulldeps/auxiliary/unstable-macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// except according to those terms.
1010

1111
#![feature(staged_api)]
12+
#![stable(feature = "unit_test", since = "0.0.0")]
1213

13-
#[unstable(feature = "unstable_macros", issue = 42069)]
14+
#[unstable(feature = "unstable_macros", issue = "42069")]
1415
#[macro_export]
1516
macro_rules! unstable_macro{ () => () }

src/test/compile-fail-fulldeps/macro-stability.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// aux-build:macro-stability.rs
11+
// aux-build:unstable-macros.rs
1212

13-
#[macro_use] extern crate macros;
13+
#![feature(staged_api)]
14+
#[macro_use] extern crate unstable_macros;
15+
16+
#[unstable(feature = "local_unstable", issue = "42069")]
17+
macro_rules! local_unstable { () => () }
1418

1519
fn main() {
20+
local_unstable!();
1621
unstable_macro!(); //~ ERROR: macro unstable_macro! is unstable
1722
}

src/test/run-pass-fulldeps/auxiliary/macro-stability.rs renamed to src/test/run-pass-fulldeps/auxiliary/unstable-macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// except according to those terms.
1010

1111
#![feature(staged_api)]
12+
#![stable(feature = "unit_test", since = "0.0.0")]
1213

13-
#[unstable(feature = "unstable_macros", issue = 42069)]
14+
#[unstable(feature = "unstable_macros", issue = "42069")]
1415
#[macro_export]
1516
macro_rules! unstable_macro{ () => () }

src/test/run-pass-fulldeps/macro-stability.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// aux-build:macro-stability.rs
11+
// aux-build:unstable-macros.rs
1212

1313
#![feature(unstable_macros)]
1414

15-
#[macro_use] extern crate macros;
15+
#[macro_use] extern crate unstable_macros;
16+
17+
#[unstable(feature = "local_unstable", issue = "42069")]
18+
macro_rules! local_unstable { () => () }
1619

1720
fn main() {
1821
unstable_macro!();
22+
local_unstable!();
1923
}

0 commit comments

Comments
 (0)