Skip to content

Commit

Permalink
Rollup merge of #137963 - Eclips4:fix-E0373, r=compiler-errors
Browse files Browse the repository at this point in the history
Add ``dyn`` keyword to `E0373` examples

Closes #137962
  • Loading branch information
workingjubilee authored Mar 5, 2025
2 parents a3b271d + a89cddb commit 48a0d52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0373.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A captured variable in a closure may not live long enough.
Erroneous code example:

```compile_fail,E0373
fn foo() -> Box<Fn(u32) -> u32> {
fn foo() -> Box<dyn Fn(u32) -> u32> {
let x = 0u32;
Box::new(|y| x + y)
}
Expand Down Expand Up @@ -42,7 +42,7 @@ This approach moves (or copies, where possible) data into the closure, rather
than taking references to it. For example:

```
fn foo() -> Box<Fn(u32) -> u32> {
fn foo() -> Box<dyn Fn(u32) -> u32> {
let x = 0u32;
Box::new(move |y| x + y)
}
Expand Down

0 comments on commit 48a0d52

Please sign in to comment.