refactor(turbo-tasks): Tighten up id factory overflow checks, tweak API to make construction easier (#78486)
- Prefer construction of `IdFactory<T>` with value of type `T` instead of `u64`, except in cases where we can't because of limitations with `const`.
- Always start the internal counter at 0 so that our assumptions of overflowing a `u64` type hold. A test is included for this.
- Add an extra debug assertion (and abort) in the bizarre case that a `u64` does overflow.
- Remove unused type bounds from `register_thing` and `get_thing_id`.
- Avoid `as` casts as much as possible (these have silent overflow behavior).
I did this prior to https://github.com/vercel/next.js/pull/78487 because I add an intentionally-overflowing id factory method there.