Hi, guys I have been in touch with Rust for some time. When I wrote the rust code, I used a lot of unsafe syntax as in the source code. What is the future of these unsafe syntax? Will it exist forever? If It will be replaced, how soon will it be completely removed.
There are no plans to remove unsafe
-- it's necessary for some constructs. Even if you imagine some magic language features that make unsafe
unnecessary for internal Rust code, FFI will always be unsafe.
That said, it shouldn't be that common for you to reach for unsafe
. Hopefully you can at least encapsulate your really tricky code, so the rest is safe. Could share some examples where you frequently need unsafe
? Perhaps we can help transform them to safe constructs.
Rust is stable since Version 1.0, that means everything since that version will be available in all followup versions (there are some exceptions, e.g. unsoundness or due to bugs of course), but nor removal of deprecated items. They may get deprecated, but not removed.
Also why would you remove such a feature? It is sometimes needed, although in very rare cases only.
What exactly do you mean by unsafe syntax?
Are you talking about the unsafe
keyword? If yes, be sure, this won't be removed, but you really shouldn't need it very often unless you are doing FFI or otherwise really low level stuff.
If though you are talking about language features only available through a feature gate in nightlies, as they are unstable and therefore "unsafe" for production use, well, those may change with every new release and sometimes things break due to this when updating to a newer nightly.