@@ -51,15 +51,13 @@ use rustc_infer::traits::{
5151 PredicateObligations ,
5252} ;
5353use rustc_middle:: span_bug;
54- use rustc_middle:: traits:: BuiltinImplSource ;
5554use rustc_middle:: ty:: adjustment:: {
5655 Adjust , Adjustment , AllowTwoPhase , AutoBorrow , AutoBorrowMutability , PointerCoercion ,
5756} ;
5857use rustc_middle:: ty:: error:: TypeError ;
5958use rustc_middle:: ty:: visit:: TypeVisitableExt ;
6059use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt } ;
61- use rustc_session:: parse:: feature_err;
62- use rustc_span:: { BytePos , DUMMY_SP , DesugaringKind , Span , sym} ;
60+ use rustc_span:: { BytePos , DUMMY_SP , DesugaringKind , Span } ;
6361use rustc_trait_selection:: infer:: InferCtxtExt as _;
6462use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt ;
6563use rustc_trait_selection:: traits:: {
@@ -610,8 +608,6 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
610608 ty:: TraitRef :: new( self . tcx, coerce_unsized_did, [ coerce_source, coerce_target] )
611609 ) ] ;
612610
613- let mut has_unsized_tuple_coercion = false ;
614-
615611 // Keep resolving `CoerceUnsized` and `Unsize` predicates to avoid
616612 // emitting a coercion in cases like `Foo<$1>` -> `Foo<$2>`, where
617613 // inference might unify those two inner type variables later.
@@ -690,31 +686,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
690686 // be silent, as it causes a type mismatch later.
691687 }
692688
693- Ok ( Some ( impl_source) ) => {
694- // Some builtin coercions are still unstable so we detect
695- // these here and emit a feature error if coercion doesn't fail
696- // due to another reason.
697- match impl_source {
698- traits:: ImplSource :: Builtin ( BuiltinImplSource :: TupleUnsizing , _) => {
699- has_unsized_tuple_coercion = true ;
700- }
701- _ => { }
702- }
703- queue. extend ( impl_source. nested_obligations ( ) )
704- }
689+ Ok ( Some ( impl_source) ) => queue. extend ( impl_source. nested_obligations ( ) ) ,
705690 }
706691 }
707692
708- if has_unsized_tuple_coercion && !self . tcx . features ( ) . unsized_tuple_coercion ( ) {
709- feature_err (
710- & self . tcx . sess ,
711- sym:: unsized_tuple_coercion,
712- self . cause . span ,
713- "unsized tuple coercion is not stable enough for use and is subject to change" ,
714- )
715- . emit ( ) ;
716- }
717-
718693 Ok ( coercion)
719694 }
720695
0 commit comments