rust-lang / rust-lang/rust-playground

Automatically adding use imports should always go below inner attributes

Open
#688 3 comments 4 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

If in the playground you use a type that is not in scope, the compiler helpfully outputs some options to use:

Screen Shot 2021-03-09 at 8 36 07 AM

However, if you click on one of those (and you happen to be using some inner attributes such as #[no_std] or a #[feature(...)] then that use statement is still added before that attribute and the compiler complains about it the next time you build/run.

It would be great if the use statement was added after the attribute.

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 tracing how the playground handles compiler suggestions when an out-of-scope type is selected. Reproduce the issue with an inner attribute such as #[no_std] or #[feature(...)], then verify that the generated use statement is placed after the attribute and the playground builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.