@@ -8,7 +8,7 @@ use rustc_errors::{
88} ;
99use rustc_hir:: def:: { CtorOf , DefKind , Res } ;
1010use rustc_hir:: def_id:: DefId ;
11- use rustc_hir:: { self as hir, HirId , PolyTraitRef } ;
11+ use rustc_hir:: { self as hir, HirId } ;
1212use rustc_middle:: bug;
1313use rustc_middle:: ty:: fast_reject:: { TreatParams , simplify_type} ;
1414use rustc_middle:: ty:: print:: { PrintPolyTraitRefExt as _, PrintTraitRefExt as _} ;
@@ -35,52 +35,6 @@ use crate::fluent_generated as fluent;
3535use crate :: hir_ty_lowering:: { AssocItemQSelf , HirTyLowerer } ;
3636
3737impl < ' tcx > dyn HirTyLowerer < ' tcx > + ' _ {
38- /// Check for duplicate relaxed bounds and relaxed bounds of non-default traits.
39- pub ( crate ) fn check_and_report_invalid_relaxed_bounds (
40- & self ,
41- relaxed_bounds : SmallVec < [ & PolyTraitRef < ' _ > ; 1 ] > ,
42- ) {
43- let tcx = self . tcx ( ) ;
44-
45- let mut grouped_bounds = FxIndexMap :: < _ , Vec < _ > > :: default ( ) ;
46-
47- for bound in & relaxed_bounds {
48- if let Res :: Def ( DefKind :: Trait , trait_def_id) = bound. trait_ref . path . res {
49- grouped_bounds. entry ( trait_def_id) . or_default ( ) . push ( bound. span ) ;
50- }
51- }
52-
53- for ( trait_def_id, spans) in grouped_bounds {
54- if spans. len ( ) > 1 {
55- let name = tcx. item_name ( trait_def_id) ;
56- self . dcx ( )
57- . struct_span_err ( spans, format ! ( "duplicate relaxed `{name}` bounds" ) )
58- . with_code ( E0203 )
59- . emit ( ) ;
60- }
61- }
62-
63- let sized_def_id = tcx. require_lang_item ( hir:: LangItem :: Sized , DUMMY_SP ) ;
64-
65- for bound in relaxed_bounds {
66- if let Res :: Def ( DefKind :: Trait , def_id) = bound. trait_ref . path . res
67- && ( def_id == sized_def_id || tcx. is_default_trait ( def_id) )
68- {
69- continue ;
70- }
71- self . dcx ( ) . span_err (
72- bound. span ,
73- if tcx. sess . opts . unstable_opts . experimental_default_bounds
74- || tcx. features ( ) . more_maybe_bounds ( )
75- {
76- "bound modifier `?` can only be applied to default traits like `Sized`"
77- } else {
78- "bound modifier `?` can only be applied to `Sized`"
79- } ,
80- ) ;
81- }
82- }
83-
8438 /// On missing type parameters, emit an E0393 error and provide a structured suggestion using
8539 /// the type parameter's name as a placeholder.
8640 pub ( crate ) fn report_missing_type_params (
0 commit comments