-
Notifications
You must be signed in to change notification settings - Fork 0
Rust Geek Section
This section contains articles about hacky rust stuff I did where I am sometimes not even sure if it is completely safe.
If you want, you can look through the pages and either comment why or why not something is safe. I would really appreciate it :D
Scope lifetimes are invariant. However, they are not connected to the moment they get dropped, so a value of type T: 'a
could potentially be dropped after the lifetime of 'a
, if it doesn't correspond. Like if 'a
is completely local, I don't think this is a problem, because every thing that is referenced would also get dropped, but if you e.g. make a mutex and somehow snuggle the guard into a longer living scope (that shouldn't even be possible, but I somehow have it in my brain) and then the mutex gets dropped and afterwards the guard, it could write to invalid memory.
It seems like that couldn't be possible, because sub-scopes can only be smaller, but who knows..