about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-02-10 13:54:28 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-02-10 18:14:02 +1100
commit7b73e4fd44c86405307afa5f1a03317bc560f746 (patch)
tree9c205b427e1cac811df59c66b06317530297b548 /tests
parentb5c46dc5426038a49c95398bce30eeb20ec421e2 (diff)
Allow restricted trait impls in macros with `min_specialization`
Implementing traits marked with `#[rustc_specialization_trait]` normally
requires (min-)specialization to be enabled for the enclosing crate.

With this change, that permission can also be granted by an
`allow_internal_unstable` attribute on the macro that generates the impl.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/specialization/min_specialization/allow_internal_unstable.rs (renamed from tests/ui/specialization/allow_internal_unstable.rs)9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/ui/specialization/allow_internal_unstable.rs b/tests/ui/specialization/min_specialization/allow_internal_unstable.rs
index 317782b7b72..8f3677d9769 100644
--- a/tests/ui/specialization/allow_internal_unstable.rs
+++ b/tests/ui/specialization/min_specialization/allow_internal_unstable.rs
@@ -5,6 +5,9 @@
 #![allow(internal_features)]
 #![feature(allow_internal_unstable)]
 
+// aux-build:specialization-trait.rs
+extern crate specialization_trait;
+
 #[allow_internal_unstable(min_specialization)]
 macro_rules! test {
     () => {
@@ -12,7 +15,11 @@ macro_rules! test {
         trait Tr {}
         impl<U> Tr for T<U> {}
         impl Tr for T<u8> {}
-    }
+
+        impl<U> specialization_trait::SpecTrait for T<U> {
+            fn method(&self) {}
+        }
+    };
 }
 
 test! {}