Rollup merge of #89504 - Aaron1011:rpit-nll-static, r=nikomatsakis
Don't suggest replacing region with 'static in NLL Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do.
This commit is contained in:
commit
bf62c6d710
62 changed files with 25 additions and 214 deletions
|
@ -171,9 +171,7 @@ impl OutlivesSuggestionBuilder {
|
|||
let outlived_fr_name = self.region_vid_to_name(mbcx, errci.outlived_fr);
|
||||
|
||||
if let (Some(fr_name), Some(outlived_fr_name)) = (fr_name, outlived_fr_name) {
|
||||
if let RegionNameSource::Static = outlived_fr_name.source {
|
||||
diag.help(&format!("consider replacing `{}` with `'static`", fr_name));
|
||||
} else {
|
||||
if !matches!(outlived_fr_name.source, RegionNameSource::Static) {
|
||||
diag.help(&format!(
|
||||
"consider adding the following bound: `{}: {}`",
|
||||
fr_name, outlived_fr_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue