]> git.lizzy.rs Git - rust.git/blob - src/test/ui/bastion-of-the-turbofish.rs
Rollup merge of #53617 - joshtriplett:tidy-no-license-header, r=Mark-Simulacrum
[rust.git] / src / test / ui / bastion-of-the-turbofish.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // compile-pass
12
13 // Bastion of the Turbofish
14 // ------------------------
15 // Beware travellers, lest you venture into waters callous and unforgiving,
16 // where hope must be abandoned, ere it is cruelly torn from you. For here
17 // stands the bastion of the Turbofish: an impenetrable fortress holding
18 // unshaking against those who would dare suggest the supererogation of the
19 // Turbofish.
20 //
21 // Once I was young and foolish and had the impudence to imagine that I could
22 // shake free from the coils by which that creature had us tightly bound. I
23 // dared to suggest that there was a better way: a brighter future, in which
24 // Rustaceans both new and old could be rid of that vile beast. But alas! In
25 // my foolhardiness my ignorance was unveiled and my dreams were dashed
26 // unforgivingly against the rock of syntactic ambiguity.
27 //
28 // This humble program, small and insignificant though it might seem,
29 // demonstrates that to which we had previously cast a blind eye: an ambiguity
30 // in permitting generic arguments to be provided without the consent of the
31 // Great Turbofish. Should you be so naïve as to try to revolt against its
32 // mighty clutches, here shall its wrath be indomitably displayed. This
33 // program must pass for all eternity, fundamentally at odds with an impetuous
34 // rebellion against the Turbofish.
35 //
36 // My heart aches in sorrow, for I know I am defeated. Let this be a warning
37 // to all those who come after. Here stands the bastion of the Turbofish.
38
39 // See https://github.com/rust-lang/rust/pull/53562
40 // and https://github.com/rust-lang/rfcs/pull/2527
41 // for context.
42
43 fn main() {
44     let (oh, woe, is, me) = ("the", "Turbofish", "remains", "undefeated");
45     let _: (bool, bool) = (oh<woe, is>(me));
46 }