ͳ͍ ▶ > Because each closure generates its own environment struct and implementation of Fn and friends, these types are anonymous. They exist solely for this closure. So Rust shows them as closure@<anon>, rather than some autogenerated name. ▶ ΫϩʔδϟΛฦ͍ͨ͠߹Ͳ͏ͨ͠Β͍͍͔͔Βͣ... 10 / 22
’static: std::marker::Sized‘ is not satisfied --> account1.rs:6:20 | 6 | fn id_i32() -> Fn(i32) -> i32{ | ^^^^^^^^^^^^^^ | the trait ‘std::marker::Sized‘ is not implemented for | ‘std::ops::Fn(i32) -> i32 + ’static‘ | = note: ‘std::ops::Fn(i32) -> i32 + ’static‘ does not have a constant size known at compile-time = note: the return type of a function must have a statically known size ▶ Fn(i32) -> i32 trait ͳͷͰɺෳͷܕͷީิ͕͋Γɺ ܕͷαΠζ͕͔Βͳ͍ ▶ ฦΓͷܕͷαΠζίϯύΠϧ࣌ʹ͔͍ͬͯΔඞཁ͕͋ ΔͨΊɺౖΒΕ͍ͯΔ 11 / 22
it borrows ‘acc‘, which is owned by the current function --> account1.rs:16:18 | 16 | Box::new(|x: i32| { | ^^^^^^^^ may outlive borrowed value ‘acc‘ 17 | acc += x; | --- ‘acc‘ is borrowed here | ▶ ΦΞΞΞΞΞΞΞ 14 / 22