File tree 5 files changed +36
-35
lines changed
5 files changed +36
-35
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
// compile-flags: -Zsave-analysis
2
+ // Also regression test for #69416
2
3
3
4
mod my_mod {
4
5
pub struct MyStruct {
Original file line number Diff line number Diff line change 1
1
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
3
3
|
4
4
LL | let _woohoo = (&my_struct).priv_field;
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^
6
6
7
7
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
9
9
|
10
10
LL | let _woohoo = (Box::new(my_struct)).priv_field;
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
12
13
13
error[E0624]: method `happyfun` is private
14
- --> $DIR/issue-3763.rs:23 :18
14
+ --> $DIR/issue-3763.rs:24 :18
15
15
|
16
16
LL | (&my_struct).happyfun();
17
17
| ^^^^^^^^
18
18
19
19
error[E0624]: method `happyfun` is private
20
- --> $DIR/issue-3763.rs:25 :27
20
+ --> $DIR/issue-3763.rs:26 :27
21
21
|
22
22
LL | (Box::new(my_struct)).happyfun();
23
23
| ^^^^^^^^
24
24
25
25
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
27
27
|
28
28
LL | let nope = my_struct.priv_field;
29
29
| ^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 1
1
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
3
3
|
4
- LL | nyan.speak = || println!("meow");
5
- | ^^^^^
4
+ LL | nyan.speak = || println!("meow");
5
+ | ^^^^^
6
6
|
7
7
= help: methods are immutable and cannot be assigned to
8
8
9
9
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
11
11
|
12
- LL | nyan.speak += || println!("meow");
13
- | ^^^^^
12
+ LL | nyan.speak += || println!("meow");
13
+ | ^^^^^
14
14
|
15
15
= help: methods are immutable and cannot be assigned to
16
16
You can’t perform that action at this time.
0 commit comments