]> git.lizzy.rs Git - rust.git/commit
auto merge of #7244 : bblum/rust/once, r=nikomatsakis
authorbors <bors@rust-lang.org>
Sat, 29 Jun 2013 09:34:43 +0000 (02:34 -0700)
committerbors <bors@rust-lang.org>
Sat, 29 Jun 2013 09:34:43 +0000 (02:34 -0700)
commitc80e3bac3e676abb106f7ef8ac7da5b153c65c8e
treedc1a7abef3d983d7a13e9a94f987e63b2fb78e44
parenta229c980c8c8e628571008882bd7da71f2b3ef7a
parente0788c7f523dc13609179b8f40c09af5c8668df6
auto merge of #7244 : bblum/rust/once, r=nikomatsakis

@graydon suggested that once closures not be part of the language for 1.0, but that they might be hidden behind a -Z compile flag as an "experimental feature" in case people decide they need them.

Regardless of whether ```-Z once-fns``` is set, this PR will parse the ```once``` keyword and will prevent closures labelled with it from being called more than once. It will also permit moving out of captured vars in heap closures, just to let the runtime writers stop using ```Cell``` sooner. Setting ```-Z once-fns``` only toggles whether the move-out-from-capture privilege is also given for stack closures.

r? @nikomatsakis
src/librustc/driver/session.rs
src/librustc/middle/borrowck/gather_loans/gather_moves.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/moves.rs