rust-lang / rust-lang/rust-playground

Building a project assumes library crate type

Open
#472 1 comment 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

Let's consider this example

fn foo() {
    println!("foo");
}

fn main() {
    foo();
}

Normally the playground suggests you to "run" the project. If you just want to check it without actually running it, you can use the "build" command in the burger menu next to "run".
But then the playground/compiler assumes that the crate type is a library and annotates the dead code (not exported, therefore dead).

I would suggest to investigate if there is a function main and change the crate type accordingly.

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 with the playground's burger-menu build command and trace how it selects the crate type before invoking the compiler. Check the behavior with the provided example containing main; done means build selects the appropriate crate type and no longer reports foo as dead code solely because it is not exported.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.