@@ -15,7 +15,6 @@ use std::iter::{self, once};
1515use itertools:: Either ;
1616use rustc_abi:: ExternAbi ;
1717use rustc_attr_parsing:: { ConstStability , StabilityLevel , StableSince } ;
18- use rustc_data_structures:: captures:: Captures ;
1918use rustc_data_structures:: fx:: FxHashSet ;
2019use rustc_hir as hir;
2120use rustc_hir:: def:: DefKind ;
@@ -41,10 +40,10 @@ pub(crate) fn write_str(s: &mut String, f: fmt::Arguments<'_>) {
4140 s. write_fmt ( f) . unwrap ( ) ;
4241}
4342
44- pub ( crate ) fn print_generic_bounds < ' a , ' tcx : ' a > (
45- bounds : & ' a [ clean:: GenericBound ] ,
46- cx : & ' a Context < ' tcx > ,
47- ) -> impl Display + ' a + Captures < ' tcx > {
43+ pub ( crate ) fn print_generic_bounds (
44+ bounds : & [ clean:: GenericBound ] ,
45+ cx : & Context < ' _ > ,
46+ ) -> impl Display {
4847 fmt:: from_fn ( move |f| {
4948 let mut bounds_dup = FxHashSet :: default ( ) ;
5049
@@ -57,10 +56,7 @@ pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>(
5756}
5857
5958impl clean:: GenericParamDef {
60- pub ( crate ) fn print < ' a , ' tcx : ' a > (
61- & ' a self ,
62- cx : & ' a Context < ' tcx > ,
63- ) -> impl Display + ' a + Captures < ' tcx > {
59+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
6460 fmt:: from_fn ( move |f| match & self . kind {
6561 clean:: GenericParamDefKind :: Lifetime { outlives } => {
6662 write ! ( f, "{}" , self . name) ?;
@@ -107,10 +103,7 @@ impl clean::GenericParamDef {
107103}
108104
109105impl clean:: Generics {
110- pub ( crate ) fn print < ' a , ' tcx : ' a > (
111- & ' a self ,
112- cx : & ' a Context < ' tcx > ,
113- ) -> impl Display + ' a + Captures < ' tcx > {
106+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
114107 fmt:: from_fn ( move |f| {
115108 let mut real_params = self . params . iter ( ) . filter ( |p| !p. is_synthetic_param ( ) ) . peekable ( ) ;
116109 if real_params. peek ( ) . is_none ( ) {
@@ -134,10 +127,7 @@ pub(crate) enum Ending {
134127 NoNewline ,
135128}
136129
137- fn print_where_predicate < ' a , ' tcx : ' a > (
138- predicate : & ' a clean:: WherePredicate ,
139- cx : & ' a Context < ' tcx > ,
140- ) -> impl Display + ' a + Captures < ' tcx > {
130+ fn print_where_predicate ( predicate : & clean:: WherePredicate , cx : & Context < ' _ > ) -> impl Display {
141131 fmt:: from_fn ( move |f| {
142132 match predicate {
143133 clean:: WherePredicate :: BoundPredicate { ty, bounds, bound_params } => {
@@ -173,12 +163,12 @@ fn print_where_predicate<'a, 'tcx: 'a>(
173163/// * The Generics from which to emit a where-clause.
174164/// * The number of spaces to indent each line with.
175165/// * Whether the where-clause needs to add a comma and newline after the last bound.
176- pub ( crate ) fn print_where_clause < ' a , ' tcx : ' a > (
177- gens : & ' a clean:: Generics ,
178- cx : & ' a Context < ' tcx > ,
166+ pub ( crate ) fn print_where_clause (
167+ gens : & clean:: Generics ,
168+ cx : & Context < ' _ > ,
179169 indent : usize ,
180170 ending : Ending ,
181- ) -> Option < impl Display + ' a + Captures < ' tcx > > {
171+ ) -> Option < impl Display > {
182172 if gens. where_predicates . is_empty ( ) {
183173 return None ;
184174 }
@@ -250,13 +240,13 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
250240}
251241
252242impl clean:: Lifetime {
253- pub ( crate ) fn print ( & self ) -> impl Display + ' _ {
243+ pub ( crate ) fn print ( & self ) -> impl Display {
254244 self . 0 . as_str ( )
255245 }
256246}
257247
258248impl clean:: ConstantKind {
259- pub ( crate ) fn print ( & self , tcx : TyCtxt < ' _ > ) -> impl Display + ' _ {
249+ pub ( crate ) fn print ( & self , tcx : TyCtxt < ' _ > ) -> impl Display {
260250 let expr = self . expr ( tcx) ;
261251 fmt:: from_fn ( move |f| {
262252 if f. alternate ( ) { f. write_str ( & expr) } else { write ! ( f, "{}" , Escape ( & expr) ) }
@@ -265,7 +255,7 @@ impl clean::ConstantKind {
265255}
266256
267257impl clean:: PolyTrait {
268- fn print < ' a , ' tcx : ' a > ( & ' a self , cx : & ' a Context < ' tcx > ) -> impl Display + ' a + Captures < ' tcx > {
258+ fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
269259 fmt:: from_fn ( move |f| {
270260 print_higher_ranked_params_with_space ( & self . generic_params , cx, "for" ) . fmt ( f) ?;
271261 self . trait_ . print ( cx) . fmt ( f)
@@ -274,10 +264,7 @@ impl clean::PolyTrait {
274264}
275265
276266impl clean:: GenericBound {
277- pub ( crate ) fn print < ' a , ' tcx : ' a > (
278- & ' a self ,
279- cx : & ' a Context < ' tcx > ,
280- ) -> impl Display + ' a + Captures < ' tcx > {
267+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
281268 fmt:: from_fn ( move |f| match self {
282269 clean:: GenericBound :: Outlives ( lt) => write ! ( f, "{}" , lt. print( ) ) ,
283270 clean:: GenericBound :: TraitBound ( ty, modifiers) => {
@@ -304,7 +291,7 @@ impl clean::GenericBound {
304291}
305292
306293impl clean:: GenericArgs {
307- fn print < ' a , ' tcx : ' a > ( & ' a self , cx : & ' a Context < ' tcx > ) -> impl Display + ' a + Captures < ' tcx > {
294+ fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
308295 fmt:: from_fn ( move |f| {
309296 match self {
310297 clean:: GenericArgs :: AngleBracketed { args, constraints } => {
@@ -809,11 +796,11 @@ fn primitive_link_fragment(
809796 Ok ( ( ) )
810797}
811798
812- fn tybounds < ' a , ' tcx : ' a > (
813- bounds : & ' a [ clean:: PolyTrait ] ,
814- lt : & ' a Option < clean:: Lifetime > ,
815- cx : & ' a Context < ' tcx > ,
816- ) -> impl Display + ' a + Captures < ' tcx > {
799+ fn tybounds (
800+ bounds : & [ clean:: PolyTrait ] ,
801+ lt : & Option < clean:: Lifetime > ,
802+ cx : & Context < ' _ > ,
803+ ) -> impl Display {
817804 fmt:: from_fn ( move |f| {
818805 bounds. iter ( ) . map ( |bound| bound. print ( cx) ) . joined ( " + " , f) ?;
819806 if let Some ( lt) = lt {
@@ -825,11 +812,11 @@ fn tybounds<'a, 'tcx: 'a>(
825812 } )
826813}
827814
828- fn print_higher_ranked_params_with_space < ' a , ' tcx : ' a > (
829- params : & ' a [ clean:: GenericParamDef ] ,
830- cx : & ' a Context < ' tcx > ,
815+ fn print_higher_ranked_params_with_space (
816+ params : & [ clean:: GenericParamDef ] ,
817+ cx : & Context < ' _ > ,
831818 keyword : & ' static str ,
832- ) -> impl Display + ' a + Captures < ' tcx > {
819+ ) -> impl Display {
833820 fmt:: from_fn ( move |f| {
834821 if !params. is_empty ( ) {
835822 f. write_str ( keyword) ?;
@@ -841,11 +828,7 @@ fn print_higher_ranked_params_with_space<'a, 'tcx: 'a>(
841828 } )
842829}
843830
844- pub ( crate ) fn anchor < ' a : ' cx , ' cx > (
845- did : DefId ,
846- text : Symbol ,
847- cx : & ' cx Context < ' a > ,
848- ) -> impl Display + Captures < ' a > + ' cx {
831+ pub ( crate ) fn anchor ( did : DefId , text : Symbol , cx : & Context < ' _ > ) -> impl Display {
849832 fmt:: from_fn ( move |f| {
850833 let parts = href ( did, cx) ;
851834 if let Ok ( ( url, short_ty, fqp) ) = parts {
@@ -1121,29 +1104,19 @@ fn fmt_type(
11211104}
11221105
11231106impl clean:: Type {
1124- pub ( crate ) fn print < ' b , ' a : ' b , ' tcx : ' a > (
1125- & ' a self ,
1126- cx : & ' a Context < ' tcx > ,
1127- ) -> impl Display + ' b + Captures < ' tcx > {
1107+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
11281108 fmt:: from_fn ( move |f| fmt_type ( self , f, false , cx) )
11291109 }
11301110}
11311111
11321112impl clean:: Path {
1133- pub ( crate ) fn print < ' b , ' a : ' b , ' tcx : ' a > (
1134- & ' a self ,
1135- cx : & ' a Context < ' tcx > ,
1136- ) -> impl Display + ' b + Captures < ' tcx > {
1113+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
11371114 fmt:: from_fn ( move |f| resolved_path ( f, self . def_id ( ) , self , false , false , cx) )
11381115 }
11391116}
11401117
11411118impl clean:: Impl {
1142- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1143- & ' a self ,
1144- use_absolute : bool ,
1145- cx : & ' a Context < ' tcx > ,
1146- ) -> impl Display + ' a + Captures < ' tcx > {
1119+ pub ( crate ) fn print ( & self , use_absolute : bool , cx : & Context < ' _ > ) -> impl Display {
11471120 fmt:: from_fn ( move |f| {
11481121 f. write_str ( "impl" ) ?;
11491122 self . generics . print ( cx) . fmt ( f) ?;
@@ -1182,12 +1155,12 @@ impl clean::Impl {
11821155 print_where_clause ( & self . generics , cx, 0 , Ending :: Newline ) . maybe_display ( ) . fmt ( f)
11831156 } )
11841157 }
1185- fn print_type < ' a , ' tcx : ' a > (
1158+ fn print_type (
11861159 & self ,
11871160 type_ : & clean:: Type ,
11881161 f : & mut fmt:: Formatter < ' _ > ,
11891162 use_absolute : bool ,
1190- cx : & ' a Context < ' tcx > ,
1163+ cx : & Context < ' _ > ,
11911164 ) -> Result < ( ) , fmt:: Error > {
11921165 if let clean:: Type :: Tuple ( types) = type_
11931166 && let [ clean:: Type :: Generic ( name) ] = & types[ ..]
@@ -1258,10 +1231,7 @@ impl clean::Impl {
12581231}
12591232
12601233impl clean:: Arguments {
1261- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1262- & ' a self ,
1263- cx : & ' a Context < ' tcx > ,
1264- ) -> impl Display + ' a + Captures < ' tcx > {
1234+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
12651235 fmt:: from_fn ( move |f| {
12661236 self . values
12671237 . iter ( )
@@ -1301,10 +1271,7 @@ impl Display for Indent {
13011271}
13021272
13031273impl clean:: FnDecl {
1304- pub ( crate ) fn print < ' b , ' a : ' b , ' tcx : ' a > (
1305- & ' a self ,
1306- cx : & ' a Context < ' tcx > ,
1307- ) -> impl Display + ' b + Captures < ' tcx > {
1274+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
13081275 fmt:: from_fn ( move |f| {
13091276 let ellipsis = if self . c_variadic { ", ..." } else { "" } ;
13101277 if f. alternate ( ) {
@@ -1333,12 +1300,12 @@ impl clean::FnDecl {
13331300 /// are preserved.
13341301 /// * `indent`: The number of spaces to indent each successive line with, if line-wrapping is
13351302 /// necessary.
1336- pub ( crate ) fn full_print < ' a , ' tcx : ' a > (
1337- & ' a self ,
1303+ pub ( crate ) fn full_print (
1304+ & self ,
13381305 header_len : usize ,
13391306 indent : usize ,
1340- cx : & ' a Context < ' tcx > ,
1341- ) -> impl Display + ' a + Captures < ' tcx > {
1307+ cx : & Context < ' _ > ,
1308+ ) -> impl Display {
13421309 fmt:: from_fn ( move |f| {
13431310 // First, generate the text form of the declaration, with no line wrapping, and count the bytes.
13441311 let mut counter = WriteCounter ( 0 ) ;
@@ -1420,10 +1387,7 @@ impl clean::FnDecl {
14201387 self . print_output ( cx) . fmt ( f)
14211388 }
14221389
1423- fn print_output < ' a , ' tcx : ' a > (
1424- & ' a self ,
1425- cx : & ' a Context < ' tcx > ,
1426- ) -> impl Display + ' a + Captures < ' tcx > {
1390+ fn print_output ( & self , cx : & Context < ' _ > ) -> impl Display {
14271391 fmt:: from_fn ( move |f| match & self . output {
14281392 clean:: Tuple ( tys) if tys. is_empty ( ) => Ok ( ( ) ) ,
14291393 ty if f. alternate ( ) => {
@@ -1434,10 +1398,7 @@ impl clean::FnDecl {
14341398 }
14351399}
14361400
1437- pub ( crate ) fn visibility_print_with_space < ' a , ' tcx : ' a > (
1438- item : & clean:: Item ,
1439- cx : & ' a Context < ' tcx > ,
1440- ) -> impl Display + ' a + Captures < ' tcx > {
1401+ pub ( crate ) fn visibility_print_with_space ( item : & clean:: Item , cx : & Context < ' _ > ) -> impl Display {
14411402 use std:: fmt:: Write as _;
14421403 let vis: Cow < ' static , str > = match item. visibility ( cx. tcx ( ) ) {
14431404 None => "" . into ( ) ,
@@ -1546,10 +1507,7 @@ pub(crate) fn print_constness_with_space(
15461507}
15471508
15481509impl clean:: Import {
1549- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1550- & ' a self ,
1551- cx : & ' a Context < ' tcx > ,
1552- ) -> impl Display + ' a + Captures < ' tcx > {
1510+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
15531511 fmt:: from_fn ( move |f| match self . kind {
15541512 clean:: ImportKind :: Simple ( name) => {
15551513 if name == self . source . path . last ( ) {
@@ -1570,10 +1528,7 @@ impl clean::Import {
15701528}
15711529
15721530impl clean:: ImportSource {
1573- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1574- & ' a self ,
1575- cx : & ' a Context < ' tcx > ,
1576- ) -> impl Display + ' a + Captures < ' tcx > {
1531+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
15771532 fmt:: from_fn ( move |f| match self . did {
15781533 Some ( did) => resolved_path ( f, did, & self . path , true , false , cx) ,
15791534 _ => {
@@ -1593,10 +1548,7 @@ impl clean::ImportSource {
15931548}
15941549
15951550impl clean:: AssocItemConstraint {
1596- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1597- & ' a self ,
1598- cx : & ' a Context < ' tcx > ,
1599- ) -> impl Display + ' a + Captures < ' tcx > {
1551+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
16001552 fmt:: from_fn ( move |f| {
16011553 f. write_str ( self . assoc . name . as_str ( ) ) ?;
16021554 self . assoc . args . print ( cx) . fmt ( f) ?;
@@ -1627,15 +1579,12 @@ pub(crate) fn print_abi_with_space(abi: ExternAbi) -> impl Display {
16271579 } )
16281580}
16291581
1630- pub ( crate ) fn print_default_space < ' a > ( v : bool ) -> & ' a str {
1582+ pub ( crate ) fn print_default_space ( v : bool ) -> & ' static str {
16311583 if v { "default " } else { "" }
16321584}
16331585
16341586impl clean:: GenericArg {
1635- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1636- & ' a self ,
1637- cx : & ' a Context < ' tcx > ,
1638- ) -> impl Display + ' a + Captures < ' tcx > {
1587+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
16391588 fmt:: from_fn ( move |f| match self {
16401589 clean:: GenericArg :: Lifetime ( lt) => lt. print ( ) . fmt ( f) ,
16411590 clean:: GenericArg :: Type ( ty) => ty. print ( cx) . fmt ( f) ,
@@ -1646,10 +1595,7 @@ impl clean::GenericArg {
16461595}
16471596
16481597impl clean:: Term {
1649- pub ( crate ) fn print < ' a , ' tcx : ' a > (
1650- & ' a self ,
1651- cx : & ' a Context < ' tcx > ,
1652- ) -> impl Display + ' a + Captures < ' tcx > {
1598+ pub ( crate ) fn print ( & self , cx : & Context < ' _ > ) -> impl Display {
16531599 fmt:: from_fn ( move |f| match self {
16541600 clean:: Term :: Type ( ty) => ty. print ( cx) . fmt ( f) ,
16551601 clean:: Term :: Constant ( ct) => ct. print ( cx. tcx ( ) ) . fmt ( f) ,
0 commit comments