Skip to content

Commit 0368adb

Browse files
committed
Fix #107090, fix missing arguments for fluent
1 parent 04a41f8 commit 0368adb

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

compiler/rustc_error_messages/locales/en-US/infer.ftl

+13-13
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,28 @@ infer_but_calling_introduces = {$has_param_name ->
268268
[true] `{$param_name}`
269269
*[false] `fn` parameter
270270
} has {$lifetime_kind ->
271-
[named] lifetime `{$lifetime}`
272-
*[anon] an anonymous lifetime `'_`
273-
} but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement
271+
[true] lifetime `{$lifetime}`
272+
*[false] an anonymous lifetime `'_`
273+
} but calling `{$assoc_item}` introduces an implicit `'static` lifetime requirement
274274
.label1 = {$has_lifetime ->
275-
[named] lifetime `{$lifetime}`
276-
*[anon] an anonymous lifetime `'_`
275+
[true] lifetime `{$lifetime}`
276+
*[false] an anonymous lifetime `'_`
277277
}
278278
.label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path ->
279-
[named] `impl` of `{$impl_path}`
280-
*[anon] inherent `impl`
279+
[true] `impl` of `{$impl_path}`
280+
*[false] inherent `impl`
281281
}
282282
283283
infer_but_needs_to_satisfy = {$has_param_name ->
284284
[true] `{$param_name}`
285285
*[false] `fn` parameter
286286
} has {$has_lifetime ->
287-
[named] lifetime `{$lifetime}`
288-
*[anon] an anonymous lifetime `'_`
287+
[true] lifetime `{$lifetime}`
288+
*[false] an anonymous lifetime `'_`
289289
} but it needs to satisfy a `'static` lifetime requirement
290290
.influencer = this data with {$has_lifetime ->
291-
[named] lifetime `{$lifetime}`
292-
*[anon] an anonymous lifetime `'_`
291+
[true] lifetime `{$lifetime}`
292+
*[false] an anonymous lifetime `'_`
293293
}...
294294
.require = {$spans_empty ->
295295
*[true] ...is used and required to live as long as `'static` here
@@ -302,8 +302,8 @@ infer_more_targeted = {$has_param_name ->
302302
[true] `{$param_name}`
303303
*[false] `fn` parameter
304304
} has {$has_lifetime ->
305-
[named] lifetime `{$lifetime}`
306-
*[anon] an anonymous lifetime `'_`
305+
[true] lifetime `{$lifetime}`
306+
*[false] an anonymous lifetime `'_`
307307
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement
308308
309309
infer_ril_introduced_here = `'static` requirement introduced here

compiler/rustc_infer/src/errors/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,8 @@ pub struct ButNeedsToSatisfy {
927927
#[subdiagnostic]
928928
pub req_introduces_loc: Option<ReqIntroducedLocations>,
929929

930+
pub has_param_name: bool,
931+
pub param_name: String,
930932
pub spans_empty: bool,
931933
pub has_lifetime: bool,
932934
pub lifetime: String,

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
9898
let sp = var_origin.span();
9999
let return_sp = sub_origin.span();
100100
let param = self.find_param_with_region(*sup_r, *sub_r)?;
101+
let simple_ident = param.param.pat.simple_ident();
101102
let lifetime_name = if sup_r.has_name() { sup_r.to_string() } else { "'_".to_owned() };
102103

103104
let (mention_influencer, influencer_point) =
@@ -187,7 +188,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
187188
req_introduces_loc: subdiag,
188189

189190
has_lifetime: sup_r.has_name(),
190-
lifetime: sup_r.to_string(),
191+
lifetime: lifetime_name.clone(),
192+
has_param_name: simple_ident.is_some(),
193+
param_name: simple_ident.map(|x| x.to_string()).unwrap_or_default(),
191194
spans_empty,
192195
bound,
193196
};

0 commit comments

Comments
 (0)