unlike closure parent args, we check member constraints for unused early-bound `FnDef` lifetimes
Open
Nobody has claimed this yet.
A-lifetimes
needs-triage
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
FnDef lifetime arguments are ignored by outlives constraints. They are not ignored by member constraints. This is inconsistent.
fn cool<'a: 'a>() {}
fn closure_outlives<'a>() -> impl Sized + use<'a> + 'static {
|| ()
}
fn fn_def_outlives<'a>() -> impl Sized + use<'a> + 'static {
cool::<'a>
}
fn closure_member_constraints<'a>() -> impl Sized + use<> {
|| ()
}
fn fn_def_member_constraints<'a>() -> impl Sized + use<> {
cool::<'a> //~ ERROR hidden type for `impl Sized` captures lifetime that does not appear in bounds
}
We shouldn't try to make this consistent before resolving https://github.com/rust-lang/rust/issues/153140#issuecomment-4222065426
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Rust reproducer and compare the closure and FnDef cases for outlives and member constraints. Read issue #153140 and its referenced comment before changing behavior; the intended fix is not defined until that issue is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100