-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
[WIP] Implement RFC 1260 #51216
[WIP] Implement RFC 1260 #51216
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
@rust-lang/lang |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This does seem like it adds a lot of corner cases in the compiler. For example, we already have error codes for doing Similarly, the distinction of "imported main" vs. "regular fn main" could be removed. It seems to me that I disagree that this is a special case in the language itself, though. If we adopt the "the item named |
One of the annoying bits is that |
@jonas-schievink Good suggestion. I'll try to re-use existing code as much as possible. @eddyb I have stored the rust/src/librustc_typeck/lib.rs Lines 178 to 180 in 5d0631a
This function requires a if let Some(node_id) = tcx.hir.as_local_node_id(*def_id) {
check_main_fn_ty(tcx, node_id, *def_id, *sp);
} else {
span_bug!(*sp, "NodeId of `main` is not found");
} Then I encountered the problem: This is my first pull request in the rust compiler, and I must have made some mistakes somewhere due to lack of knowledge of rustc internal. |
@F001 You should go the other way around and change the current code to use |
@eddyb Thanks. I'll close this PR later, and split it into 2 PRs. But in order to refactor The main problem is that this function uses When I was trying to use In other words, I can't find a way to do the refactoring to use Finally, the question still exists. How can I get the foreign function's signature from |
You'll have to work with |
@eddyb Thanks for the information. I'll have a try later. This PR can be closed now. |
I agree that such "resolution-based" formulation (not even mentioning reexports) would be better.
|
This is my in-progress work to implement RFC 1260: main_reexport.
Tracking issue: #28937
There is a known problem that, I have no idea how to get the foreign function's signature if it is imported from another crate. Thus, the type check for this case is not done yet. I'd appreciate it if someone can provide some helps.