Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
December 13, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 Jack Stouffer <jack@jackstouffer.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jack@jackstouffer.com --- Comment #1 from Jack Stouffer <jack@jackstouffer.com> --- The first example can be fixed by having `byValue.front` and `byValue.popFront` do this at the beginning of the function: if (this.empty) assert(0, "accessing front on an empty byValue"); -- |
December 13, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy@yahoo.com --- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> --- (In reply to Jack Stouffer from comment #1) > The first example can be fixed by having `byValue.front` and `byValue.popFront` do this at the beginning of the function: > > if (this.empty) > assert(0, "accessing front on an empty byValue"); This will have the same effect, as druntime is compiled in release mode. Note that the first example isn't actually unsafe. It's simply dereferencing a null pointer (which is fine in @safe code). I have a PR in progress to fix the second problem. I'm not loving how it's working out, but I am not sure exactly how to do it in a correct way (will post something about it on the newsgroup). -- |
December 13, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 --- Comment #3 from Jack Stouffer <jack@jackstouffer.com> --- (In reply to Steven Schveighoffer from comment #2) > (In reply to Jack Stouffer from comment #1) > > The first example can be fixed by having `byValue.front` and `byValue.popFront` do this at the beginning of the function: > > > > if (this.empty) > > assert(0, "accessing front on an empty byValue"); > > This will have the same effect, as druntime is compiled in release mode. assert(0) isn't removed in release mode -- |
December 13, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 --- Comment #4 from Steven Schveighoffer <schveiguy@yahoo.com> --- (In reply to Jack Stouffer from comment #3) > assert(0) isn't removed in release mode Right, but it's implemented as a segfault, not throwing an AssertError with a nice message. -- |
December 14, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 --- Comment #5 from github-bugzilla@puremagic.com --- Commit pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/13f4ab2f912c6050808558cdd3bab750e20b32e3 Make sure we extract the AA from an alias this'd type for getting AA ranges. Fixes Issue 18071 -- |
December 14, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 github-bugzilla@puremagic.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED -- |
December 18, 2017 [Issue 18071] [REG2.078] byKey, byValue and byKeyValue are now a hole for unsafe code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18071 --- Comment #6 from github-bugzilla@puremagic.com --- Commit pushed to stable at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/13f4ab2f912c6050808558cdd3bab750e20b32e3 Make sure we extract the AA from an alias this'd type for getting AA -- |
Copyright © 1999-2021 by the D Language Foundation