about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-10 13:12:31 +0100
committerGitHub <noreply@github.com>2024-02-10 13:12:31 +0100
commit55913368c53b2846bd96fd017abc34a0af07ccc8 (patch)
tree5c3cfc67941b0bf40c4ad3dec50f529e473ff23e /tests
parented3b049a8b234180f2e156dac358af4effb35f09 (diff)
parenta2479a4ae75884953eb9eaad083105174549c2ed (diff)
Rollup merge of #120870 - Zalathar:allow-min-spec, r=oli-obk
Allow restricted trait impls under `#[allow_internal_unstable(min_specialization)]`

This is a follow-up to #119963 and a companion to #120866, though it can land independently from the latter.

---

We have several compiler crates that only enable `#[feature(min_specialization)]` because it is required by their expansions of `newtype_index!`, in order to implement traits marked with `#[rustc_specialization_trait]`.

This PR allows those traits to be implemented internally by macros with `#[allow_internal_unstable(min_specialization)]`, without needing specialization to be enabled in the enclosing crate.
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! {}