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 // This code used to produce the following ICE:
13 // error: internal compiler error: get_unique_type_id_of_type() -
14 // unexpected type: closure,
15 // ty_unboxed_closure(syntax::ast::DefId{krate: 0u32, node: 66u32},
18 // This is a regression test for issue #17021.
22 #![feature(unboxed_closures)]
26 pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T {
27 unsafe { *src = prod(ptr::read(src as *mut T as *const T)); }
33 replace_map(b, |: x: uint| x * 2);