remove support for the (unstable) #[start] attribute#134299
remove support for the (unstable) #[start] attribute#134299bors merged 1 commit intorust-lang:masterfrom
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
There was a problem hiding this comment.
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. |
|
@bors r=compiler-errors |
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
|
@bors try |
|
A job failed! Check out the build log: (web) (plain) Click to see the possible cause of the failure (guessed by this bot) |
|
@rust-lang/infra I got "The job x86_64-msvc failed!" but now that same job name does not work in a try build...? |
|
@RalfJung you want |
|
Ah I guess I managed to race with #135632. There is -1 and -2 and I don't know which one got the test that failed before so I guess I should add both. |
|
@bors try |
|
☀️ Try build successful - checks-actions |
|
@bors r=compiler-errors |
|
📣 Toolstate changed by #134299! Tested on commit ed43cbc. 💔 nomicon on windows: test-pass → test-fail (cc @Gankra @JohnTitor @frewsxcv). |
|
☀️ Test successful - checks-actions |
|
Finished benchmarking commit (ed43cbc): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 1.0%, secondary 4.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 3.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 764.328s -> 765.516s (0.16%) |
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_startinstdtomain- but that's just an implementation detail)no_stdplatform-specific programs should use#![no_main]and define their own platform-specific entrypoint symbol with#[no_mangle], likemain,_start,WinMainormy_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_herecan'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
try-job: x86_64-gnu-nopt
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: test-various