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}` [true] `{$param_name}`
*[false] `fn` parameter *[false] `fn` parameter
} has {$lifetime_kind -> } has {$lifetime_kind ->
[named] lifetime `{$lifetime}` [true] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_` *[false] an anonymous lifetime `'_`
} but calling `{assoc_item}` introduces an implicit `'static` lifetime requirement } but calling `{$assoc_item}` introduces an implicit `'static` lifetime requirement
.label1 = {$has_lifetime -> .label1 = {$has_lifetime ->
[named] lifetime `{$lifetime}` [true] lifetime `{$lifetime}`
*[anon] an anonymous 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 -> .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}` [true] `impl` of `{$impl_path}`
*[anon] inherent `impl` *[false] inherent `impl`
} }
infer_but_needs_to_satisfy = {$has_param_name -> infer_but_needs_to_satisfy = {$has_param_name ->
[true] `{$param_name}` [true] `{$param_name}`
*[false] `fn` parameter *[false] `fn` parameter
} has {$has_lifetime -> } has {$has_lifetime ->
[named] lifetime `{$lifetime}` [true] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_` *[false] an anonymous lifetime `'_`
} but it needs to satisfy a `'static` lifetime requirement } but it needs to satisfy a `'static` lifetime requirement
.influencer = this data with {$has_lifetime -> .influencer = this data with {$has_lifetime ->
[named] lifetime `{$lifetime}` [true] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_` *[false] an anonymous lifetime `'_`
}... }...
.require = {$spans_empty -> .require = {$spans_empty ->
*[true] ...is used and required to live as long as `'static` here *[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}` [true] `{$param_name}`
*[false] `fn` parameter *[false] `fn` parameter
} has {$has_lifetime -> } has {$has_lifetime ->
[named] lifetime `{$lifetime}` [true] lifetime `{$lifetime}`
*[anon] an anonymous lifetime `'_` *[false] an anonymous lifetime `'_`
} but calling `{$ident}` introduces an implicit `'static` lifetime requirement } but calling `{$ident}` introduces an implicit `'static` lifetime requirement
infer_ril_introduced_here = `'static` requirement introduced here infer_ril_introduced_here = `'static` requirement introduced here

View File

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

View File

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