Skip to content

Commit 177d721

Browse files
Rollup merge of rust-lang#137963 - Eclips4:fix-E0373, r=compiler-errors
Add ``dyn`` keyword to `E0373` examples Closes rust-lang#137962
2 parents 783e650 + a89cddb commit 177d721

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+2
-2
lines changed

compiler/rustc_error_codes/src/error_codes/E0373.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A captured variable in a closure may not live long enough.
33
Erroneous code example:
44

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

4444
```
45-
fn foo() -> Box<Fn(u32) -> u32> {
45+
fn foo() -> Box<dyn Fn(u32) -> u32> {
4646
let x = 0u32;
4747
Box::new(move |y| x + y)
4848
}

0 commit comments

Comments
 (0)