Skip to content

Commit 8444dde

Browse files
add test fixture for newly allowed const expr
Signed-off-by: Ding Xiang Fei <[email protected]> Co-authored-by: Theemathas Chirananthavat <[email protected]>
1 parent c1ab3ed commit 8444dde

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/ui/coercion/no_local_for_coerced_const-issue-143671.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use std::fmt::Display;
77
use std::marker::Unsize;
88
use std::ops::CoerceUnsized;
9+
use std::rc::Weak;
910

1011
#[repr(transparent)]
1112
struct X<'a, T: ?Sized> {
@@ -27,4 +28,11 @@ const Y: X<'static, i32> = X { f: &0 };
2728

2829
fn main() {
2930
let _: [X<'static, dyn Display>; 0] = [Y; 0];
31+
coercion_on_weak_in_const();
32+
}
33+
34+
fn coercion_on_weak_in_const() {
35+
const X: Weak<i32> = Weak::new();
36+
const Y: [Weak<dyn Send>; 0] = [X; 0];
37+
let _ = Y;
3038
}

0 commit comments

Comments
 (0)