Skip to content
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

Tracking issue for Allow a re-export for main (RFC 1260) #28937

Closed
5 tasks done
aturon opened this issue Oct 9, 2015 · 15 comments
Closed
5 tasks done

Tracking issue for Allow a re-export for main (RFC 1260) #28937

aturon opened this issue Oct 9, 2015 · 15 comments
Labels
A-codegen Area: Code generation A-resolve Area: Name resolution B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. B-RFC-implemented Blocker: Approved by a merged RFC and implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@aturon
Copy link
Member

aturon commented Oct 9, 2015

RFC Thread:
rust-lang/rfcs#1260

Feature name:
imported_main

Steps / History

@aturon aturon added A-resolve Area: Name resolution B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. labels Oct 9, 2015
@steveklabnik
Copy link
Member

Triage: no change.

@bombless
Copy link
Contributor

bombless commented Dec 10, 2016

bombless@3d891e7
The patch should be pretty small so I wonder if we need a feature-gate for it.

@brson brson added the E-help-wanted Call for participation: Help is requested to fix this issue. label Mar 1, 2017
@Mark-Simulacrum Mark-Simulacrum added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jul 24, 2017
@petrochenkov
Copy link
Contributor

This RFC was implemented in #84401.

bors added a commit to rust-lang-ci/rust that referenced this issue Apr 30, 2021
…enkov

Implement RFC 1260 with feature_name `imported_main`.

This is the second extraction part of rust-lang#84062 plus additional adjustments.
This (mostly) implements RFC 1260.

However there's still one test case failure in the extern crate case. Maybe `LocalDefId` doesn't work here? I'm not sure.

cc rust-lang#28937
r? `@petrochenkov`
@crlf0710
Copy link
Member

#84401 has landed. Want to say thank you to @petrochenkov for your patient mentoring!

There's a small piece of codegen changes to support foreign crate imported main fn case. The PR is now up at #84507 .

flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue May 6, 2021
Implement RFC 1260 with feature_name `imported_main`.

This is the second extraction part of #84062 plus additional adjustments.
This (mostly) implements RFC 1260.

However there's still one test case failure in the extern crate case. Maybe `LocalDefId` doesn't work here? I'm not sure.

cc rust-lang/rust#28937
r? `@petrochenkov`
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 9, 2021
…per, r=nagisa

Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from rust-lang#84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc rust-lang#28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`
bors added a commit to rust-lang-ci/rust that referenced this issue May 10, 2021
…r, r=nagisa

Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from rust-lang#84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc rust-lang#28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`
@crlf0710
Copy link
Member

#84507 has landed and this rfc is now fully implemented.

@crlf0710 crlf0710 added B-RFC-implemented Blocker: Approved by a merged RFC and implemented. A-codegen Area: Code generation and removed E-help-wanted Call for participation: Help is requested to fix this issue. labels May 10, 2021
@joshtriplett
Copy link
Member

@crlf0710 What's the current state of this? Are people using it successfully? Is it a potential candidate for stabilization?

@joshtriplett joshtriplett added the S-tracking-needs-summary Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation. label Feb 12, 2022
@crlf0710
Copy link
Member

@joshtriplett It's fully implemented, and the tests pass. There're no known technical limitations, but I'm not aware whether there're people using it today in nightly builds. I think it's a potential candidate for stablization.

@pnkfelix
Copy link
Member

pnkfelix commented Mar 4, 2022

Discussed at today's T-compiler backlog bonanza.

@rustbot label +T-lang +I-lang-nominated

Its not clear from discussion whether its appropriate to shift this to S-tracking-ready-to-stabilize, or if it is S-tracking-needs-to-bake

@rustbot rustbot added I-lang-nominated Nominated for discussion during a lang team meeting. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Mar 4, 2022
@joshtriplett joshtriplett removed the I-lang-nominated Nominated for discussion during a lang team meeting. label Mar 15, 2022
@joshtriplett joshtriplett added S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR and removed S-tracking-needs-summary Status: It's hard to tell what's been done and what hasn't! Someone should do some investigation. labels Mar 15, 2022
@clubby789
Copy link
Contributor

I think this should be stabilized.

Stabilization Report

Summary

The imported_main feature allows a function to be re-exported as main. This allows, for example, re-exporting a function from a library and using it as the entrypoint.

pub mod foo {
    pub fn bar() {
        println!("Hello, world!");
    }
}
use foo::bar as main;

Tests/Edge Cases

The feature is tested in tests/ui/entry-point:
- Exporting from a module in the current crate
- Exporting from an extern crate
- Incorrectly typed functions are not allowed
- Conflicting mains are not allowed

Documentation PRs

@joshtriplett
Copy link
Member

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Feb 11, 2024

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Feb 11, 2024
@joshtriplett joshtriplett added the relnotes Marks issues that should be documented in the release notes of the next release. label Feb 11, 2024
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Mar 5, 2024
@rfcbot
Copy link

rfcbot commented Mar 5, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Mar 5, 2024
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Mar 15, 2024
@rfcbot
Copy link

rfcbot commented Mar 15, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 18, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 18, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 18, 2024
Rollup merge of rust-lang#122060 - clubby789:stabilize-imported-main, r=lcnr

Stabilize `imported_main`

FCP: rust-lang#28937 (comment)
Docs: rust-lang/reference#1461
@slanterns
Copy link
Contributor

I guess we can close it now?

github-actions bot pushed a commit to rust-lang/miri that referenced this issue Mar 19, 2024
@crlf0710
Copy link
Member

Closed by #122060

@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-resolve Area: Name resolution B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. B-RFC-implemented Blocker: Approved by a merged RFC and implemented. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-tracking-ready-to-stabilize Status: This is ready to stabilize; it may need a stabilization report and a PR T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests