Skip to content

Commit 5307edc

Browse files
committed
Tweak tests
1 parent a211a82 commit 5307edc

File tree

5 files changed

+36
-35
lines changed

5 files changed

+36
-35
lines changed

src/test/ui/assign-to-method.rs

-24
This file was deleted.

src/test/ui/issues/issue-3763.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// compile-flags: -Zsave-analysis
2+
// Also regression test for #69416
23

34
mod my_mod {
45
pub struct MyStruct {

src/test/ui/issues/issue-3763.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
2-
--> $DIR/issue-3763.rs:17:19
2+
--> $DIR/issue-3763.rs:18:19
33
|
44
LL | let _woohoo = (&my_struct).priv_field;
55
| ^^^^^^^^^^^^^^^^^^^^^^^
66

77
error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
8-
--> $DIR/issue-3763.rs:20:19
8+
--> $DIR/issue-3763.rs:21:19
99
|
1010
LL | let _woohoo = (Box::new(my_struct)).priv_field;
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0624]: method `happyfun` is private
14-
--> $DIR/issue-3763.rs:23:18
14+
--> $DIR/issue-3763.rs:24:18
1515
|
1616
LL | (&my_struct).happyfun();
1717
| ^^^^^^^^
1818

1919
error[E0624]: method `happyfun` is private
20-
--> $DIR/issue-3763.rs:25:27
20+
--> $DIR/issue-3763.rs:26:27
2121
|
2222
LL | (Box::new(my_struct)).happyfun();
2323
| ^^^^^^^^
2424

2525
error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private
26-
--> $DIR/issue-3763.rs:26:16
26+
--> $DIR/issue-3763.rs:27:16
2727
|
2828
LL | let nope = my_struct.priv_field;
2929
| ^^^^^^^^^^^^^^^^^^^^
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// compile-flags: -Zsave-analysis
2+
// Also regression test for #69409
3+
4+
struct Cat {
5+
meows : usize,
6+
how_hungry : isize,
7+
}
8+
9+
impl Cat {
10+
pub fn speak(&self) { self.meows += 1; }
11+
}
12+
13+
fn cat(in_x : usize, in_y : isize) -> Cat {
14+
Cat {
15+
meows: in_x,
16+
how_hungry: in_y
17+
}
18+
}
19+
20+
fn main() {
21+
let nyan : Cat = cat(52, 99);
22+
nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
23+
nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method
24+
}

src/test/ui/assign-to-method.stderr src/test/ui/methods/assign-to-method.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0615]: attempted to take value of method `speak` on type `Cat`
2-
--> $DIR/assign-to-method.rs:22:8
2+
--> $DIR/assign-to-method.rs:22:10
33
|
4-
LL | nyan.speak = || println!("meow");
5-
| ^^^^^
4+
LL | nyan.speak = || println!("meow");
5+
| ^^^^^
66
|
77
= help: methods are immutable and cannot be assigned to
88

99
error[E0615]: attempted to take value of method `speak` on type `Cat`
10-
--> $DIR/assign-to-method.rs:23:8
10+
--> $DIR/assign-to-method.rs:23:10
1111
|
12-
LL | nyan.speak += || println!("meow");
13-
| ^^^^^
12+
LL | nyan.speak += || println!("meow");
13+
| ^^^^^
1414
|
1515
= help: methods are immutable and cannot be assigned to
1616

0 commit comments

Comments
 (0)