@@ -1317,10 +1317,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13171317 // those that do.
13181318 self . one_bound_for_assoc_type (
13191319 || traits:: supertraits ( tcx, trait_ref) ,
1320- & trait_ref. print_only_trait_path ( ) . to_string ( ) ,
1320+ || trait_ref. print_only_trait_path ( ) . to_string ( ) ,
13211321 binding. item_name ,
13221322 path_span,
1323- match binding. kind {
1323+ || match binding. kind {
13241324 ConvertedBindingKind :: Equality ( ty) => Some ( ty. to_string ( ) ) ,
13251325 _ => None ,
13261326 } ,
@@ -1869,10 +1869,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
18691869 predicates. iter ( ) . filter_map ( |( p, _) | p. to_opt_poly_trait_ref ( ) ) ,
18701870 )
18711871 } ,
1872- & param_name. as_str ( ) ,
1872+ || param_name. to_string ( ) ,
18731873 assoc_name,
18741874 span,
1875- None ,
1875+ || None ,
18761876 )
18771877 }
18781878
@@ -1881,10 +1881,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
18811881 fn one_bound_for_assoc_type < I > (
18821882 & self ,
18831883 all_candidates : impl Fn ( ) -> I ,
1884- ty_param_name : & str ,
1884+ ty_param_name : impl Fn ( ) -> String ,
18851885 assoc_name : ast:: Ident ,
18861886 span : Span ,
1887- is_equality : Option < String > ,
1887+ is_equality : impl Fn ( ) -> Option < String > ,
18881888 ) -> Result < ty:: PolyTraitRef < ' tcx > , ErrorReported >
18891889 where
18901890 I : Iterator < Item = ty:: PolyTraitRef < ' tcx > > ,
@@ -1897,7 +1897,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
18971897 None => {
18981898 self . complain_about_assoc_type_not_found (
18991899 all_candidates,
1900- ty_param_name,
1900+ & ty_param_name ( ) ,
19011901 assoc_name,
19021902 span,
19031903 ) ;
@@ -1910,6 +1910,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19101910 if let Some ( bound2) = matching_candidates. next ( ) {
19111911 debug ! ( "one_bound_for_assoc_type: bound2 = {:?}" , bound2) ;
19121912
1913+ let is_equality = is_equality ( ) ;
19131914 let bounds = iter:: once ( bound) . chain ( iter:: once ( bound2) ) . chain ( matching_candidates) ;
19141915 let mut err = if is_equality. is_some ( ) {
19151916 // More specific Error Index entry.
@@ -1919,7 +1920,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19191920 E0222 ,
19201921 "ambiguous associated type `{}` in bounds of `{}`" ,
19211922 assoc_name,
1922- ty_param_name
1923+ ty_param_name( )
19231924 )
19241925 } else {
19251926 struct_span_err ! (
@@ -1928,7 +1929,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19281929 E0221 ,
19291930 "ambiguous associated type `{}` in bounds of `{}`" ,
19301931 assoc_name,
1931- ty_param_name
1932+ ty_param_name( )
19321933 )
19331934 } ;
19341935 err. span_label ( span, format ! ( "ambiguous associated type `{}`" , assoc_name) ) ;
@@ -1966,7 +1967,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19661967 "use fully qualified syntax to disambiguate" ,
19671968 format ! (
19681969 "<{} as {}>::{}" ,
1969- ty_param_name,
1970+ ty_param_name( ) ,
19701971 bound. print_only_trait_path( ) ,
19711972 assoc_name,
19721973 ) ,
@@ -1976,7 +1977,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19761977 } else {
19771978 err. note ( & format ! (
19781979 "associated type `{}` could derive from `{}`" ,
1979- ty_param_name,
1980+ ty_param_name( ) ,
19801981 bound. print_only_trait_path( ) ,
19811982 ) ) ;
19821983 }
@@ -1985,7 +1986,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
19851986 err. help ( & format ! (
19861987 "consider introducing a new type parameter `T` and adding `where` constraints:\
19871988 \n where\n T: {},\n {}",
1988- ty_param_name,
1989+ ty_param_name( ) ,
19891990 where_bounds. join( ",\n " ) ,
19901991 ) ) ;
19911992 }
@@ -2099,10 +2100,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
20992100
21002101 self . one_bound_for_assoc_type (
21012102 || traits:: supertraits ( tcx, ty:: Binder :: bind ( trait_ref) ) ,
2102- "Self" ,
2103+ || "Self" . to_string ( ) ,
21032104 assoc_ident,
21042105 span,
2105- None ,
2106+ || None ,
21062107 ) ?
21072108 }
21082109 ( & ty:: Param ( _) , Res :: SelfTy ( Some ( param_did) , None ) )
0 commit comments