]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_mir/src/borrow_check/diagnostics/region_errors.rs
use RegionNameHighlight for async fn and closure returns
[rust.git] / compiler / rustc_mir / src / borrow_check / diagnostics / region_errors.rs
1 //! Error reporting machinery for lifetime errors.
2
3 use rustc_errors::{Applicability, DiagnosticBuilder};
4 use rustc_infer::infer::{
5     error_reporting::nice_region_error::NiceRegionError,
6     error_reporting::unexpected_hidden_region_diagnostic, NLLRegionVariableOrigin,
7 };
8 use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
9 use rustc_middle::ty::{self, RegionVid, Ty};
10 use rustc_span::symbol::{kw, sym};
11 use rustc_span::Span;
12
13 use crate::util::borrowck_errors;
14
15 use crate::borrow_check::{
16     nll::ConstraintDescription,
17     region_infer::{values::RegionElement, TypeTest},
18     universal_regions::DefiningTy,
19     MirBorrowckCtxt,
20 };
21
22 use super::{OutlivesSuggestionBuilder, RegionName};
23
24 impl ConstraintDescription for ConstraintCategory {
25     fn description(&self) -> &'static str {
26         // Must end with a space. Allows for empty names to be provided.
27         match self {
28             ConstraintCategory::Assignment => "assignment ",
29             ConstraintCategory::Return(_) => "returning this value ",
30             ConstraintCategory::Yield => "yielding this value ",
31             ConstraintCategory::UseAsConst => "using this value as a constant ",
32             ConstraintCategory::UseAsStatic => "using this value as a static ",
33             ConstraintCategory::Cast => "cast ",
34             ConstraintCategory::CallArgument => "argument ",
35             ConstraintCategory::TypeAnnotation => "type annotation ",
36             ConstraintCategory::ClosureBounds => "closure body ",
37             ConstraintCategory::SizedBound => "proving this value is `Sized` ",
38             ConstraintCategory::CopyBound => "copying this value ",
39             ConstraintCategory::OpaqueType => "opaque type ",
40             ConstraintCategory::ClosureUpvar(_) => "closure capture ",
41             ConstraintCategory::Boring
42             | ConstraintCategory::BoringNoLocation
43             | ConstraintCategory::Internal => "",
44         }
45     }
46 }
47
48 /// A collection of errors encountered during region inference. This is needed to efficiently
49 /// report errors after borrow checking.
50 ///
51 /// Usually we expect this to either be empty or contain a small number of items, so we can avoid
52 /// allocation most of the time.
53 crate type RegionErrors<'tcx> = Vec<RegionErrorKind<'tcx>>;
54
55 #[derive(Clone, Debug)]
56 crate enum RegionErrorKind<'tcx> {
57     /// A generic bound failure for a type test (`T: 'a`).
58     TypeTestError { type_test: TypeTest<'tcx> },
59
60     /// An unexpected hidden region for an opaque type.
61     UnexpectedHiddenRegion {
62         /// The span for the member constraint.
63         span: Span,
64         /// The hidden type.
65         hidden_ty: Ty<'tcx>,
66         /// The unexpected region.
67         member_region: ty::Region<'tcx>,
68     },
69
70     /// Higher-ranked subtyping error.
71     BoundUniversalRegionError {
72         /// The placeholder free region.
73         longer_fr: RegionVid,
74         /// The region element that erroneously must be outlived by `longer_fr`.
75         error_element: RegionElement,
76         /// The origin of the placeholder region.
77         fr_origin: NLLRegionVariableOrigin,
78     },
79
80     /// Any other lifetime error.
81     RegionError {
82         /// The origin of the region.
83         fr_origin: NLLRegionVariableOrigin,
84         /// The region that should outlive `shorter_fr`.
85         longer_fr: RegionVid,
86         /// The region that should be shorter, but we can't prove it.
87         shorter_fr: RegionVid,
88         /// Indicates whether this is a reported error. We currently only report the first error
89         /// encountered and leave the rest unreported so as not to overwhelm the user.
90         is_reported: bool,
91     },
92 }
93
94 /// Information about the various region constraints involved in a borrow checker error.
95 #[derive(Clone, Debug)]
96 pub struct ErrorConstraintInfo {
97     // fr: outlived_fr
98     pub(super) fr: RegionVid,
99     pub(super) fr_is_local: bool,
100     pub(super) outlived_fr: RegionVid,
101     pub(super) outlived_fr_is_local: bool,
102
103     // Category and span for best blame constraint
104     pub(super) category: ConstraintCategory,
105     pub(super) span: Span,
106 }
107
108 impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
109     /// Converts a region inference variable into a `ty::Region` that
110     /// we can use for error reporting. If `r` is universally bound,
111     /// then we use the name that we have on record for it. If `r` is
112     /// existentially bound, then we check its inferred value and try
113     /// to find a good name from that. Returns `None` if we can't find
114     /// one (e.g., this is just some random part of the CFG).
115     pub(super) fn to_error_region(&self, r: RegionVid) -> Option<ty::Region<'tcx>> {
116         self.to_error_region_vid(r).and_then(|r| self.regioncx.region_definition(r).external_name)
117     }
118
119     /// Returns the `RegionVid` corresponding to the region returned by
120     /// `to_error_region`.
121     pub(super) fn to_error_region_vid(&self, r: RegionVid) -> Option<RegionVid> {
122         if self.regioncx.universal_regions().is_universal_region(r) {
123             Some(r)
124         } else {
125             // We just want something nameable, even if it's not
126             // actually an upper bound.
127             let upper_bound = self.regioncx.approx_universal_upper_bound(r);
128
129             if self.regioncx.upper_bound_in_region_scc(r, upper_bound) {
130                 self.to_error_region_vid(upper_bound)
131             } else {
132                 None
133             }
134         }
135     }
136
137     /// Returns `true` if a closure is inferred to be an `FnMut` closure.
138     fn is_closure_fn_mut(&self, fr: RegionVid) -> bool {
139         if let Some(ty::ReFree(free_region)) = self.to_error_region(fr) {
140             if let ty::BoundRegion::BrEnv = free_region.bound_region {
141                 if let DefiningTy::Closure(_, substs) =
142                     self.regioncx.universal_regions().defining_ty
143                 {
144                     return substs.as_closure().kind() == ty::ClosureKind::FnMut;
145                 }
146             }
147         }
148
149         false
150     }
151
152     /// Produces nice borrowck error diagnostics for all the errors collected in `nll_errors`.
153     pub(in crate::borrow_check) fn report_region_errors(&mut self, nll_errors: RegionErrors<'tcx>) {
154         // Iterate through all the errors, producing a diagnostic for each one. The diagnostics are
155         // buffered in the `MirBorrowckCtxt`.
156
157         let mut outlives_suggestion = OutlivesSuggestionBuilder::default();
158
159         for nll_error in nll_errors.into_iter() {
160             match nll_error {
161                 RegionErrorKind::TypeTestError { type_test } => {
162                     // Try to convert the lower-bound region into something named we can print for the user.
163                     let lower_bound_region = self.to_error_region(type_test.lower_bound);
164
165                     let type_test_span = type_test.locations.span(&self.body);
166
167                     if let Some(lower_bound_region) = lower_bound_region {
168                         self.infcx
169                             .construct_generic_bound_failure(
170                                 type_test_span,
171                                 None,
172                                 type_test.generic_kind,
173                                 lower_bound_region,
174                             )
175                             .buffer(&mut self.errors_buffer);
176                     } else {
177                         // FIXME. We should handle this case better. It
178                         // indicates that we have e.g., some region variable
179                         // whose value is like `'a+'b` where `'a` and `'b` are
180                         // distinct unrelated univesal regions that are not
181                         // known to outlive one another. It'd be nice to have
182                         // some examples where this arises to decide how best
183                         // to report it; we could probably handle it by
184                         // iterating over the universal regions and reporting
185                         // an error that multiple bounds are required.
186                         self.infcx
187                             .tcx
188                             .sess
189                             .struct_span_err(
190                                 type_test_span,
191                                 &format!("`{}` does not live long enough", type_test.generic_kind),
192                             )
193                             .buffer(&mut self.errors_buffer);
194                     }
195                 }
196
197                 RegionErrorKind::UnexpectedHiddenRegion { span, hidden_ty, member_region } => {
198                     let named_ty = self.regioncx.name_regions(self.infcx.tcx, hidden_ty);
199                     let named_region = self.regioncx.name_regions(self.infcx.tcx, member_region);
200                     unexpected_hidden_region_diagnostic(
201                         self.infcx.tcx,
202                         span,
203                         named_ty,
204                         named_region,
205                     )
206                     .buffer(&mut self.errors_buffer);
207                 }
208
209                 RegionErrorKind::BoundUniversalRegionError {
210                     longer_fr,
211                     fr_origin,
212                     error_element,
213                 } => {
214                     let error_region = self.regioncx.region_from_element(longer_fr, error_element);
215
216                     // Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
217                     let (_, span) = self.regioncx.find_outlives_blame_span(
218                         &self.body,
219                         longer_fr,
220                         fr_origin,
221                         error_region,
222                     );
223
224                     // FIXME: improve this error message
225                     self.infcx
226                         .tcx
227                         .sess
228                         .struct_span_err(span, "higher-ranked subtype error")
229                         .buffer(&mut self.errors_buffer);
230                 }
231
232                 RegionErrorKind::RegionError { fr_origin, longer_fr, shorter_fr, is_reported } => {
233                     if is_reported {
234                         self.report_region_error(
235                             longer_fr,
236                             fr_origin,
237                             shorter_fr,
238                             &mut outlives_suggestion,
239                         );
240                     } else {
241                         // We only report the first error, so as not to overwhelm the user. See
242                         // `RegRegionErrorKind` docs.
243                         //
244                         // FIXME: currently we do nothing with these, but perhaps we can do better?
245                         // FIXME: try collecting these constraints on the outlives suggestion
246                         // builder. Does it make the suggestions any better?
247                         debug!(
248                             "Unreported region error: can't prove that {:?}: {:?}",
249                             longer_fr, shorter_fr
250                         );
251                     }
252                 }
253             }
254         }
255
256         // Emit one outlives suggestions for each MIR def we borrowck
257         outlives_suggestion.add_suggestion(self);
258     }
259
260     /// Report an error because the universal region `fr` was required to outlive
261     /// `outlived_fr` but it is not known to do so. For example:
262     ///
263     /// ```
264     /// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
265     /// ```
266     ///
267     /// Here we would be invoked with `fr = 'a` and `outlived_fr = `'b`.
268     pub(in crate::borrow_check) fn report_region_error(
269         &mut self,
270         fr: RegionVid,
271         fr_origin: NLLRegionVariableOrigin,
272         outlived_fr: RegionVid,
273         outlives_suggestion: &mut OutlivesSuggestionBuilder,
274     ) {
275         debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr);
276
277         let (category, _, span) =
278             self.regioncx.best_blame_constraint(&self.body, fr, fr_origin, |r| {
279                 self.regioncx.provides_universal_region(r, fr, outlived_fr)
280             });
281
282         debug!("report_region_error: category={:?} {:?}", category, span);
283         // Check if we can use one of the "nice region errors".
284         if let (Some(f), Some(o)) = (self.to_error_region(fr), self.to_error_region(outlived_fr)) {
285             let nice = NiceRegionError::new_from_span(self.infcx, span, o, f);
286             if let Some(diag) = nice.try_report_from_nll() {
287                 diag.buffer(&mut self.errors_buffer);
288                 return;
289             }
290         }
291
292         let (fr_is_local, outlived_fr_is_local): (bool, bool) = (
293             self.regioncx.universal_regions().is_local_free_region(fr),
294             self.regioncx.universal_regions().is_local_free_region(outlived_fr),
295         );
296
297         debug!(
298             "report_region_error: fr_is_local={:?} outlived_fr_is_local={:?} category={:?}",
299             fr_is_local, outlived_fr_is_local, category
300         );
301
302         let errci = ErrorConstraintInfo {
303             fr,
304             outlived_fr,
305             fr_is_local,
306             outlived_fr_is_local,
307             category,
308             span,
309         };
310
311         let diag = match (category, fr_is_local, outlived_fr_is_local) {
312             (ConstraintCategory::Return(kind), true, false) if self.is_closure_fn_mut(fr) => {
313                 self.report_fnmut_error(&errci, kind)
314             }
315             (ConstraintCategory::Assignment, true, false)
316             | (ConstraintCategory::CallArgument, true, false) => {
317                 let mut db = self.report_escaping_data_error(&errci);
318
319                 outlives_suggestion.intermediate_suggestion(self, &errci, &mut db);
320                 outlives_suggestion.collect_constraint(fr, outlived_fr);
321
322                 db
323             }
324             _ => {
325                 let mut db = self.report_general_error(&errci);
326
327                 outlives_suggestion.intermediate_suggestion(self, &errci, &mut db);
328                 outlives_suggestion.collect_constraint(fr, outlived_fr);
329
330                 db
331             }
332         };
333
334         diag.buffer(&mut self.errors_buffer);
335     }
336
337     /// Report a specialized error when `FnMut` closures return a reference to a captured variable.
338     /// This function expects `fr` to be local and `outlived_fr` to not be local.
339     ///
340     /// ```text
341     /// error: captured variable cannot escape `FnMut` closure body
342     ///   --> $DIR/issue-53040.rs:15:8
343     ///    |
344     /// LL |     || &mut v;
345     ///    |     -- ^^^^^^ creates a reference to a captured variable which escapes the closure body
346     ///    |     |
347     ///    |     inferred to be a `FnMut` closure
348     ///    |
349     ///    = note: `FnMut` closures only have access to their captured variables while they are
350     ///            executing...
351     ///    = note: ...therefore, returned references to captured variables will escape the closure
352     /// ```
353     fn report_fnmut_error(
354         &self,
355         errci: &ErrorConstraintInfo,
356         kind: ReturnConstraint,
357     ) -> DiagnosticBuilder<'tcx> {
358         let ErrorConstraintInfo { outlived_fr, span, .. } = errci;
359
360         let mut diag = self
361             .infcx
362             .tcx
363             .sess
364             .struct_span_err(*span, "captured variable cannot escape `FnMut` closure body");
365
366         let mut output_ty = self.regioncx.universal_regions().unnormalized_output_ty;
367         if let ty::Opaque(def_id, _) = *output_ty.kind() {
368             output_ty = self.infcx.tcx.type_of(def_id)
369         };
370
371         debug!("report_fnmut_error: output_ty={:?}", output_ty);
372
373         let message = match output_ty.kind() {
374             ty::Closure(_, _) => {
375                 "returns a closure that contains a reference to a captured variable, which then \
376                  escapes the closure body"
377             }
378             ty::Adt(def, _) if self.infcx.tcx.is_diagnostic_item(sym::gen_future, def.did) => {
379                 "returns an `async` block that contains a reference to a captured variable, which then \
380                  escapes the closure body"
381             }
382             _ => "returns a reference to a captured variable which escapes the closure body",
383         };
384
385         diag.span_label(*span, message);
386
387         if let ReturnConstraint::ClosureUpvar(upvar) = kind {
388             let def_id = match self.regioncx.universal_regions().defining_ty {
389                 DefiningTy::Closure(def_id, _) => def_id,
390                 ty => bug!("unexpected DefiningTy {:?}", ty),
391             };
392
393             let upvar_def_span = self.infcx.tcx.hir().span(upvar);
394             let upvar_span = self.infcx.tcx.upvars_mentioned(def_id).unwrap()[&upvar].span;
395             diag.span_label(upvar_def_span, "variable defined here");
396             diag.span_label(upvar_span, "variable captured here");
397         }
398
399         if let Some(fr_span) = self.give_region_a_name(*outlived_fr).unwrap().span() {
400             diag.span_label(fr_span, "inferred to be a `FnMut` closure");
401         }
402
403         diag.note(
404             "`FnMut` closures only have access to their captured variables while they are \
405              executing...",
406         );
407         diag.note("...therefore, they cannot allow references to captured variables to escape");
408
409         diag
410     }
411
412     /// Reports a error specifically for when data is escaping a closure.
413     ///
414     /// ```text
415     /// error: borrowed data escapes outside of function
416     ///   --> $DIR/lifetime-bound-will-change-warning.rs:44:5
417     ///    |
418     /// LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
419     ///    |              - `x` is a reference that is only valid in the function body
420     /// LL |     // but ref_obj will not, so warn.
421     /// LL |     ref_obj(x)
422     ///    |     ^^^^^^^^^^ `x` escapes the function body here
423     /// ```
424     fn report_escaping_data_error(&self, errci: &ErrorConstraintInfo) -> DiagnosticBuilder<'tcx> {
425         let ErrorConstraintInfo { span, category, .. } = errci;
426
427         let fr_name_and_span = self.regioncx.get_var_name_and_span_for_region(
428             self.infcx.tcx,
429             &self.body,
430             &self.local_names,
431             &self.upvars,
432             errci.fr,
433         );
434         let outlived_fr_name_and_span = self.regioncx.get_var_name_and_span_for_region(
435             self.infcx.tcx,
436             &self.body,
437             &self.local_names,
438             &self.upvars,
439             errci.outlived_fr,
440         );
441
442         let (_, escapes_from) = self
443             .infcx
444             .tcx
445             .article_and_description(self.regioncx.universal_regions().defining_ty.def_id());
446
447         // Revert to the normal error in these cases.
448         // Assignments aren't "escapes" in function items.
449         if (fr_name_and_span.is_none() && outlived_fr_name_and_span.is_none())
450             || (*category == ConstraintCategory::Assignment
451                 && self.regioncx.universal_regions().defining_ty.is_fn_def())
452             || self.regioncx.universal_regions().defining_ty.is_const()
453         {
454             return self.report_general_error(&ErrorConstraintInfo {
455                 fr_is_local: true,
456                 outlived_fr_is_local: false,
457                 ..*errci
458             });
459         }
460
461         let mut diag =
462             borrowck_errors::borrowed_data_escapes_closure(self.infcx.tcx, *span, escapes_from);
463
464         if let Some((Some(outlived_fr_name), outlived_fr_span)) = outlived_fr_name_and_span {
465             diag.span_label(
466                 outlived_fr_span,
467                 format!(
468                     "`{}` declared here, outside of the {} body",
469                     outlived_fr_name, escapes_from
470                 ),
471             );
472         }
473
474         if let Some((Some(fr_name), fr_span)) = fr_name_and_span {
475             diag.span_label(
476                 fr_span,
477                 format!(
478                     "`{}` is a reference that is only valid in the {} body",
479                     fr_name, escapes_from
480                 ),
481             );
482
483             diag.span_label(*span, format!("`{}` escapes the {} body here", fr_name, escapes_from));
484         }
485
486         diag
487     }
488
489     /// Reports a region inference error for the general case with named/synthesized lifetimes to
490     /// explain what is happening.
491     ///
492     /// ```text
493     /// error: unsatisfied lifetime constraints
494     ///   --> $DIR/regions-creating-enums3.rs:17:5
495     ///    |
496     /// LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
497     ///    |                -- -- lifetime `'b` defined here
498     ///    |                |
499     ///    |                lifetime `'a` defined here
500     /// LL |     ast::add(x, y)
501     ///    |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it
502     ///    |                    is returning data with lifetime `'b`
503     /// ```
504     fn report_general_error(&self, errci: &ErrorConstraintInfo) -> DiagnosticBuilder<'tcx> {
505         let ErrorConstraintInfo {
506             fr,
507             fr_is_local,
508             outlived_fr,
509             outlived_fr_is_local,
510             span,
511             category,
512             ..
513         } = errci;
514
515         let mut diag =
516             self.infcx.tcx.sess.struct_span_err(*span, "lifetime may not live long enough");
517
518         let (_, mir_def_name) =
519             self.infcx.tcx.article_and_description(self.mir_def_id().to_def_id());
520
521         let fr_name = self.give_region_a_name(*fr).unwrap();
522         fr_name.highlight_region_name(&mut diag);
523         let outlived_fr_name = self.give_region_a_name(*outlived_fr).unwrap();
524         outlived_fr_name.highlight_region_name(&mut diag);
525
526         match (category, outlived_fr_is_local, fr_is_local) {
527             (ConstraintCategory::Return(_), true, _) => {
528                 diag.span_label(
529                     *span,
530                     format!(
531                         "{} was supposed to return data with lifetime `{}` but it is returning \
532                          data with lifetime `{}`",
533                         mir_def_name, outlived_fr_name, fr_name
534                     ),
535                 );
536             }
537             _ => {
538                 diag.span_label(
539                     *span,
540                     format!(
541                         "{}requires that `{}` must outlive `{}`",
542                         category.description(),
543                         fr_name,
544                         outlived_fr_name,
545                     ),
546                 );
547             }
548         }
549
550         self.add_static_impl_trait_suggestion(&mut diag, *fr, fr_name, *outlived_fr);
551
552         diag
553     }
554
555     /// Adds a suggestion to errors where a `impl Trait` is returned.
556     ///
557     /// ```text
558     /// help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as
559     ///       a constraint
560     ///    |
561     /// LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + 'a {
562     ///    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
563     /// ```
564     fn add_static_impl_trait_suggestion(
565         &self,
566         diag: &mut DiagnosticBuilder<'tcx>,
567         fr: RegionVid,
568         // We need to pass `fr_name` - computing it again will label it twice.
569         fr_name: RegionName,
570         outlived_fr: RegionVid,
571     ) {
572         if let (Some(f), Some(ty::RegionKind::ReStatic)) =
573             (self.to_error_region(fr), self.to_error_region(outlived_fr))
574         {
575             if let Some(&ty::Opaque(did, substs)) = self
576                 .infcx
577                 .tcx
578                 .is_suitable_region(f)
579                 .map(|r| r.def_id)
580                 .and_then(|id| self.infcx.tcx.return_type_impl_trait(id))
581                 .map(|(ty, _)| ty.kind())
582             {
583                 // Check whether or not the impl trait return type is intended to capture
584                 // data with the static lifetime.
585                 //
586                 // eg. check for `impl Trait + 'static` instead of `impl Trait`.
587                 let has_static_predicate = {
588                     let predicates_of = self.infcx.tcx.predicates_of(did);
589                     let bounds = predicates_of.instantiate(self.infcx.tcx, substs);
590
591                     let mut found = false;
592                     for predicate in bounds.predicates {
593                         if let ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(_, r)) =
594                             predicate.skip_binders()
595                         {
596                             if let ty::RegionKind::ReStatic = r {
597                                 found = true;
598                                 break;
599                             } else {
600                                 // If there's already a lifetime bound, don't
601                                 // suggest anything.
602                                 return;
603                             }
604                         }
605                     }
606
607                     found
608                 };
609
610                 debug!(
611                     "add_static_impl_trait_suggestion: has_static_predicate={:?}",
612                     has_static_predicate
613                 );
614                 let static_str = kw::StaticLifetime;
615                 // If there is a static predicate, then the only sensible suggestion is to replace
616                 // fr with `'static`.
617                 if has_static_predicate {
618                     diag.help(&format!("consider replacing `{}` with `{}`", fr_name, static_str));
619                 } else {
620                     // Otherwise, we should suggest adding a constraint on the return type.
621                     let span = self.infcx.tcx.def_span(did);
622                     if let Ok(snippet) = self.infcx.tcx.sess.source_map().span_to_snippet(span) {
623                         let suggestable_fr_name = if fr_name.was_named() {
624                             fr_name.to_string()
625                         } else {
626                             "'_".to_string()
627                         };
628                         let suggestion = if snippet.ends_with(';') {
629                             // `type X = impl Trait;`
630                             format!("{} + {};", &snippet[..snippet.len() - 1], suggestable_fr_name)
631                         } else {
632                             format!("{} + {}", snippet, suggestable_fr_name)
633                         };
634                         diag.span_suggestion(
635                             span,
636                             &format!(
637                                 "to allow this `impl Trait` to capture borrowed data with lifetime \
638                                  `{}`, add `{}` as a bound",
639                                 fr_name, suggestable_fr_name,
640                             ),
641                             suggestion,
642                             Applicability::MachineApplicable,
643                         );
644                     }
645                 }
646             }
647         }
648     }
649 }