parent
aef11409b4
commit
0927580224
@ -1,5 +1,5 @@
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/issue-56445.rs:3:27
|
||||
--> $DIR/issue-56445-1.rs:3:27
|
||||
|
|
||||
LL | #![cfg_attr(full, feature(const_generics))]
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -8,7 +8,7 @@ LL | #![cfg_attr(full, feature(const_generics))]
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
--> $DIR/issue-56445.rs:8:26
|
||||
--> $DIR/issue-56445-1.rs:8:26
|
||||
|
|
||||
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
| ^^
|
@ -1,5 +1,5 @@
|
||||
error[E0771]: use of non-static lifetime `'a` in const generic
|
||||
--> $DIR/issue-56445.rs:8:26
|
||||
--> $DIR/issue-56445-1.rs:8:26
|
||||
|
|
||||
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
|
||||
| ^^
|
11
src/test/ui/const-generics/issues/issue-56445-2.rs
Normal file
11
src/test/ui/const-generics/issues/issue-56445-2.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-502095133
|
||||
struct OnDiskDirEntry<'a> { _s: &'a usize }
|
||||
|
||||
impl<'a> OnDiskDirEntry<'a> {
|
||||
const LFN_FRAGMENT_LEN: usize = 2;
|
||||
|
||||
fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
|
||||
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
|
||||
}
|
||||
|
||||
fn main() {}
|
14
src/test/ui/const-generics/issues/issue-56445-2.stderr
Normal file
14
src/test/ui/const-generics/issues/issue-56445-2.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/issue-56445-2.rs:7:38
|
||||
|
|
||||
LL | fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
|
||||
| ^^^^
|
||||
|
|
||||
note: not a concrete type
|
||||
--> $DIR/issue-56445-2.rs:4:10
|
||||
|
|
||||
LL | impl<'a> OnDiskDirEntry<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
12
src/test/ui/const-generics/issues/issue-56445-3.rs
Normal file
12
src/test/ui/const-generics/issues/issue-56445-3.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-524494170
|
||||
pub struct Memory<'rom> {
|
||||
rom: &'rom [u8],
|
||||
ram: [u8; Self::SIZE],
|
||||
//~^ ERROR: generic `Self` types are currently not permitted in anonymous constants
|
||||
}
|
||||
|
||||
impl<'rom> Memory<'rom> {
|
||||
pub const SIZE: usize = 0x8000;
|
||||
}
|
||||
|
||||
fn main() {}
|
8
src/test/ui/const-generics/issues/issue-56445-3.stderr
Normal file
8
src/test/ui/const-generics/issues/issue-56445-3.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: generic `Self` types are currently not permitted in anonymous constants
|
||||
--> $DIR/issue-56445-3.rs:4:15
|
||||
|
|
||||
LL | ram: [u8; Self::SIZE],
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user