-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename begin_unwind lang item and core function #16114
Comments
While we're renaming, we could rename I'd also vote for |
I can mentor. |
A patch implementing this will conflict with #16100 until it lands. |
I'm interested in taking a look at this (first time touching the codebase). I've spent a little time trying to understand how the |
@namanbharadwaj 'weak lang items' are lang items that the compiler may emit calls to, even if the required code has not yet been defined in any upstream crates. In the case of The way it does this is by relying on the linker to make the lang item's symbol available during the final application link step. What this means in practice is that calls to the Hope that helps. |
That helps a lot, thanks! I've made a bunch of changes to rename the lang item, but I've just realized that I'm going to run into bootstrapping issues, as the snapshot will be looking for the Seems like we will need some intermediate versions that know about both |
…r=alexcrichton This is a PR for #16114 and includes to following things: * Rename `begin_unwind` lang item to `fail_fmt` * Rename `core::failure::begin_unwind` to `fail_impl` * Rename `fail_` lang item to `fail`
…ykril fix: self type replacement in inline-function Fix rust-lang#16113, fix rust-lang#16091 The problem described in this issue actually involves three bugs. Firstly, when using `ted` to modify the syntax tree, the offset of nodes on the tree changes, which causes the syntax range information from `hir` to become invalid. Therefore, we need to edit the AST after the last usage for `usages_for_locals`. The second issue is that when inserting nodes, it's necessary to use `clone_subtree` for duplication because the `ted::replace` operation essentially moves a node. The third issue is that we should use `ancestors_with_macros` instead of `ancestors` to handle impl definition in macros. I have fixed the three bugs mentioned above and added unit tests.
The unwind code has had a long and storied life. Currently there are two naming conventions in use:
fail
andbegin_unwind
, the code for which is divided betweencore::failure
andrustrt::unwind
.In the
rustrt
case, the naming is accurate because the runtime provides unwinding, but core, which contains two functions namedbegin_unwind
, one of which is a lang item, provides no particular failure semantics, and ultimately the language definition will allow for different implementations of failure.The four 'core' failure functions are:
The
begin_unwind
lang item and the functioncore::failure::begin_unwind
should be renamed to be implementation-agnostic. Perhapsfail_fmt
andfail_impl
.The text was updated successfully, but these errors were encountered: