Skip to content

Commit 9facb6c

Browse files
committed
add regression test for rust-lang#50439
1 parent bf45371 commit 9facb6c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/test/ui/consts/issue-50439.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![feature(specialization)]
2+
#![allow(incomplete_features)]
3+
4+
pub trait ReflectDrop {
5+
const REFLECT_DROP: bool = false;
6+
}
7+
8+
impl<T> ReflectDrop for T where T: Clone {}
9+
10+
pub trait PinDropInternal {
11+
fn is_valid()
12+
where
13+
Self: ReflectDrop;
14+
}
15+
16+
struct Bears<T>(T);
17+
18+
default impl<T> ReflectDrop for Bears<T> {}
19+
20+
impl<T: Sized> PinDropInternal for Bears<T> {
21+
fn is_valid()
22+
where
23+
Self: ReflectDrop,
24+
{
25+
let _ = [(); 0 - !!(<Bears<T> as ReflectDrop>::REFLECT_DROP) as usize]; //~ ERROR constant expression depends on a generic parameter
26+
}
27+
}
28+
29+
fn main() {}

src/test/ui/consts/issue-50439.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: constant expression depends on a generic parameter
2+
--> $DIR/issue-50439.rs:25:22
3+
|
4+
LL | let _ = [(); 0 - !!(<Bears<T> as ReflectDrop>::REFLECT_DROP) as usize];
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: this may fail depending on what value the parameter takes
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)