File tree 2 files changed +39
-0
lines changed
tests/ui/const-generics/generic_const_exprs
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( generic_const_exprs) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ impl EntriesBuffer {
5
+ fn a ( & self ) -> impl Iterator {
6
+ self . 0 . iter_mut ( ) //~ ERROR: cannot borrow `*self.0` as mutable, as it is behind a `&` reference
7
+ }
8
+ }
9
+
10
+ struct EntriesBuffer ( Box < [ [ u8 ; HashesEntryLEN ] ; 5 ] > ) ;
11
+ //~^ ERROR: cannot find value `HashesEntryLEN` in this scope
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0425]: cannot find value `HashesEntryLEN` in this scope
2
+ --> $DIR/issue-109141.rs:10:32
3
+ |
4
+ LL | struct EntriesBuffer(Box<[[u8; HashesEntryLEN]; 5]>);
5
+ | ^^^^^^^^^^^^^^ not found in this scope
6
+ |
7
+ help: you might be missing a const parameter
8
+ |
9
+ LL | struct EntriesBuffer<const HashesEntryLEN: /* Type */>(Box<[[u8; HashesEntryLEN]; 5]>);
10
+ | ++++++++++++++++++++++++++++++++++
11
+
12
+ error[E0596]: cannot borrow `*self.0` as mutable, as it is behind a `&` reference
13
+ --> $DIR/issue-109141.rs:6:9
14
+ |
15
+ LL | self.0.iter_mut()
16
+ | ^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
17
+ |
18
+ help: consider changing this to be a mutable reference
19
+ |
20
+ LL | fn a(&mut self) -> impl Iterator {
21
+ | ~~~~~~~~~
22
+
23
+ error: aborting due to 2 previous errors
24
+
25
+ Some errors have detailed explanations: E0425, E0596.
26
+ For more information about an error, try `rustc --explain E0425`.
You can’t perform that action at this time.
0 commit comments