@@ -2,7 +2,8 @@ use std::iter;
22
33use rustc_data_structures:: fx:: FxIndexSet ;
44use rustc_errors:: {
5- Applicability , Diag , E0309 , E0310 , E0311 , E0803 , Subdiagnostic , struct_span_code_err,
5+ Applicability , Diag , E0309 , E0310 , E0311 , E0803 , Subdiagnostic , inline_fluent,
6+ struct_span_code_err,
67} ;
78use rustc_hir:: def:: DefKind ;
89use rustc_hir:: def_id:: { DefId , LocalDefId } ;
@@ -25,7 +26,6 @@ use crate::errors::{
2526 self , FulfillReqLifetime , LfBoundNotSatisfied , OutlivesBound , OutlivesContent ,
2627 RefLongerThanData , RegionOriginNote , WhereClauseSuggestions , note_and_explain,
2728} ;
28- use crate :: fluent_generated as fluent;
2929use crate :: infer:: region_constraints:: GenericKind ;
3030use crate :: infer:: {
3131 BoundRegionConversionTime , InferCtxt , RegionResolutionError , RegionVariableOrigin ,
@@ -228,18 +228,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
228228 expected_found : self . values_str ( trace. values , & trace. cause , err. long_ty_path ( ) ) ,
229229 }
230230 . add_to_diag ( err) ,
231- SubregionOrigin :: Reborrow ( span) => {
232- RegionOriginNote :: Plain { span, msg : fluent :: trait_selection_reborrow }
233- . add_to_diag ( err )
231+ SubregionOrigin :: Reborrow ( span) => RegionOriginNote :: Plain {
232+ span,
233+ msg : inline_fluent ! ( "...so that reference does not outlive borrowed content" ) ,
234234 }
235+ . add_to_diag ( err) ,
235236 SubregionOrigin :: RelateObjectBound ( span) => {
236- RegionOriginNote :: Plain { span, msg : fluent:: trait_selection_relate_object_bound }
237- . add_to_diag ( err) ;
237+ RegionOriginNote :: Plain {
238+ span,
239+ msg : inline_fluent ! ( "...so that it can be closed over into an object" ) ,
240+ }
241+ . add_to_diag ( err) ;
238242 }
239243 SubregionOrigin :: ReferenceOutlivesReferent ( ty, span) => {
240244 RegionOriginNote :: WithName {
241245 span,
242- msg : fluent :: trait_selection_reference_outlives_referent ,
246+ msg : inline_fluent ! ( "...so that the reference type `{$name}` does not outlive the data it points at" ) ,
243247 name : & self . ty_to_string ( ty) ,
244248 continues : false ,
245249 }
@@ -248,30 +252,37 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
248252 SubregionOrigin :: RelateParamBound ( span, ty, opt_span) => {
249253 RegionOriginNote :: WithName {
250254 span,
251- msg : fluent:: trait_selection_relate_param_bound,
255+ msg : inline_fluent ! ( "...so that the type `{$name}` will meet its required lifetime bounds{$continues ->
256+ [true] ...
257+ *[false] {\" \" }
258+ }" ) ,
252259 name : & self . ty_to_string ( ty) ,
253260 continues : opt_span. is_some ( ) ,
254261 }
255262 . add_to_diag ( err) ;
256263 if let Some ( span) = opt_span {
257264 RegionOriginNote :: Plain {
258265 span,
259- msg : fluent :: trait_selection_relate_param_bound_2 ,
266+ msg : inline_fluent ! ( "...that is required by this bound" ) ,
260267 }
261268 . add_to_diag ( err) ;
262269 }
263270 }
264271 SubregionOrigin :: RelateRegionParamBound ( span, _) => {
265272 RegionOriginNote :: Plain {
266273 span,
267- msg : fluent:: trait_selection_relate_region_param_bound,
274+ msg : inline_fluent ! (
275+ "...so that the declared lifetime parameter bounds are satisfied"
276+ ) ,
268277 }
269278 . add_to_diag ( err) ;
270279 }
271280 SubregionOrigin :: CompareImplItemObligation { span, .. } => {
272281 RegionOriginNote :: Plain {
273282 span,
274- msg : fluent:: trait_selection_compare_impl_item_obligation,
283+ msg : inline_fluent ! (
284+ "...so that the definition in impl matches the definition from the trait"
285+ ) ,
275286 }
276287 . add_to_diag ( err) ;
277288 }
@@ -281,7 +292,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
281292 SubregionOrigin :: AscribeUserTypeProvePredicate ( span) => {
282293 RegionOriginNote :: Plain {
283294 span,
284- msg : fluent :: trait_selection_ascribe_user_type_prove_predicate ,
295+ msg : inline_fluent ! ( "...so that the where clause holds" ) ,
285296 }
286297 . add_to_diag ( err) ;
287298 }
0 commit comments