about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRyan Prichard <ryan.prichard@gmail.com>2015-04-03 20:22:36 -0700
committerRyan Prichard <ryan.prichard@gmail.com>2015-04-11 16:00:58 -0700
commita893c646d0ba9b58fb6167dca6fbbc567b479c95 (patch)
tree21b590b7afdbc0ef77dbf7eb6ae3dc0294a9ae7b
parent0f46e4f1f23368f4615a9847671e3a91b2ebaf18 (diff)
downloadrust-a893c646d0ba9b58fb6167dca6fbbc567b479c95.tar.gz
rust-a893c646d0ba9b58fb6167dca6fbbc567b479c95.zip
Expand internal-unstable to handle named field accesses and method calls.
-rw-r--r--src/test/auxiliary/internal_unstable.rs33
-rw-r--r--src/test/compile-fail/internal-unstable-noallow.rs6
-rwxr-xr-xsrc/test/compile-fail/internal-unstable.rs2
3 files changed, 41 insertions, 0 deletions
diff --git a/src/test/auxiliary/internal_unstable.rs b/src/test/auxiliary/internal_unstable.rs
index 3d59b8e9009..7f682d5d8d1 100644
--- a/src/test/auxiliary/internal_unstable.rs
+++ b/src/test/auxiliary/internal_unstable.rs
@@ -22,6 +22,17 @@ pub struct Foo {
     pub x: u8
 }
 
+impl Foo {
+    #[unstable(feature = "method")]
+    pub fn method(&self) {}
+}
+
+#[stable(feature = "stable", since = "1.0.0")]
+pub struct Bar {
+    #[unstable(feature = "struct2_field")]
+    pub x: u8
+}
+
 #[allow_internal_unstable]
 #[macro_export]
 macro_rules! call_unstable_allow {
@@ -38,6 +49,18 @@ macro_rules! construct_unstable_allow {
 
 #[allow_internal_unstable]
 #[macro_export]
+macro_rules! call_method_allow {
+    ($e: expr) => { $e.method() }
+}
+
+#[allow_internal_unstable]
+#[macro_export]
+macro_rules! access_field_allow {
+    ($e: expr) => { $e.x }
+}
+
+#[allow_internal_unstable]
+#[macro_export]
 macro_rules! pass_through_allow {
     ($e: expr) => { $e }
 }
@@ -55,6 +78,16 @@ macro_rules! construct_unstable_noallow {
 }
 
 #[macro_export]
+macro_rules! call_method_noallow {
+    ($e: expr) => { $e.method() }
+}
+
+#[macro_export]
+macro_rules! access_field_noallow {
+    ($e: expr) => { $e.x }
+}
+
+#[macro_export]
 macro_rules! pass_through_noallow {
     ($e: expr) => { $e }
 }
diff --git a/src/test/compile-fail/internal-unstable-noallow.rs b/src/test/compile-fail/internal-unstable-noallow.rs
index 2b48d47e940..2e42e9d3b01 100644
--- a/src/test/compile-fail/internal-unstable-noallow.rs
+++ b/src/test/compile-fail/internal-unstable-noallow.rs
@@ -16,6 +16,8 @@
 // aux-build:internal_unstable.rs
 // error-pattern:use of unstable library feature 'function'
 // error-pattern:use of unstable library feature 'struct_field'
+// error-pattern:use of unstable library feature 'method'
+// error-pattern:use of unstable library feature 'struct2_field'
 
 #[macro_use]
 extern crate internal_unstable;
@@ -24,4 +26,8 @@ fn main() {
     call_unstable_noallow!();
 
     construct_unstable_noallow!(0);
+
+    |x: internal_unstable::Foo| { call_method_noallow!(x) };
+
+    |x: internal_unstable::Bar| { access_field_noallow!(x) };
 }
diff --git a/src/test/compile-fail/internal-unstable.rs b/src/test/compile-fail/internal-unstable.rs
index accc898b8a8..e01259f0deb 100755
--- a/src/test/compile-fail/internal-unstable.rs
+++ b/src/test/compile-fail/internal-unstable.rs
@@ -36,6 +36,8 @@ fn main() {
     // ok, the instability is contained.
     call_unstable_allow!();
     construct_unstable_allow!(0);
+    |x: internal_unstable::Foo| { call_method_allow!(x) };
+    |x: internal_unstable::Bar| { access_field_allow!(x) };
 
     // bad.
     pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable