@@ -36,8 +36,8 @@ language, coercions included things like auto-borrowing (taking `T` to `&T`),
3636auto-slicing (taking ` Vec<T> ` to ` &[T] ` ) and "cross-borrowing" (taking ` Box<T> `
3737to ` &T ` ). As built-in types migrated to the library, these coercions have
3838disappeared: none of them apply today. That means that you have to write code
39- like ` &**v ` to convert ` Rc<Box <T>> ` to ` &T ` and ` v.as_slice() ` to convert
40- ` Vec<T> ` to ` &T ` .
39+ like ` &**v ` to convert ` &Box<T> ` or ` Rc<RefCell <T>> ` to ` &T ` and ` v.as_slice() `
40+ to convert ` Vec<T> ` to ` &T ` .
4141
4242The ergonomic regression was coupled with a promise that we'd improve things in
4343a more general way later on.
@@ -176,15 +176,24 @@ Under this coercion design, we'd see the following ergonomic improvements for
176176
177177``` rust
178178fn use_ref (t : & T ) { ... }
179+ fn use_mut (t : & mut T ) { ... }
179180
180181fn use_rc (t : Rc <T >) {
181182 use_ref (& * t ); // what you have to write today
182183 use_ref (& t ); // what you'd be able to write
183184}
184185
185- fn use_nested (t : Rc <Box <T >>) {
186+ fn use_mut (t : & mut Box <T >) {
187+ use_mut (& mut * t ); // what you have to write today
188+ use_mut (t ); // what you'd be able to write
189+
190+ use_ref (* t ); // what you have to write today
191+ use_ref (t ); // what you'd be able to write
192+ }
193+
194+ fn use_nested (t : & Box <T >) {
186195 use_ref (& * * t ); // what you have to write today
187- use_ref (& t ); // what you'd be able to write (note: recursive deref)
196+ use_ref (t ); // what you'd be able to write (note: recursive deref)
188197}
189198```
190199
0 commit comments