rust-lang / rust-lang/rust-playground

Cannot use `#[lang = "start"]` on playground

Open
#652 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
1.4k
Forks
267
Avg merge
3h 2m
Merged PRs (30d)
6

Description

I am shocked - shocked! - to find that no one has tried this before. https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=08a07ced4b7ba6afcdf8a4bd68487015

error[E0152]: found duplicate lang item `start`
 --> src/lib.rs:7:1
  |
7 | fn _start() {
  | ^^^^^^^^^^^
  |
  = note: the lang item is first defined in crate `std`.
  = note: first definition in `std` loaded from /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7edd956e9d8d05ea.rlib
  = note: second definition in the local crate (`playground`)

I expect you're passing --extern std=/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7edd956e9d8d05ea.rlib or something like that. I don't have suggestions for fixing it, this is just to vex you that sysroots are painful. Others must share my pain!!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example from the linked Rust Playground URL and inspect the compilation invocation, particularly whether std is passed through --extern. Trace how playground builds nightly programs using #[lang = "start"]. Done means the example no longer reports a duplicate lang item while normal playground compilation continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.