File tree Expand file tree Collapse file tree 5 files changed +36
-35
lines changed Expand file tree Collapse file tree 5 files changed +36
-35
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11// compile-flags: -Zsave-analysis
2+ // Also regression test for #69416
23
34mod my_mod {
45 pub struct MyStruct {
Original file line number Diff line number Diff line change 11error[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 |
44LL | let _woohoo = (&my_struct).priv_field;
55 | ^^^^^^^^^^^^^^^^^^^^^^^
66
77error[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 |
1010LL | let _woohoo = (Box::new(my_struct)).priv_field;
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error[E0624]: method `happyfun` is private
14- --> $DIR/issue-3763.rs:23 :18
14+ --> $DIR/issue-3763.rs:24 :18
1515 |
1616LL | (&my_struct).happyfun();
1717 | ^^^^^^^^
1818
1919error[E0624]: method `happyfun` is private
20- --> $DIR/issue-3763.rs:25 :27
20+ --> $DIR/issue-3763.rs:26 :27
2121 |
2222LL | (Box::new(my_struct)).happyfun();
2323 | ^^^^^^^^
2424
2525error[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 |
2828LL | let nope = my_struct.priv_field;
2929 | ^^^^^^^^^^^^^^^^^^^^
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 11error[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
99error[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
You can’t perform that action at this time.
0 commit comments