std.path: make .ptr access trusted#4646
Conversation
std/path.d
Outdated
| * pattern[pi0..pi-1] ~ pattern[piRemain..$] | ||
| */ | ||
| if (pattmp.ptr == null) | ||
| if (() @trusted { return pattmp.ptr; }() == null) |
There was a problem hiding this comment.
This is easy to write safely as pattmp is null. What am I missing?
There was a problem hiding this comment.
array.ptr is simply rejected by the safety check in the compiler.
There was a problem hiding this comment.
There is no .ptr in pattmp is null
There was a problem hiding this comment.
The trouble being that ==null can appear in arbitrarily complex forms.
There was a problem hiding this comment.
There is no == in pattmp is null
There was a problem hiding this comment.
oh I see what you mean. The compiler generates some rather stupid code for array is null. Should be a topic for another issue.
There was a problem hiding this comment.
Let's use this as a forcing function for that. e1 is e2 should be @safe for any two slice expressions e1 and e2.
There was a problem hiding this comment.
I remember some argument a while back on what array == null should be. Don't remember the details.
There was a problem hiding this comment.
If you don't remember the details it doesn't count. e is null is @safe for any slice expression e.
341d607 to
87e8c5e
Compare
std/path.d
Outdated
| * pattern[pi0..pi-1] ~ pattern[piRemain..$] | ||
| */ | ||
| if (pattmp.ptr == null) | ||
| if (pattmp == null) |
There was a problem hiding this comment.
is is better but I'll choose my battles
87e8c5e to
6c37949
Compare
blocker for dlang/dmd#5860