1 // Copyright 2015 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.
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.
11 // Operator precedence of type ascription
12 // Type ascription has very high precedence, the same as operator `as`
14 #![feature(type_ascription)]
23 fn add(self, _rhs: Z) -> S { panic!() }
27 fn mul(self, _rhs: Z) -> S { panic!() }
31 fn neg(self) -> Z { panic!() }
35 fn deref(&self) -> &Z { panic!() }
41 &(S: &S); //~ ERROR mismatched types
45 *(S: Z); //~ ERROR mismatched types
46 //~^ ERROR type `Z` cannot be dereferenced
50 -(S: Z); //~ ERROR mismatched types
51 //~^ ERROR cannot apply unary operator `-` to type `Z`
55 (S + Z): Z; //~ ERROR mismatched types
59 (S * Z): Z; //~ ERROR mismatched types
63 (S .. S): S; //~ ERROR mismatched types