]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods/method-missing-call.rs
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / methods / method-missing-call.rs
1 // Tests to make sure that parens are needed for method calls without arguments.
2 // outputs text to make sure either an anonymous function is provided or
3 // open-close '()' parens are given
4
5
6 struct Point {
7     x: isize,
8     y: isize
9 }
10 impl Point {
11     fn new() -> Point {
12         Point{x:0, y:0}
13     }
14     fn get_x(&self) -> isize {
15         self.x
16     }
17 }
18
19 fn main() {
20     let point: Point = Point::new();
21     let px: isize =  point
22                         .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
23
24     // Ensure the span is useful
25     let ys = &[1,2,3,4,5,6,7];
26     let a = ys.iter()
27               .map(|x| x)
28               .filter(|&&x| x == 1)
29               .filter_map; //~ ERROR attempted to take value of method `filter_map` on type
30 }