-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't worry about uncaptured contravariant lifetimes if they outlive …
…a captured lifetime
- Loading branch information
1 parent
eb33b43
commit f8f4d50
Showing
2 changed files
with
241 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/ui/impl-trait/precise-capturing/overcaptures-2024-but-fine.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@ check-pass | ||
|
||
#![deny(impl_trait_overcaptures)] | ||
|
||
struct Ctxt<'tcx>(&'tcx ()); | ||
|
||
// In `compute`, we don't care that we're "overcapturing" `'tcx` | ||
// in edition 2024, because it can be shortened at the call site | ||
// and we know it outlives `'_`. | ||
|
||
impl<'tcx> Ctxt<'tcx> { | ||
fn compute(&self) -> impl Sized + '_ {} | ||
} | ||
|
||
fn main() {} |