-
Notifications
You must be signed in to change notification settings - Fork 898
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
In Rust 2018, use ::foo::bar
and use foo::bar
are distinct
#3104
Comments
You need to add |
Why don't rustfmt read |
Good point. No technical reason, we did not consider it at the first place 😞 |
I think rustfmt should definitely not require a (OK, I guess I did, but I had forgotten.) |
Also: I tend to run rustfmt via the emacs integration, which may or may not be passing |
Basically I'm just saying: we should consider all the ways people run rustfmt :) |
Does |
OK, we need to make a decision here, I guess. I think cargo-fmt should definitely just check the Cargo.toml, and then rustfmt.toml if there is no edition specified. In principle rustfmt either as a binary or a library should be able to run independent of Cargo, so we can't rely on Cargo.toml. However, should we look for Cargo.toml if there is one? I think it is right to default to 2015, since that is what Rust does too. However, I'm not sure if that leaves us in a good place for people running rustfmt via an editor or the RLS (I think the RLS could set the edition, if it doesn't already. I assume editors can't do that?). |
My understanding is that when Rust 2018 is released, cargo will default to it ... or am I mistaken? If an editor would call |
I do as well. I use @nikomatsakis I assume that for "conservative" you mean to follow the default as Rust compiler uses. Am I right? |
I agree that As for the default behavior (no I never really ran |
Todos:
I think that when multiple editions are specified, the precedence should be
|
Maybe also show a warning if it comes down to these two and they explicitly specify different editions? Like "warning: different editions specified in |
|
I'd like to inform I am looking at this issue, so there is no duplicated work. |
|
What is missing on this one? |
The missing piece here is to prove out the API by having the RLS use it. Once we have that, then we should release Rustfmt and the RLS. |
RLS part: rust-lang/rls#1119 |
I had a problem where rustfmt was reformatting
use ::foo::bar
touse foo::bar
-- the problem is that, in Rust 2018,use ::foo::bar
is sometimes needed to disambiguate:See e.g.
which -- in Rust 2018 -- fails with an ambiguity error (playground) if you have
rayon
in the prelude. Changing touse ::rayon::join
disambiguates and is accepted (playground).The text was updated successfully, but these errors were encountered: