Skip to content

Commit 1ad7c52

Browse files
authored
Rollup merge of #83569 - sjakobi:issue56445-regression-test, r=jackh726
Add regression tests for #56445 Closes #56445.
2 parents 69acaf3 + 0927580 commit 1ad7c52

7 files changed

+48
-3
lines changed

src/test/ui/const-generics/issues/issue-56445.full.stderr src/test/ui/const-generics/issues/issue-56445-1.full.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-56445.rs:3:27
2+
--> $DIR/issue-56445-1.rs:3:27
33
|
44
LL | #![cfg_attr(full, feature(const_generics))]
55
| ^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

1010
error[E0771]: use of non-static lifetime `'a` in const generic
11-
--> $DIR/issue-56445.rs:8:26
11+
--> $DIR/issue-56445-1.rs:8:26
1212
|
1313
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
1414
| ^^

src/test/ui/const-generics/issues/issue-56445.min.stderr src/test/ui/const-generics/issues/issue-56445-1.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0771]: use of non-static lifetime `'a` in const generic
2-
--> $DIR/issue-56445.rs:8:26
2+
--> $DIR/issue-56445-1.rs:8:26
33
|
44
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
55
| ^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-502095133
2+
struct OnDiskDirEntry<'a> { _s: &'a usize }
3+
4+
impl<'a> OnDiskDirEntry<'a> {
5+
const LFN_FRAGMENT_LEN: usize = 2;
6+
7+
fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
8+
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
9+
}
10+
11+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: generic `Self` types are currently not permitted in anonymous constants
2+
--> $DIR/issue-56445-2.rs:7:38
3+
|
4+
LL | fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
5+
| ^^^^
6+
|
7+
note: not a concrete type
8+
--> $DIR/issue-56445-2.rs:4:10
9+
|
10+
LL | impl<'a> OnDiskDirEntry<'a> {
11+
| ^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-524494170
2+
pub struct Memory<'rom> {
3+
rom: &'rom [u8],
4+
ram: [u8; Self::SIZE],
5+
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
6+
}
7+
8+
impl<'rom> Memory<'rom> {
9+
pub const SIZE: usize = 0x8000;
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: generic `Self` types are currently not permitted in anonymous constants
2+
--> $DIR/issue-56445-3.rs:4:15
3+
|
4+
LL | ram: [u8; Self::SIZE],
5+
| ^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)