]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/borrowck-overloaded-call.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(unboxed_closures)]
13 use std
::ops
::{Fn, FnMut, FnOnce}
;
20 impl Fn
<(isize,)> for SFn
{
23 extern "rust-call" fn call(&self, (z
,): (isize,)) -> isize {
33 impl FnMut
<(isize,)> for SFnMut
{
36 extern "rust-call" fn call_mut(&mut self, (z
,): (isize,)) -> isize {
45 impl FnOnce
<(String
,)> for SFnOnce
{
48 extern "rust-call" fn call_once(self, (z
,): (String
,)) -> usize {
49 self.x
.len() + z
.len()
59 s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
60 //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
68 s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable
73 x
: "hello".to_string(),
75 s(" world".to_string());
76 s(" world".to_string()); //~ ERROR use of moved value: `s`