From: bors Date: Sat, 7 Feb 2015 04:14:22 +0000 (+0000) Subject: Auto merge of #21949 - japaric:index, r=nikomatsakis X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=0b6dbbc9cfb747df1db646bba16561c022704056;p=rust.git Auto merge of #21949 - japaric:index, r=nikomatsakis closes #21630 Overloaded indexing (`&[mut] foo[bar]`) only works when `::Output` is the same as `::Output` (see issue above). To restrict implementations of `IndexMut` that doesn't work, this PR makes `IndexMut` a supertrait over `Index`, i.e. `trait IndexMut: Index`, just like in the `trait DerefMut: Deref` case. This breaks all downstream implementations of `IndexMut`, in most cases this simply means removing the `type Output = ..` bit, which is now redundant, from `IndexMut` implementations: ``` diff impl Index for Bar { type Output = Baz; .. } impl IndexMut for Bar { - type Output = Baz; .. } ``` [breaking-change] --- r? @nikomatsakis --- 0b6dbbc9cfb747df1db646bba16561c022704056