@@ -790,115 +790,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
790
790
}
791
791
}
792
792
793
- fn report_ambiguous_assoc_type (
794
- & self ,
795
- span : Span ,
796
- types : & [ String ] ,
797
- traits : & [ String ] ,
798
- name : Symbol ,
799
- ) -> ErrorGuaranteed {
800
- let mut err =
801
- struct_span_code_err ! ( self . tcx( ) . dcx( ) , span, E0223 , "ambiguous associated type" ) ;
802
- if self
803
- . tcx ( )
804
- . resolutions ( ( ) )
805
- . confused_type_with_std_module
806
- . keys ( )
807
- . any ( |full_span| full_span. contains ( span) )
808
- {
809
- err. span_suggestion_verbose (
810
- span. shrink_to_lo ( ) ,
811
- "you are looking for the module in `std`, not the primitive type" ,
812
- "std::" ,
813
- Applicability :: MachineApplicable ,
814
- ) ;
815
- } else {
816
- let mut types = types. to_vec ( ) ;
817
- types. sort ( ) ;
818
- let mut traits = traits. to_vec ( ) ;
819
- traits. sort ( ) ;
820
- match ( & types[ ..] , & traits[ ..] ) {
821
- ( [ ] , [ ] ) => {
822
- err. span_suggestion_verbose (
823
- span,
824
- format ! (
825
- "if there were a type named `Type` that implements a trait named \
826
- `Trait` with associated type `{name}`, you could use the \
827
- fully-qualified path",
828
- ) ,
829
- format ! ( "<Type as Trait>::{name}" ) ,
830
- Applicability :: HasPlaceholders ,
831
- ) ;
832
- }
833
- ( [ ] , [ trait_str] ) => {
834
- err. span_suggestion_verbose (
835
- span,
836
- format ! (
837
- "if there were a type named `Example` that implemented `{trait_str}`, \
838
- you could use the fully-qualified path",
839
- ) ,
840
- format ! ( "<Example as {trait_str}>::{name}" ) ,
841
- Applicability :: HasPlaceholders ,
842
- ) ;
843
- }
844
- ( [ ] , traits) => {
845
- err. span_suggestions (
846
- span,
847
- format ! (
848
- "if there were a type named `Example` that implemented one of the \
849
- traits with associated type `{name}`, you could use the \
850
- fully-qualified path",
851
- ) ,
852
- traits. iter ( ) . map ( |trait_str| format ! ( "<Example as {trait_str}>::{name}" ) ) ,
853
- Applicability :: HasPlaceholders ,
854
- ) ;
855
- }
856
- ( [ type_str] , [ ] ) => {
857
- err. span_suggestion_verbose (
858
- span,
859
- format ! (
860
- "if there were a trait named `Example` with associated type `{name}` \
861
- implemented for `{type_str}`, you could use the fully-qualified path",
862
- ) ,
863
- format ! ( "<{type_str} as Example>::{name}" ) ,
864
- Applicability :: HasPlaceholders ,
865
- ) ;
866
- }
867
- ( types, [ ] ) => {
868
- err. span_suggestions (
869
- span,
870
- format ! (
871
- "if there were a trait named `Example` with associated type `{name}` \
872
- implemented for one of the types, you could use the fully-qualified \
873
- path",
874
- ) ,
875
- types
876
- . into_iter ( )
877
- . map ( |type_str| format ! ( "<{type_str} as Example>::{name}" ) ) ,
878
- Applicability :: HasPlaceholders ,
879
- ) ;
880
- }
881
- ( types, traits) => {
882
- let mut suggestions = vec ! [ ] ;
883
- for type_str in types {
884
- for trait_str in traits {
885
- suggestions. push ( format ! ( "<{type_str} as {trait_str}>::{name}" ) ) ;
886
- }
887
- }
888
- err. span_suggestions (
889
- span,
890
- "use fully-qualified syntax" ,
891
- suggestions,
892
- Applicability :: MachineApplicable ,
893
- ) ;
894
- }
895
- }
896
- }
897
- let reported = err. emit ( ) ;
898
- self . set_tainted_by_errors ( reported) ;
899
- reported
900
- }
901
-
902
793
/// Search for a trait bound on a type parameter whose trait defines the associated type given by `assoc_name`.
903
794
///
904
795
/// This fails if there is no such bound in the list of candidates or if there are multiple
0 commit comments