Skip to content

Commit 4060ed7

Browse files
committed
Add a FIXME note about what's missing
1 parent ff055e2 commit 4060ed7

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ignore-test
2+
3+
#![allow(incomplete_features)]
4+
#![feature(const_mut_refs)]
5+
#![feature(inline_const)]
6+
7+
use std::marker::PhantomData;
8+
9+
#[derive(PartialEq, Eq)]
10+
pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>);
11+
12+
impl<'a, T: ?Sized> InvariantRef<'a, T> {
13+
pub const fn new(r: &'a T) -> Self {
14+
InvariantRef(r, PhantomData)
15+
}
16+
}
17+
18+
impl<'a> InvariantRef<'a, ()> {
19+
pub const NEW: Self = InvariantRef::new(&());
20+
}
21+
22+
fn match_invariant_ref<'a>() {
23+
let y = ();
24+
match InvariantRef::new(&y) {
25+
//~^ ERROR `y` does not live long enough [E0597]
26+
// FIXME(nbdd0121): This should give the same error as `InvariantRef::<'a>::NEW` (without
27+
// const block)
28+
const { InvariantRef::<'a>::NEW } => (),
29+
}
30+
}
31+
32+
fn main() {
33+
match_invariant_ref();
34+
}

0 commit comments

Comments
 (0)