-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Description
Not sure if this is a bug or by design, but it certainly seemed odd so I wanted to note it.
Consider the following file, t.rs
:
fn f1() {
spawn(proc() println("Variant 1, adapted from tutorial-tasks.md"));
}
#[cfg(lifted_typed)]
fn f2() {
let p : proc() = proc() println("Variant 2, lift out expression");
spawn(p);
}
#[cfg(lifted_inferred)]
fn f2() {
let p = proc() println("Variant 2, lift out expression");
spawn(p);
}
fn main() { f1(); f2(); }
When I compile the explicitly typed variant (cfg(lifted_typed)
), it compiles and runs; but compiling the type inferred variant fails:
% rustc --cfg lifted_typed /tmp/t.rs && /tmp/t
Variant 2, lift out expression
Variant 1, adapted from tutorial-tasks.md
% rustc --cfg lifted_inferred /tmp/t.rs && /tmp/t
/tmp/t.rs:14:10: 14:11 error: mismatched types: expected `proc:Send()` but found `~fn()` (expected bounds `Send` but found no bounds)
/tmp/t.rs:14 spawn(p);
^
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
No labels