Skip to content

Remove capture clause use #4995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn encode_side_tables_for_ii(ecx: @e::encode_ctxt,
let ebml_w = copy ebml_w;
ast_util::visit_ids_for_inlined_item(
ii,
fn@(id: ast::node_id, copy ebml_w) {
fn@(id: ast::node_id) {
// Note: this will cause a copy of ebml_w, which is bad as
// it has mut fields. But I believe it's harmless since
// we generate balanced EBML.
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/text_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn apply_to_sections(
op: NominalOp<Op>,
sections: ~[doc::Section]
) -> ~[doc::Section] {
sections.map(|section, copy op| doc::Section {
sections.map(|section| doc::Section {
header: (op.op)(copy section.header),
body: (op.op)(copy section.body)
})
Expand All @@ -89,7 +89,7 @@ fn fold_enum(
let fold_copy = copy *fold;

doc::EnumDoc {
variants: do doc.variants.map |variant, copy fold_copy| {
variants: do doc.variants.map |variant| {
doc::VariantDoc {
desc: maybe_apply_op(copy fold_copy.ctxt, &variant.desc),
.. copy *variant
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/tystr_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn fold_enum(
variants: do vec::map(doc.variants) |variant| {
let sig = {
let variant = copy *variant;
do astsrv::exec(srv.clone()) |copy variant, ctxt| {
do astsrv::exec(srv.clone()) |ctxt| {
match ctxt.ast_map.get(&doc_id) {
ast_map::node_item(@ast::item {
node: ast::item_enum(ref enum_definition, _), _
Expand Down Expand Up @@ -198,7 +198,7 @@ fn get_method_sig(
item_id: doc::AstId,
method_name: ~str
) -> Option<~str> {
do astsrv::exec(srv) |copy method_name, ctxt| {
do astsrv::exec(srv) |ctxt| {
match ctxt.ast_map.get(&item_id) {
ast_map::node_item(@ast::item {
node: ast::item_trait(_, _, ref methods), _
Expand Down
2 changes: 1 addition & 1 deletion src/librusti/rusti.rc
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ fn run_line(repl: &mut Repl, in: io::Reader, out: io::Writer, line: ~str)
}

let r = *repl;
let result = do task::try |copy r| {
let result = do task::try {
run(r, line)
};

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub mod test {
#[test]
pub fn test_sendable_future() {
let expected = ~"schlorf";
let f = do spawn |copy expected| { copy expected };
let f = do spawn { copy expected };
do task::spawn || {
let actual = f.get();
assert actual == expected;
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/par.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn mapi<A: Copy Owned, B: Copy Owned>(
{
let slices = map_slices(xs, || {
let f = fn_factory();
fn~(base: uint, slice : &[A], copy f) -> ~[B] {
fn~(base: uint, slice : &[A]) -> ~[B] {
vec::mapi(slice, |i, x| {
f(i + base, x)
})
Expand All @@ -126,7 +126,7 @@ pub fn alli<A: Copy Owned>(
{
do vec::all(map_slices(xs, || {
let f = fn_factory();
fn~(base: uint, slice : &[A], copy f) -> bool {
fn~(base: uint, slice : &[A]) -> bool {
vec::alli(slice, |i, x| {
f(i + base, x)
})
Expand All @@ -140,7 +140,7 @@ pub fn any<A: Copy Owned>(
fn_factory: &fn() -> ~fn(&A) -> bool) -> bool {
do vec::any(map_slices(xs, || {
let f = fn_factory();
fn~(_base : uint, slice: &[A], copy f) -> bool {
fn~(_base : uint, slice: &[A]) -> bool {
vec::any(slice, |x| f(x))
}
})) |x| { *x }
Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/cci_capture_clause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use core::pipes::*;

pub fn foo<T: Owned Copy>(x: T) -> Port<T> {
let (p, c) = stream();
do task::spawn() |copy x| {
do task::spawn() {
c.send(x);
}
p
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/kindck-nonsendable-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ fn foo(_x: @uint) {}
fn main() {
let x = @3u;
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
let _ = fn~(copy x) { foo(x); }; //~ ERROR value has non-owned type `@uint`
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
let _ = fn~() { foo(x); }; //~ ERROR value has non-owned type `@uint`
}
2 changes: 1 addition & 1 deletion src/test/run-pass/capture_nil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use core::pipes::*;

fn foo(&&x: ()) -> Port<()> {
let (p, c) = stream::<()>();
do task::spawn() |copy x| {
do task::spawn() {
c.send(x);
}
p
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-3609.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ enum Msg

fn foo(name: ~str, samples_chan: Chan<Msg>) {
do task::spawn
|copy name|
{
let callback: SamplesFn =
|buffer|
Expand Down