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
Copy file name to clipboardExpand all lines: src/expressions.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,7 @@ r[expr.super-macros.intro]
262
262
Certain built-in macros may create [temporaries] whose [scopes][temporary scopes] may be [extended]. These temporaries are *super temporaries* and these macros are *super macros*. [Invocations][macro invocations] of these macros are *super macro call expressions*. Arguments to these macros may be *super operands*.
263
263
264
264
> [!NOTE]
265
-
> When a super macro call expression is an [extending expression], its super operands are [extending expressions] and the [scopes][temporary scopes] of the super temporaries are [extended]. See [destructors.scope.lifetime-extension.exprs].
265
+
> The super operands of a super macro call are [extending expressions] and the [scopes][temporary scopes] of the super temporaries are [extended]. See [destructors.scope.lifetime-extension.exprs].
266
266
267
267
r[expr.super-macros.format_args]
268
268
#### `format_args!`
@@ -272,10 +272,11 @@ Except for the format string argument, all arguments passed to [`format_args!`]
272
272
273
273
```rust,edition2024
274
274
# fn temp() -> String { String::from("") }
275
-
// Due to the call being an extending expression and the argument
276
-
// being a super operand, the inner block is an extending expression,
277
-
// so the scope of the temporary created in its trailing expression
278
-
// is extended.
275
+
// Due to the argument being a super operand, the inner block is an
276
+
// extending expression, so the scope of the temporary created in its
277
+
// trailing expression is extended to the extended scope of the call.
278
+
// Since the call is the initializer of a `let` statement, this
279
+
// extends it to the end of the surrounding block.
279
280
let _ = format_args!("{}", { &temp() }); // OK
280
281
```
281
282
@@ -406,7 +407,6 @@ They are never allowed before:
0 commit comments