1 // Copyright 2014 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 // Check that a trait is still object-safe (and usable) if it has
12 // methods with by-value self so long as they require `Self : Sized`.
14 // pretty-expanded FIXME #23616
17 fn tick(&mut self) -> u32;
18 fn get(self) -> u32 where Self : Sized;
25 impl Counter for CCounter {
26 fn tick(&mut self) -> u32 { self.c += 1; self.c }
27 fn get(self) -> u32 where Self : Sized { self.c }
30 fn tick1<C:Counter>(mut c: C) -> u32 {
35 fn tick2(c: &mut Counter) {
39 fn tick3<C:?Sized+Counter>(c: &mut C) {
45 let mut c = CCounter { c: 0 };