Skip to content

Commit 9e0f427

Browse files
Rollup merge of #112989 - JohnTitor:issue-109141, r=compiler-errors
Add a regression test for #109141 Closes #109141 r? ``@compiler-errors``
2 parents f0907b2 + 13cc8dd commit 9e0f427

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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`.

0 commit comments

Comments
 (0)