Suggest adding a new lifetime parameter when two elided lifetimes should match u...
source link: https://github.com/rust-lang/rust/pull/94464
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
..
})
| hir::Node::TraitItem(&hir::TraitItem { ref generics, .. })
| hir::Node::ImplItem(&hir::ImplItem { ref generics, .. }) => generics,
We should handle the impl
case specifically with extra wording in the suggestion to let people know that they'll have to modify the trait
as well. This is likely not a problem in practice, but I'd like us to be thorough and avoid confusing people.
It might be enough to just have a boolean flag that you use to modify the suggestion description with extra wording.
Good call. I'll make that change.
How about this for impl
?
help: consider introducing a named lifetime parameter and update trait if needed
|
32 | fn foo<'a>(&'a self, x: &i32, z: &'a i32) -> Option<&i32> {
| ++++ ++ ++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0623`.
Ideally we would have something like "consider introducing a named lifetime parameter and update trait TraitName
as necessary", by getting the TraitName
from the parent DefId, but that can be left as follow up work.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK