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

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

Open
jyn514 opened this issue Nov 18, 2020 · 2 comments
Open

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

jyn514 opened this issue Nov 18, 2020 · 2 comments
Labels
enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions!

Comments

@jyn514
Copy link
Member

jyn514 commented Nov 18, 2020

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!!

@jyn514 jyn514 changed the title Cannot use #[lang = "main"] on playground Cannot use #[lang = "start"] on playground Nov 18, 2020
@jyn514
Copy link
Member Author

jyn514 commented Nov 18, 2020

Same for lang items in core:

error[E0152]: found duplicate lang item `sized`
  --> src/lib.rs:14:1
   |
14 | trait X {}
   | ^^^^^^^^^^
   |
   = note: the lang item is first defined in crate `core` (which `std` depends on)
   = note: first definition in `core` loaded from /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2675a9a46b5cec89.rlib
   = note: second definition in the local crate (`playground`)

@shepmaster
Copy link
Member

This is probably due to fact that playground has hundreds of crates that are always available and at least one of those crates links to the standard library.

I’ve seen similar errors outside the playground when trying to do no-std work but something accidentally brought in std.

@shepmaster shepmaster added enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions! labels Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something new the playground could do help wanted Not immediately going to be prioritized — ask for mentoring instructions!
Projects
None yet
Development

No branches or pull requests

2 participants