Closed
Description
This example:
fn main() {
let mut stdin = std::io::stdio::stdin();
spawn(proc() {
for line in stdin.lines() {
print!("{}", line);
}
});
}
Gives this warning:
<anon>:2:9: 2:18 warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
<anon>:2 let mut stdin = std::io::stdio::stdin();
^~~~~~~~~
However, removing the mut
is an error:
<anon>:4:21: 4:26 error: cannot borrow immutable captured outer variable in a proc `stdin` as mutable
<anon>:4 for line in stdin.lines() {
^~~~~
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
No labels