Fix #107090, fix missing arguments for fluent

This commit is contained in:
yukang 2023-01-18 17:23:50 +08:00
parent 04a41f889f
commit 0368adb262
3 changed files with 19 additions and 14 deletions

View File

@ -268,28 +268,28 @@ infer_but_calling_introduces = {$has_param_name ->
[true] `{$param_name}`
*[false] `fn` parameter
} has {$lifetime_kind ->
[named] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_`
} but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement
[true] lifetime `{$lifetime}`
*[false] an anonymous lifetime `'_`
} but calling `{$assoc_item}` introduces an implicit `'static` lifetime requirement
.label1 = {$has_lifetime ->
[named] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_`
[true] lifetime `{$lifetime}`
*[false] an anonymous lifetime `'_`
}
.label2 = ...is used and required to live as long as `'static` here because of an implicit lifetime bound on the {$has_impl_path ->
[named] `impl` of `{$impl_path}`
*[anon] inherent `impl`
[true] `impl` of `{$impl_path}`
*[false] inherent `impl`
}
infer_but_needs_to_satisfy = {$has_param_name ->
[true] `{$param_name}`
*[false] `fn` parameter
} has {$has_lifetime ->
[named] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_`
[true] lifetime `{$lifetime}`
*[false] an anonymous lifetime `'_`
} but it needs to satisfy a `'static` lifetime requirement
.influencer = this data with {$has_lifetime ->
[named] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_`
[true] lifetime `{$lifetime}`
*[false] an anonymous lifetime `'_`
}...
.require = {$spans_empty ->
*[true] ...is used and required to live as long as `'static` here
@ -302,8 +302,8 @@ infer_more_targeted = {$has_param_name ->
[true] `{$param_name}`
*[false] `fn` parameter
} has {$has_lifetime ->
[named] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_`
[true] lifetime `{$lifetime}`
*[false] an anonymous lifetime `'_`
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement
infer_ril_introduced_here = `'static` requirement introduced here

View File

@ -927,6 +927,8 @@ pub struct ButNeedsToSatisfy {
#[subdiagnostic]
pub req_introduces_loc: Option<ReqIntroducedLocations>,
pub has_param_name: bool,
pub param_name: String,
pub spans_empty: bool,
pub has_lifetime: bool,
pub lifetime: String,

View File

@ -98,6 +98,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let sp = var_origin.span();
let return_sp = sub_origin.span();
let param = self.find_param_with_region(*sup_r, *sub_r)?;
let simple_ident = param.param.pat.simple_ident();
let lifetime_name = if sup_r.has_name() { sup_r.to_string() } else { "'_".to_owned() };
let (mention_influencer, influencer_point) =
@ -187,7 +188,9 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
req_introduces_loc: subdiag,
has_lifetime: sup_r.has_name(),
lifetime: sup_r.to_string(),
lifetime: lifetime_name.clone(),
has_param_name: simple_ident.is_some(),
param_name: simple_ident.map(|x| x.to_string()).unwrap_or_default(),
spans_empty,
bound,
};