rust/tests/ui/autoref-autoderef/autoderef-method-twice.rs
2023-01-11 09:32:08 +00:00

16 lines
283 B
Rust

// run-pass
#![allow(non_camel_case_types)]
trait double {
fn double(self: Box<Self>) -> usize;
}
impl double for usize {
fn double(self: Box<usize>) -> usize { *self * 2 }
}
pub fn main() {
let x: Box<Box<_>> = Box::new(Box::new(3));
assert_eq!(x.double(), 6);
}