You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simply declaring extern items, even without ever using them, can cause Undefined Behavior. When performing cross-language compilation, attributes on one function declaration can flow to the foreign declaration elsewhere within LLVM and cause a miscompilation. In Rust we consider all sources of Undefined Behavior to be unsafe, and so we must make declaring extern blocks be unsafe. The up-side to this change is that in the new style it will be possible to declare an extern fn that's safe to call after the initial unsafe declaration.
In Edition 2024 it is unsafe to declare an extern function or static, but external functions and statics can be safe to use after the initial declaration.
This issue corresponds to a lang-team design meeting proposal. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings.
The text was updated successfully, but these errors were encountered:
Summary
Simply declaring extern items, even without ever using them, can cause Undefined Behavior. When performing cross-language compilation, attributes on one function declaration can flow to the foreign declaration elsewhere within LLVM and cause a miscompilation. In Rust we consider all sources of Undefined Behavior to be unsafe, and so we must make declaring extern blocks be unsafe. The up-side to this change is that in the new style it will be possible to declare an extern fn that's safe to call after the initial unsafe declaration.
In Edition 2024 it is unsafe to declare an extern function or static, but external functions and statics can be safe to use after the initial declaration.
Background reading
rust-lang/rfcs#3484
About this issue
This issue corresponds to a lang-team design meeting proposal. It corresponds to a possible topic of discussion that may be scheduled for deeper discussion during one of our design meetings.
The text was updated successfully, but these errors were encountered: