Skip to content

Commit 2ef9660

Browse files
committed
Translate untranslated lines in closures.md
1 parent d672bef commit 2ef9660

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/fn/closures.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ fn main() {
3737
let outer_var = 42;
3838
3939
// A regular function can't refer to variables in the enclosing environment
40-
// Increment via closures and functions.
41-
// 関数とクロージャのそれぞれで数値をインクリメントする
40+
// 通常の関数は周辺の環境の変数を参照できない。
4241
//fn function(i: i32) -> i32 { i + outer_var }
4342
// TODO: uncomment the line above and see the compiler error. The compiler
4443
// suggests that we define a closure instead.
44+
// TODO: 上の行をアンコメントしてコンパイラエラーを見てみよう。
45+
// 代わりにクロージャを定義することをコンパイラが提案してくれる。
4546
4647
// Closures are anonymous, here we are binding them to references
4748
// Annotation is identical to function annotation but is optional
@@ -58,8 +59,10 @@ fn main() {
5859
println!("closure_annotated: {}", closure_annotated(1));
5960
println!("closure_inferred: {}", closure_inferred(1));
6061
// Once closure's type has been inferred, it cannot be inferred again with another type.
62+
// クロージャの型が一度推論されると、別の型にあらためて推論することはできない。
6163
//println!("cannot reuse closure_inferred with another type: {}", closure_inferred(42i64));
6264
// TODO: uncomment the line above and see the compiler error.
65+
// TODO: 上の行をアンコメントしてコンパイルエラーを見てみよう。
6366
6467
// A closure taking no arguments which returns an `i32`.
6568
// The return type is inferred.

0 commit comments

Comments
 (0)