diff options
| author | Jubilee <workingjubilee@gmail.com> | 2025-03-04 19:37:03 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-04 19:37:03 -0800 |
| commit | 48a0d5217f1fd8d6c156add27839eef9ecabe233 (patch) | |
| tree | 1c84c1e5adb8572823b5da44a7785b2f60165d55 | |
| parent | a3b271d5fbd704864609013481e7a60ec1dfcbc8 (diff) | |
| parent | a89cddb2be47b52ec8373165e0d69448df80a23f (diff) | |
| download | rust-48a0d5217f1fd8d6c156add27839eef9ecabe233.tar.gz rust-48a0d5217f1fd8d6c156add27839eef9ecabe233.zip | |
Rollup merge of #137963 - Eclips4:fix-E0373, r=compiler-errors
Add ``dyn`` keyword to `E0373` examples Closes #137962
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0373.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0373.md b/compiler/rustc_error_codes/src/error_codes/E0373.md index d4d26007aa5..b9db8072597 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0373.md +++ b/compiler/rustc_error_codes/src/error_codes/E0373.md @@ -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) } @@ -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) } |
