@@ -26,7 +26,7 @@ use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
26
26
use rustc_middle:: ty:: { GenericArgs , GenericArgsRef } ;
27
27
use rustc_session:: lint:: builtin:: COHERENCE_LEAK_CHECK ;
28
28
use rustc_session:: lint:: builtin:: ORDER_DEPENDENT_TRAIT_OBJECTS ;
29
- use rustc_span:: { ErrorGuaranteed , Span , DUMMY_SP } ;
29
+ use rustc_span:: { sym , ErrorGuaranteed , Span , DUMMY_SP } ;
30
30
31
31
use super :: util;
32
32
use super :: SelectionContext ;
@@ -144,8 +144,22 @@ pub(super) fn specializes(tcx: TyCtxt<'_>, (impl1_def_id, impl2_def_id): (DefId,
144
144
// taking advantage of upstream ones.
145
145
let features = tcx. features ( ) ;
146
146
let specialization_enabled = features. specialization || features. min_specialization ;
147
- if !specialization_enabled && ( impl1_def_id. is_local ( ) || impl2_def_id. is_local ( ) ) {
148
- return false ;
147
+ if !specialization_enabled && impl1_def_id. is_local ( ) {
148
+ let span = tcx. def_span ( impl1_def_id) ;
149
+ if !span. allows_unstable ( sym:: specialization)
150
+ && !span. allows_unstable ( sym:: min_specialization)
151
+ {
152
+ return false ;
153
+ }
154
+ }
155
+
156
+ if !specialization_enabled && impl2_def_id. is_local ( ) {
157
+ let span = tcx. def_span ( impl2_def_id) ;
158
+ if !span. allows_unstable ( sym:: specialization)
159
+ && !span. allows_unstable ( sym:: min_specialization)
160
+ {
161
+ return false ;
162
+ }
149
163
}
150
164
151
165
// We determine whether there's a subset relationship by:
0 commit comments