Rename the poorly named Managed<T> type to Mut<T>.

The Mut<T> type is intended to allow freezable data stuctures to be stored in
`@mut` boxes. Currently this causes borrowck to be very conserivative since it
cannot prove that you are not modifying such a structure while iterating over
it, for example.  But if you do `@Mut<T>` instead of `@mut T`, you will
effectively convert borrowck's static checks into dynamic ones.  This lets
you use the e.g. send_map just like a Java Map or something else.
This commit is contained in:
Niko Matsakis 2012-09-10 16:34:31 -07:00
parent 2026359518
commit 29003c799f
4 changed files with 31 additions and 23 deletions

View file

@ -6,7 +6,7 @@
use std;
use std::map;
use managed::Managed;
use mutable::Mut;
use send_map::linear::*;
use io::WriterUtil;
@ -166,11 +166,11 @@ fn main(args: ~[~str]) {
{
let rng = rand::seeded_rng(copy seed);
let mut results = empty_results();
int_benchmarks::<Managed<LinearMap<uint, uint>>>(
|| Managed(LinearMap()),
int_benchmarks::<@Mut<LinearMap<uint, uint>>>(
|| @Mut(LinearMap()),
rng, num_keys, &mut results);
str_benchmarks::<Managed<LinearMap<~str, uint>>>(
|| Managed(LinearMap()),
str_benchmarks::<@Mut<LinearMap<~str, uint>>>(
|| @Mut(LinearMap()),
rng, num_keys, &mut results);
write_results("libstd::map::hashmap", &results);
}