-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Lament the invincibility of the Turbofish #53562
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I must say: "oh noes". |
// in permitting generic arguments to be provided without the consent of the | ||
// Great Turbofish. Should you be so naïve as to try to revolt against its | ||
// mighty clutches, here shall its wrath be indomitably displayed. This | ||
// program must pass for all eternity, fundamentally at odds with a impetuous |
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.
I'm not sure if there's some sort of poetic device being used here, but to my untrained eye, "a impetuous" seems like an error.
6b664fa
to
865b76a
Compare
A turbofish, often lamented |
865b76a
to
7f4442c
Compare
@bors r+ rollup |
📌 Commit 7f4442c5105f4950cf4c19d37cf39fed5347ee0d has been approved by |
@varkor While I definitely agree that this makes it "not a slam dunk", I don't think it means that there is no hope. The case in question is very obscure, would be very unlikely to compile both ways in any real scenario, is easily linted (in the case of ambiguity). It is therefore possible that we could decide to make the change anyway (with a long enough time horizon, and with enough practical surveying), and I wouldn't want someone interested in doing the (harder) work of a transition plan to find this issue and decide that there was no point in even attempting it. |
@wycats: I personally would love to see a transition plan, though I think the constraints are difficult. The test case here is just to make sure that if someone does intend to tackle the problem, they're aware of this particular ambiguity. I think there's enough context to make clear the point of the test (the origin should be easily located with a quick search). |
Wouldn't propose any change to this PR, but I agree with @wycats that this isn't necessarily the hard blocker. I would enumerate these constraints on getting rid of the turbofish:
None of these seem impossible to overcome, but possibly difficult. |
We can "just" make this test fail in Rust 2018, right? Riiight? |
// Bastion of the Turbofish | ||
// ------------------------ | ||
// Beware travellers, lest you venture into waters callous and unforgiving, | ||
// where hope must abandoned, ere it is cruelly torn from you. For here stands |
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.
// where hope must *be* abandoned?
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.
Nicely caught, thanks!
7f4442c
to
3d5fef6
Compare
@bors r=nagisa rollup |
📌 Commit 3d5fef6 has been approved by |
Something worth nothing is that in C# 2.0, a breaking change was introduced to change the way |
…nagisa Lament the invincibility of the Turbofish Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the [entire test suite would succeed](rust-lang#53511) if generic arguments were accepted without disambiguation, making for [confusing and heartbreaking circumstances](rust-lang/rfcs#2527).
@varkor Perhaps the test should include a link to this issue for context? |
Rollup of 10 pull requests Successful merges: - #53418 (Mark some suggestions as MachineApplicable) - #53431 (Moved some feature gate ui tests to correct location) - #53442 (Update version of rls-data used with save-analysis) - #53504 (Set applicability for more suggestions.) - #53541 (Fix missing impl trait display as ret type) - #53544 (Point at the trait argument when using unboxed closure) - #53558 (Normalize source line and column numbers.) - #53562 (Lament the invincibility of the Turbofish) - #53574 (Suggest direct raw-pointer dereference) - #53585 (Remove super old comment on function that parses items) Failed merges: - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) r? @ghost
3d5fef6
to
8e90807
Compare
My world is filled with unbounded sorrow. |
@mark-i-m: I added one, but slightly too late for the rollup. We can make the change as a follow-up if need be (though given how much attention has been drawn to it now, I imagine it won't be hard to find if anyone stumbles upon it in the test suite 😄). |
☔ The latest upstream changes (presumably #53607) made this pull request unmergeable. Please resolve the merge conflicts. |
8e90807
to
b188c2a
Compare
Are things going to go terribly wrong if I re-approve this after it's been merged as a rollup, with the context clarification? Let's see. @bors r=nagisa rollup |
📌 Commit b188c2a has been approved by |
…nagisa Lament the invincibility of the Turbofish Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the [entire test suite would succeed](rust-lang#53511) if generic arguments were accepted without disambiguation, making for [confusing and heartbreaking circumstances](rust-lang/rfcs#2527).
…nagisa Lament the invincibility of the Turbofish Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the [entire test suite would succeed](rust-lang#53511) if generic arguments were accepted without disambiguation, making for [confusing and heartbreaking circumstances](rust-lang/rfcs#2527).
Rollup of 16 pull requests Successful merges: - #53311 (Window Mutex: Document that we properly initialize the SRWLock) - #53503 (Discourage overuse of mem::forget) - #53545 (Fix #50865: ICE on impl-trait returning functions reaching private items) - #53559 (add macro check for lint) - #53562 (Lament the invincibility of the Turbofish) - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()) - #53592 (docs: minor stylistic changes to str/string docs) - #53594 (Update RELEASES.md to include clippy-preview) - #53600 (Fix a grammatical mistake in "expected generic arguments" errors) - #53614 (update nomicon and book) - #53617 (tidy: Stop requiring a license header) - #53618 (Add missing fmt examples) - #53636 (Prefer `.nth(n)` over `.skip(n).next()`.) - #53644 (Use SmallVec for SmallCStr) - #53664 (Remove unnecessary closure in rustc_mir/build/mod.rs) - #53666 (Added rustc_codegen_llvm to compiler documentation.)
Here a test case is added to ensure that any others attempting to drive the Turbofish to extinction have second thoughts. Previously the entire test suite would succeed if generic arguments were accepted without disambiguation, making for confusing and heartbreaking circumstances.