-
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
Point out correct turbofish usage on Foo<Bar<Baz>>
#40500
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
CC @jonathandturner @GuillaumeGomez @jorendorff thoughts? |
I'm very 👍 this, so please don't take this as a blocking comment. I was just thinking about how we could make this a little clearer. Would a snippet help?
Not sure which is better, but figured it was worth a look to see the other approach. |
@jonathandturner I love the idea, but in order to provide those suggestions reliably we would have to parse the line in a different way to how we're doing it now, make sure we're properly closing all opening brackets (and if the code isn't, do it ourselves) and make sure that whatever results is actually a valid type and valid code in this context. Should we open a ticket for that task? I'd love to do that at one point, but I think merging this gets us 80% there with very little effort. |
@estebank - absolutely agree. Like I said, don't block on my suggestion. Let's improve things with your design and if we can go a few percent better later on, then we can do that later. |
Awesome! @jonathandturner's suggestion is good. Might be worth opening an issue to implement it as well. |
@bors r+ rollup |
📌 Commit 699bfa0 has been approved by |
@bors r- Travis failure looks legit. |
Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case.
699bfa0
to
e3b8550
Compare
📌 Commit e3b8550 has been approved by |
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Point out correct turbofish usage on `Foo<Bar<Baz>>` Whenever we parse a chain of binary operations, as long as the first operation is `<` and the subsequent operations are either `>` or `<`, present the following diagnostic help: use `::<...>` instead of `<...>` if you meant to specify type arguments This will lead to spurious recommendations on situations like `2 < 3 < 4` but should be clear from context that the help doesn't apply in that case. Fixes rust-lang#40396.
Whenever we parse a chain of binary operations, as long as the first
operation is
<
and the subsequent operations are either>
or<
,present the following diagnostic help:
This will lead to spurious recommendations on situations like
2 < 3 < 4
but should be clear from context that the help doesn't applyin that case.
Fixes #40396.