Skip to content

enable play button only if play.rust-lang.org supports used crates. #396

Closed
@budziq

Description

@budziq

Hi,

rust-lang-nursery/rust-cookbook#87 Is a long standing bug in cookbook. We were forced to disabled the (awesome) play button due to its inconsistent behavior.

Firstly play.rust-lang.org did not support extern crate at all.
Now it supports the top 100 crates from crates.io which is a dynamic property.

Having the play button enabled by default is arguably not the best user experience (it's safe for std only snippets but its hit and miss with extern crate. To make it worse, the experience can degrade/upgrade dynamically day by day)

We can query the installed crate list https://play.rust-lang.org/meta/crates on each page load (if playpen snippets present) and selectively enable the button if playpen snippet:

  • is not marked no_run
  • does not use any crates or uses only the available crates

We should be able to get extern crate from snippets easily with some js regex;


Eventually the rust playground might start offering a curated crate list too rust-lang/rust-playground#168

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions