Skip to content

Commit 3b28797

Browse files
authored
Merge pull request #1601 from rust-lang/TC/lifetime-capture-rules-2024
Add Lifetime Capture Rules 2024
2 parents 63b590a + 3a8bef7 commit 3b28797

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/types/impl-trait.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,10 @@ Behind each return-position `impl Trait` abstract type is some hidden concrete t
119119
r[type.impl-trait.generic-capture.auto]
120120

121121
r[type.impl-trait.generic-capture.auto.intro]
122-
Return-position `impl Trait` abstract types automatically capture certain of the in-scope generic parameters. Everywhere, these automatically capture all in-scope type and const generic parameters.
122+
Return-position `impl Trait` abstract types automatically capture all in-scope generic parameters, including generic type, const, and lifetime parameters (including higher-ranked ones).
123123

124-
r[type.impl-trait.generic-capture.auto.trait]
125-
On items of trait impls and trait definitions, these types additionally automatically capture all in-scope generic lifetime parameters, including higher-ranked ones\1
126-
127-
r[type.impl-trait.generic-capture.auto.fn]
128-
On free functions and on associated functions and methods of inherent impls, only the generic lifetime parameters that appear in the bounds of abstract return type are captured.
124+
r[type.impl-trait.generic-capture.edition2024]
125+
> **Edition differences**: Before the 2024 edition, on free functions and on associated functions and methods of inherent impls, generic lifetime parameters that do not appear in the bounds of the abstract return type are not automatically captured.
129126
130127
## Precise capturing
131128

0 commit comments

Comments
 (0)