rust-playground
rust-playground copied to clipboard
Automatically adding use imports should always go below inner attributes
If in the playground you use a type that is not in scope, the compiler helpfully outputs some options to use:
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.
I agree! There are two paths I forsee:
- Quicker/hackier: Add some more regex logic.
- Better/harder: Switch to using
rustc
's JSON diagnostics which should provide locations to add the suggestion.
Didn't know that rustc
had a JSON diagnostics mode. Cool (I edited the title to be what I think is what we want).