compiler-explorer / compiler-explorer/compiler-explorer

Change crate-type when linking to bin

Open
#4,910 6 comments 1 reaction 1 assignee Claimed by @OfekShilon View on GitHub
lang-rust request
Dominant language
TypeScript
Stars
19.1k
Forks
2.1k
Avg merge
3d 15h
Merged PRs (30d)
67

Description

When there is a `fn main()`, it would be better to use `--crate-type bin` instead of `--crate-type lib`. This would avoid having to make `main` explicitly public to stop the compiler from gc-ing it. That's what rust playground is doing (thanks @bjorn3 for the hint)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.