In the site documentation of std.exception.assumeUnique there is code like: string letters() { char[] result = new char['z' - 'a' + 1]; foreach (i, ref e; result) { e = 'a' + i; } return assumeUnique(result); } But recent improvements of the D language make assumeUnique useless in this case, this compiles: string lowercase() pure nothrow { auto result = new char['z' - 'a' + 1]; foreach (i, ref c; result) c = cast(char)('a' + i); return result; } void main() {} On the other hand currently (DMD 2.056head) 'a'+i can't be assigned to a char because the compiler doesn't see that the variable 'i' will never become too much big. So in the documentation of std.exception.assumeUnique I suggest to explain that some usages (where the function is pure) of assumeUnique are not needed now.
https://github.com/D-Programming-Language/phobos/pull/2109
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/20d91e6f3ff955601f9ab6e41f483771e1880f68 Fix Issue 6793 - Document that assumeUnique may not be necessary in some contexts. https://github.com/D-Programming-Language/phobos/commit/3accfde6c8f5bb458aca9af21bf2c05177c30724 Merge pull request #2109 from AndrejMitrovic/Fix6793 Issue 6793 - Document that assumeUnique may not be necessary in some contexts.