@@ -10,7 +10,7 @@ use crate::solve::inspect;
10
10
use crate :: solve:: inspect:: { InspectGoal , ProofTreeInferCtxtExt , ProofTreeVisitor } ;
11
11
use crate :: traits:: engine:: TraitEngineExt ;
12
12
use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt ;
13
- use crate :: traits:: select:: { IntercrateAmbiguityCause , TreatInductiveCycleAs } ;
13
+ use crate :: traits:: select:: IntercrateAmbiguityCause ;
14
14
use crate :: traits:: structural_normalize:: StructurallyNormalizeExt ;
15
15
use crate :: traits:: NormalizeExt ;
16
16
use crate :: traits:: SkipLeakCheck ;
@@ -31,7 +31,6 @@ use rustc_middle::traits::DefiningAnchor;
31
31
use rustc_middle:: ty:: fast_reject:: { DeepRejectCtxt , TreatParams } ;
32
32
use rustc_middle:: ty:: visit:: { TypeVisitable , TypeVisitableExt } ;
33
33
use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeSuperVisitable , TypeVisitor } ;
34
- use rustc_session:: lint:: builtin:: COINDUCTIVE_OVERLAP_IN_COHERENCE ;
35
34
use rustc_span:: symbol:: sym;
36
35
use rustc_span:: DUMMY_SP ;
37
36
use std:: fmt:: Debug ;
@@ -197,7 +196,7 @@ fn overlap<'tcx>(
197
196
. intercrate ( true )
198
197
. with_next_trait_solver ( tcx. next_trait_solver_in_coherence ( ) )
199
198
. build ( ) ;
200
- let selcx = & mut SelectionContext :: new ( & infcx) ;
199
+ let selcx = & mut SelectionContext :: with_treat_inductive_cycle_as_ambig ( & infcx) ;
201
200
if track_ambiguity_causes. is_yes ( ) {
202
201
selcx. enable_tracking_intercrate_ambiguity_causes ( ) ;
203
202
}
@@ -224,62 +223,10 @@ fn overlap<'tcx>(
224
223
) ;
225
224
226
225
if overlap_mode. use_implicit_negative ( ) {
227
- for mode in [ TreatInductiveCycleAs :: Ambig , TreatInductiveCycleAs :: Recur ] {
228
- if let Some ( failing_obligation) = selcx. with_treat_inductive_cycle_as ( mode, |selcx| {
229
- impl_intersection_has_impossible_obligation ( selcx, & obligations)
230
- } ) {
231
- if matches ! ( mode, TreatInductiveCycleAs :: Recur ) {
232
- let first_local_impl = impl1_header
233
- . impl_def_id
234
- . as_local ( )
235
- . or ( impl2_header. impl_def_id . as_local ( ) )
236
- . expect ( "expected one of the impls to be local" ) ;
237
- infcx. tcx . struct_span_lint_hir (
238
- COINDUCTIVE_OVERLAP_IN_COHERENCE ,
239
- infcx. tcx . local_def_id_to_hir_id ( first_local_impl) ,
240
- infcx. tcx . def_span ( first_local_impl) ,
241
- format ! (
242
- "implementations {} will conflict in the future" ,
243
- match impl1_header. trait_ref {
244
- Some ( trait_ref) => {
245
- let trait_ref = infcx. resolve_vars_if_possible( trait_ref) ;
246
- format!(
247
- "of `{}` for `{}`" ,
248
- trait_ref. print_only_trait_path( ) ,
249
- trait_ref. self_ty( )
250
- )
251
- }
252
- None => format!(
253
- "for `{}`" ,
254
- infcx. resolve_vars_if_possible( impl1_header. self_ty)
255
- ) ,
256
- } ,
257
- ) ,
258
- |lint| {
259
- lint. note (
260
- "impls that are not considered to overlap may be considered to \
261
- overlap in the future",
262
- )
263
- . span_label (
264
- infcx. tcx . def_span ( impl1_header. impl_def_id ) ,
265
- "the first impl is here" ,
266
- )
267
- . span_label (
268
- infcx. tcx . def_span ( impl2_header. impl_def_id ) ,
269
- "the second impl is here" ,
270
- ) ;
271
- lint. note ( format ! (
272
- "`{}` may be considered to hold in future releases, \
273
- causing the impls to overlap",
274
- infcx. resolve_vars_if_possible( failing_obligation. predicate)
275
- ) ) ;
276
- lint
277
- } ,
278
- ) ;
279
- }
280
-
281
- return None ;
282
- }
226
+ if let Some ( _failing_obligation) =
227
+ impl_intersection_has_impossible_obligation ( selcx, & obligations)
228
+ {
229
+ return None ;
283
230
}
284
231
}
285
232
0 commit comments