You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What we want to say, for lifetime extension on `static` and `const`
items, is that the lifetime is extended to the end of the program when
the temporary would be extended, according to our other rules, to a
scope outside that of the initializer expression. Let's take the easy
way out here and simply refer normatively to the other rule for this.
Copy file name to clipboardExpand all lines: src/destructors.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -336,9 +336,7 @@ println!("{}", x);
336
336
```
337
337
338
338
r[destructors.scope.lifetime-extension.static]
339
-
Lifetime extension also applies to the top-level scope of `static` and `const` items,
340
-
where it makes temporaries live until the end of the program.
341
-
For example:
339
+
The temporary scopes for expressions in `const` and `static` item initialiizers are sometimes extended until the end of the program following the same rule as in [destructors.scope.lifetime-extension.let]. For example:
0 commit comments