-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
remove support for the (unstable) #[start] attribute #134299
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @compiler-errors. Use |
This comment has been minimized.
This comment has been minimized.
6d6693a
to
fb2794a
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
fb2794a
to
f458c1e
Compare
This comment has been minimized.
This comment has been minimized.
f458c1e
to
f14e0f9
Compare
This comment has been minimized.
This comment has been minimized.
f14e0f9
to
b6b5bba
Compare
Given that we have several tests that inspect these arguments and that apparently pass on Windows, this cannot be entirely true. |
This comment has been minimized.
This comment has been minimized.
There is a difference here between |
The start stuff is very confusing, it's possible I got that wrong yeah. Removing |
Where is this implemented? |
rust/compiler/rustc_codegen_ssa/src/base.rs Line 534 in ed14192
|
b6b5bba
to
0956662
Compare
tests/codegen/mainsubprogramstart.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have codegen/mainsubprogram.rs which tests that this works for regular binaries.
That function acts depending on
|
Huh, you're right. I'm 99% sure we used to but maybe that was a long time ago. |
Temporarily shuffling labels around in order to run an FCP. |
This is unstable, and TTBOMK isn't part of any accepted RFC. I'm sad to see it go, but I agree that in its current form it may not make sense to support. I'd love to see a design proposal for a portable version, but the current 👍 for removing it. |
@rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
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. |
@rfcbot concern check-with-embedded-folks I would like to get some indication from folks who know the embedded community well to make sure this isn't something widely used. Even though it's a nightly feature, I know that some embedded development does use nightly, and I'd like to get some kind of affirmative indication from at least one person who knows the embedded community well to confirm that this isn't one of the mechanisms used. To the best of my knowledge, it's more common to use things like a ping @jamesmunns @BartMassey? |
Marking this as I-lang-easy-decision, conditional on hearing back from embedded folks that this isn't widely used. Assuming that's the case, this is a nightly feature, and removing it shouldn't be too controversial. |
Pinged in chat, we just started our two week break for regular meetings, I'll ping back here if I hear any objections. |
Not speaking for the whole embedded community but this is the first time I read about #[start] - have never ever seen it in any embedded software in rust. |
I filed a bunch of issues pointing here, so if any of these uses is critical, people will hopefully show up and tell us about it. |
@rfcbot reviewed |
1 similar comment
@rfcbot reviewed |
As explained by @Noratrieb:
#[start]
should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction.I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple:
std
-using cross-platform programs should usefn main()
. the compiler, together withstd
, will then ensure that code ends up atmain
(by having a platform-specific entrypoint that gets directed throughlang_start
instd
tomain
- but that's just an implementation detail)no_std
platform-specific programs should use#![no_main]
and define their own platform-specific entrypoint symbol with#[no_mangle]
, likemain
,_start
,WinMain
ormy_embedded_platform_wants_to_start_here
. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things anyways#[start]
is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero onWindowswasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported bystd
, like Windows or Unix-likes.my_embedded_platform_wants_to_start_here
can't use it, and neither could a libc-less Linux program.So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving any stability guarantees on), and where there's a pretty easy way to get things working without it in the first place.
Note that this feature has not been RFCed in the first place.
This comment was posted in May and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.
Closes #29633