@@ -35,7 +35,7 @@ use crate::session_diagnostics::{
35
35
LifetimeReturnCategoryErr , RequireStaticErr , VarHereDenote ,
36
36
} ;
37
37
use crate :: universal_regions:: DefiningTy ;
38
- use crate :: { borrowck_errors, fluent_generated, MirBorrowckCtxt } ;
38
+ use crate :: { borrowck_errors, fluent_generated as fluent , MirBorrowckCtxt } ;
39
39
40
40
impl < ' tcx > ConstraintDescription for ConstraintCategory < ' tcx > {
41
41
fn description ( & self ) -> & ' static str {
@@ -250,23 +250,28 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
250
250
debug ! ( ?hrtb_bounds) ;
251
251
252
252
hrtb_bounds. iter ( ) . for_each ( |bound| {
253
- let Trait ( PolyTraitRef { trait_ref, span : trait_span, .. } , _) = bound else { return ; } ;
254
- diag. span_note (
255
- * trait_span,
256
- fluent_generated:: borrowck_limitations_implies_static,
257
- ) ;
258
- let Some ( generics_fn) = hir. get_generics ( self . body . source . def_id ( ) . expect_local ( ) ) else { return ; } ;
259
- let Def ( _, trait_res_defid) = trait_ref. path . res else { return ; } ;
253
+ let Trait ( PolyTraitRef { trait_ref, span : trait_span, .. } , _) = bound else {
254
+ return ;
255
+ } ;
256
+ diag. span_note ( * trait_span, fluent:: borrowck_limitations_implies_static) ;
257
+ let Some ( generics_fn) = hir. get_generics ( self . body . source . def_id ( ) . expect_local ( ) )
258
+ else {
259
+ return ;
260
+ } ;
261
+ let Def ( _, trait_res_defid) = trait_ref. path . res else {
262
+ return ;
263
+ } ;
260
264
debug ! ( ?generics_fn) ;
261
265
generics_fn. predicates . iter ( ) . for_each ( |predicate| {
262
- let BoundPredicate (
263
- WhereBoundPredicate {
264
- span : bounded_span,
265
- bounded_ty,
266
- bounds,
267
- ..
268
- }
269
- ) = predicate else { return ; } ;
266
+ let BoundPredicate ( WhereBoundPredicate {
267
+ span : bounded_span,
268
+ bounded_ty,
269
+ bounds,
270
+ ..
271
+ } ) = predicate
272
+ else {
273
+ return ;
274
+ } ;
270
275
bounds. iter ( ) . for_each ( |bd| {
271
276
if let Trait ( PolyTraitRef { trait_ref : tr_ref, .. } , _) = bd
272
277
&& let Def ( _, res_defid) = tr_ref. path . res
@@ -276,16 +281,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
276
281
&& generics_fn. params
277
282
. iter ( )
278
283
. rfind ( |param| param. def_id . to_def_id ( ) == defid)
279
- . is_some ( ) {
280
- suggestions. push ( ( bounded_span. shrink_to_hi ( ) , " + 'static" . to_string ( ) ) ) ;
281
- }
284
+ . is_some ( )
285
+ {
286
+ suggestions. push ( ( bounded_span. shrink_to_hi ( ) , " + 'static" . to_string ( ) ) ) ;
287
+ }
282
288
} ) ;
283
289
} ) ;
284
290
} ) ;
285
291
if suggestions. len ( ) > 0 {
286
292
suggestions. dedup ( ) ;
287
293
diag. multipart_suggestion_verbose (
288
- fluent_generated :: borrowck_restrict_to_static,
294
+ fluent :: borrowck_restrict_to_static,
289
295
suggestions,
290
296
Applicability :: MaybeIncorrect ,
291
297
) ;
@@ -992,16 +998,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
992
998
debug ! ( "trait spans found: {:?}" , traits) ;
993
999
for span in & traits {
994
1000
let mut multi_span: MultiSpan = vec ! [ * span] . into ( ) ;
995
- multi_span
996
- . push_span_label ( * span, fluent_generated:: borrowck_implicit_static) ;
997
- multi_span. push_span_label (
998
- ident. span ,
999
- fluent_generated:: borrowck_implicit_static_introduced,
1000
- ) ;
1001
+ multi_span. push_span_label ( * span, fluent:: borrowck_implicit_static) ;
1002
+ multi_span. push_span_label ( ident. span , fluent:: borrowck_implicit_static_introduced) ;
1001
1003
err. subdiagnostic ( RequireStaticErr :: UsedImpl { multi_span } ) ;
1002
1004
err. span_suggestion_verbose (
1003
1005
span. shrink_to_hi ( ) ,
1004
- fluent_generated :: borrowck_implicit_static_relax,
1006
+ fluent :: borrowck_implicit_static_relax,
1005
1007
" + '_" ,
1006
1008
Applicability :: MaybeIncorrect ,
1007
1009
) ;
@@ -1163,7 +1165,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
1163
1165
if ocx. select_all_or_error ( ) . is_empty ( ) && count > 0 {
1164
1166
diag. span_suggestion_verbose (
1165
1167
tcx. hir ( ) . body ( * body) . value . peel_blocks ( ) . span . shrink_to_lo ( ) ,
1166
- fluent_generated :: borrowck_dereference_suggestion,
1168
+ fluent :: borrowck_dereference_suggestion,
1167
1169
"*" . repeat ( count) ,
1168
1170
Applicability :: MachineApplicable ,
1169
1171
) ;
@@ -1209,7 +1211,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
1209
1211
if let Some ( closure_span) = closure_span {
1210
1212
diag. span_suggestion_verbose (
1211
1213
closure_span,
1212
- fluent_generated :: borrowck_move_closure_suggestion,
1214
+ fluent :: borrowck_move_closure_suggestion,
1213
1215
"move " ,
1214
1216
Applicability :: MaybeIncorrect ,
1215
1217
) ;
0 commit comments