2012-08-15 18:46:55 -07:00
|
|
|
struct box_impl<T> {
|
2012-04-06 08:16:20 -07:00
|
|
|
let mut f: T;
|
|
|
|
|
|
|
|
new(f: T) {
|
|
|
|
self.f = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_box_impl<T>(b: box_impl<@const T>, v: @const T) {
|
|
|
|
b.f = v;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let b = box_impl::<@int>(@3);
|
|
|
|
set_box_impl(b, @mut 5);
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ ERROR values differ in mutability
|
2012-04-06 08:16:20 -07:00
|
|
|
|
|
|
|
// No error when type of parameter actually IS @const int
|
|
|
|
let b = box_impl::<@const int>(@3);
|
|
|
|
set_box_impl(b, @mut 5);
|
|
|
|
}
|