Skip to content

Commit

Permalink
Fix #107090, fix missing arguments for fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jan 18, 2023
1 parent 04a41f8 commit 0368adb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
26 changes: 13 additions & 13 deletions compiler/rustc_error_messages/locales/en-US/infer.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_infer/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 0368adb

Please sign in to comment.