-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Recover import
instead of use
in item
#97819
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with or without feedback implemented
ea2ed8c
to
0252e00
Compare
0252e00
to
b7ed860
Compare
@bors r=wesleywiser rollup |
📌 Commit b7ed860 has been approved by |
Now what about dots instead of |
That would be a separate and more complicated recovery than what we currently have. Feel free to file an issue or take a stab if you're interested. |
…ywiser Recover `import` instead of `use` in item When we definitely don't have a macro invocation (i.e. when we don't have `import ::`), then it's more productive to parse `import` as if it was incorrectly mistaken for `use`. Not sure if this needs to be a verbose suggestion, but it renders strangely when it's not verbose: ``` error: expected item, found `import` --> /home/michael/test.rs:1:1 | 1 | import std::{io::{self, Write}, rc::Rc}; | ^^^^^^ help: items are imported using the `use` keyword: `use` ``` Happy to change it to `span_suggestion` instead of `span_suggestion_verbose` though. Fixes rust-lang#97788
Rollup of 5 pull requests Successful merges: - rust-lang#97595 (Remove unwrap from get_vtable) - rust-lang#97597 (Preserve unused pointer to address casts) - rust-lang#97819 (Recover `import` instead of `use` in item) - rust-lang#97823 (Recover missing comma after match arm) - rust-lang#97851 (Use repr(C) when depending on struct layout in ptr tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
When we definitely don't have a macro invocation (i.e. when we don't have
import ::
), then it's more productive to parseimport
as if it was incorrectly mistaken foruse
.Not sure if this needs to be a verbose suggestion, but it renders strangely when it's not verbose:
Happy to change it to
span_suggestion
instead ofspan_suggestion_verbose
though.Fixes #97788