]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods/method-on-ambiguous-numeric-type.rs
fn-trait-closure test now pass on new solver
[rust.git] / tests / ui / methods / method-on-ambiguous-numeric-type.rs
1 // aux-build:macro-in-other-crate.rs
2
3 #[macro_use] extern crate macro_in_other_crate;
4
5 macro_rules! local_mac {
6     ($ident:ident) => { let $ident = 42; }
7 }
8
9 fn main() {
10     let x = 2.0.neg();
11     //~^ ERROR can't call method `neg` on ambiguous numeric type `{float}`
12
13     let y = 2.0;
14     let x = y.neg();
15     //~^ ERROR can't call method `neg` on ambiguous numeric type `{float}`
16     println!("{:?}", x);
17
18     for i in 0..100 {
19         println!("{}", i.pow(2));
20         //~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}`
21     }
22
23     local_mac!(local_bar);
24     local_bar.pow(2);
25     //~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}`
26 }
27
28 fn qux() {
29     mac!(bar);
30     bar.pow(2);
31     //~^ ERROR can't call method `pow` on ambiguous numeric type `{integer}`
32 }