about summary refs log tree commit diff
path: root/tests/coverage/branch/lazy-boolean.coverage
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-11-17 22:30:47 -0500
committerGitHub <noreply@github.com>2024-11-17 22:30:47 -0500
commite2993cd06e7b35422fcf172b0ff247873ddbb163 (patch)
treed19df3d6611a70af5a0dc883464af87fb407e47a /tests/coverage/branch/lazy-boolean.coverage
parent3fb7e441aecc3c054d71eb4d752d06e7776e8888 (diff)
parent32d2340dbd4e9e724839c5ee8c6e73474660fe89 (diff)
downloadrust-e2993cd06e7b35422fcf172b0ff247873ddbb163.tar.gz
rust-e2993cd06e7b35422fcf172b0ff247873ddbb163.zip
Rollup merge of #132795 - compiler-errors:refine-rpitit, r=lcnr
Check `use<..>` in RPITIT for refinement

`#![feature(precise_capturing_in_traits)]` allows users to write `+ use<>` bounds on RPITITs to control what lifetimes are captured by the RPITIT.

Since RPITITs currently also warn for refinement in implementations, this PR extends that refinement check for cases where we *undercapture* in an implementation, since that may be indirectly "promising" a more relaxed outlives bound than the impl author intended.

For an opaque to be refining, we need to capture *fewer* parameters than those mentioned in the captured params of the trait. For example:

```
trait TypeParam<T> {
    fn test() -> impl Sized;
}
// Indirectly capturing a lifetime param through a type param substitution.
impl<'a> TypeParam<&'a ()> for i32 {
    fn test() -> impl Sized + use<> {}
    //~^ WARN impl trait in impl method captures fewer lifetimes than in trait
}
```

Since the opaque in the method (implicitly) captures `use<Self, T>`, and `Self = i32, T = &'a ()` in the impl, we must mention `'a` in our `use<..>` on the impl.

Tracking:
* https://github.com/rust-lang/rust/issues/130044
Diffstat (limited to 'tests/coverage/branch/lazy-boolean.coverage')
0 files changed, 0 insertions, 0 deletions