@@ -868,118 +868,6 @@ impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
868
868
}
869
869
}
870
870
871
- fn report_ambiguous_assoc_type (
872
- & self ,
873
- span : Span ,
874
- types : & [ String ] ,
875
- traits : & [ String ] ,
876
- name : Symbol ,
877
- ) -> ErrorGuaranteed {
878
- let mut err =
879
- struct_span_code_err ! ( self . tcx( ) . dcx( ) , span, E0223 , "ambiguous associated type" ) ;
880
- if self
881
- . tcx ( )
882
- . resolutions ( ( ) )
883
- . confused_type_with_std_module
884
- . keys ( )
885
- . any ( |full_span| full_span. contains ( span) )
886
- {
887
- err. span_suggestion_verbose (
888
- span. shrink_to_lo ( ) ,
889
- "you are looking for the module in `std`, not the primitive type" ,
890
- "std::" ,
891
- Applicability :: MachineApplicable ,
892
- ) ;
893
- } else {
894
- let mut types = types. to_vec ( ) ;
895
- types. sort ( ) ;
896
- let mut traits = traits. to_vec ( ) ;
897
- traits. sort ( ) ;
898
- match ( & types[ ..] , & traits[ ..] ) {
899
- ( [ ] , [ ] ) => {
900
- err. span_suggestion_verbose (
901
- span,
902
- format ! (
903
- "if there were a type named `Type` that implements a trait named \
904
- `Trait` with associated type `{name}`, you could use the \
905
- fully-qualified path",
906
- ) ,
907
- format ! ( "<Type as Trait>::{name}" ) ,
908
- Applicability :: HasPlaceholders ,
909
- ) ;
910
- }
911
- ( [ ] , [ trait_str] ) => {
912
- err. span_suggestion_verbose (
913
- span,
914
- format ! (
915
- "if there were a type named `Example` that implemented `{trait_str}`, \
916
- you could use the fully-qualified path",
917
- ) ,
918
- format ! ( "<Example as {trait_str}>::{name}" ) ,
919
- Applicability :: HasPlaceholders ,
920
- ) ;
921
- }
922
- ( [ ] , traits) => {
923
- err. span_suggestions (
924
- span,
925
- format ! (
926
- "if there were a type named `Example` that implemented one of the \
927
- traits with associated type `{name}`, you could use the \
928
- fully-qualified path",
929
- ) ,
930
- traits
931
- . iter ( )
932
- . map ( |trait_str| format ! ( "<Example as {trait_str}>::{name}" ) )
933
- . collect :: < Vec < _ > > ( ) ,
934
- Applicability :: HasPlaceholders ,
935
- ) ;
936
- }
937
- ( [ type_str] , [ ] ) => {
938
- err. span_suggestion_verbose (
939
- span,
940
- format ! (
941
- "if there were a trait named `Example` with associated type `{name}` \
942
- implemented for `{type_str}`, you could use the fully-qualified path",
943
- ) ,
944
- format ! ( "<{type_str} as Example>::{name}" ) ,
945
- Applicability :: HasPlaceholders ,
946
- ) ;
947
- }
948
- ( types, [ ] ) => {
949
- err. span_suggestions (
950
- span,
951
- format ! (
952
- "if there were a trait named `Example` with associated type `{name}` \
953
- implemented for one of the types, you could use the fully-qualified \
954
- path",
955
- ) ,
956
- types
957
- . into_iter ( )
958
- . map ( |type_str| format ! ( "<{type_str} as Example>::{name}" ) ) ,
959
- Applicability :: HasPlaceholders ,
960
- ) ;
961
- }
962
- ( types, traits) => {
963
- let mut suggestions = vec ! [ ] ;
964
- for type_str in types {
965
- for trait_str in traits {
966
- suggestions. push ( format ! ( "<{type_str} as {trait_str}>::{name}" ) ) ;
967
- }
968
- }
969
- err. span_suggestions (
970
- span,
971
- "use fully-qualified syntax" ,
972
- suggestions,
973
- Applicability :: MachineApplicable ,
974
- ) ;
975
- }
976
- }
977
- }
978
- let reported = err. emit ( ) ;
979
- self . set_tainted_by_errors ( reported) ;
980
- reported
981
- }
982
-
983
871
/// Search for a bound on a type parameter which includes the associated item given by `assoc_name`.
984
872
///
985
873
/// `ty_param_def_id` is the `DefId` of the type parameter.
0 commit comments