@@ -1317,10 +1317,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1317
1317
// those that do.
1318
1318
self . one_bound_for_assoc_type (
1319
1319
|| traits:: supertraits ( tcx, trait_ref) ,
1320
- & trait_ref. print_only_trait_path ( ) . to_string ( ) ,
1320
+ || trait_ref. print_only_trait_path ( ) . to_string ( ) ,
1321
1321
binding. item_name ,
1322
1322
path_span,
1323
- match binding. kind {
1323
+ || match binding. kind {
1324
1324
ConvertedBindingKind :: Equality ( ty) => Some ( ty. to_string ( ) ) ,
1325
1325
_ => None ,
1326
1326
} ,
@@ -1869,10 +1869,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1869
1869
predicates. iter ( ) . filter_map ( |( p, _) | p. to_opt_poly_trait_ref ( ) ) ,
1870
1870
)
1871
1871
} ,
1872
- & param_name. as_str ( ) ,
1872
+ || param_name. to_string ( ) ,
1873
1873
assoc_name,
1874
1874
span,
1875
- None ,
1875
+ || None ,
1876
1876
)
1877
1877
}
1878
1878
@@ -1881,10 +1881,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1881
1881
fn one_bound_for_assoc_type < I > (
1882
1882
& self ,
1883
1883
all_candidates : impl Fn ( ) -> I ,
1884
- ty_param_name : & str ,
1884
+ ty_param_name : impl Fn ( ) -> String ,
1885
1885
assoc_name : ast:: Ident ,
1886
1886
span : Span ,
1887
- is_equality : Option < String > ,
1887
+ is_equality : impl Fn ( ) -> Option < String > ,
1888
1888
) -> Result < ty:: PolyTraitRef < ' tcx > , ErrorReported >
1889
1889
where
1890
1890
I : Iterator < Item = ty:: PolyTraitRef < ' tcx > > ,
@@ -1897,7 +1897,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1897
1897
None => {
1898
1898
self . complain_about_assoc_type_not_found (
1899
1899
all_candidates,
1900
- ty_param_name,
1900
+ & ty_param_name ( ) ,
1901
1901
assoc_name,
1902
1902
span,
1903
1903
) ;
@@ -1910,6 +1910,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1910
1910
if let Some ( bound2) = matching_candidates. next ( ) {
1911
1911
debug ! ( "one_bound_for_assoc_type: bound2 = {:?}" , bound2) ;
1912
1912
1913
+ let is_equality = is_equality ( ) ;
1913
1914
let bounds = iter:: once ( bound) . chain ( iter:: once ( bound2) ) . chain ( matching_candidates) ;
1914
1915
let mut err = if is_equality. is_some ( ) {
1915
1916
// More specific Error Index entry.
@@ -1919,7 +1920,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1919
1920
E0222 ,
1920
1921
"ambiguous associated type `{}` in bounds of `{}`" ,
1921
1922
assoc_name,
1922
- ty_param_name
1923
+ ty_param_name( )
1923
1924
)
1924
1925
} else {
1925
1926
struct_span_err ! (
@@ -1928,7 +1929,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1928
1929
E0221 ,
1929
1930
"ambiguous associated type `{}` in bounds of `{}`" ,
1930
1931
assoc_name,
1931
- ty_param_name
1932
+ ty_param_name( )
1932
1933
)
1933
1934
} ;
1934
1935
err. span_label ( span, format ! ( "ambiguous associated type `{}`" , assoc_name) ) ;
@@ -1966,7 +1967,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1966
1967
"use fully qualified syntax to disambiguate" ,
1967
1968
format ! (
1968
1969
"<{} as {}>::{}" ,
1969
- ty_param_name,
1970
+ ty_param_name( ) ,
1970
1971
bound. print_only_trait_path( ) ,
1971
1972
assoc_name,
1972
1973
) ,
@@ -1976,7 +1977,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1976
1977
} else {
1977
1978
err. note ( & format ! (
1978
1979
"associated type `{}` could derive from `{}`" ,
1979
- ty_param_name,
1980
+ ty_param_name( ) ,
1980
1981
bound. print_only_trait_path( ) ,
1981
1982
) ) ;
1982
1983
}
@@ -1985,7 +1986,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1985
1986
err. help ( & format ! (
1986
1987
"consider introducing a new type parameter `T` and adding `where` constraints:\
1987
1988
\n where\n T: {},\n {}",
1988
- ty_param_name,
1989
+ ty_param_name( ) ,
1989
1990
where_bounds. join( ",\n " ) ,
1990
1991
) ) ;
1991
1992
}
@@ -2099,10 +2100,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2099
2100
2100
2101
self . one_bound_for_assoc_type (
2101
2102
|| traits:: supertraits ( tcx, ty:: Binder :: bind ( trait_ref) ) ,
2102
- "Self" ,
2103
+ || "Self" . to_string ( ) ,
2103
2104
assoc_ident,
2104
2105
span,
2105
- None ,
2106
+ || None ,
2106
2107
) ?
2107
2108
}
2108
2109
( & ty:: Param ( _) , Res :: SelfTy ( Some ( param_did) , None ) )
0 commit comments