On Wednesday, 31 August 2016 at 18:07:46 UTC, Cauterite wrote:
On Wednesday, 31 August 2016 at 16:17:51 UTC, Yuxuan Shui wrote:
No. When you use assumeUnique, you know something the compiler
does know, and have to use assumeUnique to tell the compiler
that (at least when you use it correctly). But when you use
assumeNogc, it's always because you want to bypass compiler
checks.
assumeNogc works the same way, you're telling the compiler
something it doesn't know — that the function should be treated
as @nogc. Using assumeNogc on a function that calls the GC is
as unsafe as using assumeUnique on a reference that is not
unique.
Correct me if I'm wrong. But I believe this is only true when the
source code of function is not available. Otherwise the compiler
should always know if a function is actually @nogc or not.