Skip to content

Commit 6b1de1e

Browse files
committed
Add test of consteval error with notes
1 parent e1d19ae commit 6b1de1e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

src/tests/consteval.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
test_normalize! {
2+
WORKSPACE="/git/monostate"
3+
"
4+
error[E0080]: evaluation panicked: assertion failed: N == mem::size_of::<T::Type>()
5+
--> /git/monostate/src/string.rs:46:13
6+
|
7+
46 | assert!(N == mem::size_of::<T::Type>());
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `<(monostate::alphabet::len<8>, (monostate::alphabet::char<'a'>, monostate::alphabet::char<'s'>, monostate::alphabet::char<'d'>, monostate::alphabet::char<'f'>)) as monostate::string::Sealed>::__private::{constant#0}` failed here
9+
10+
note: erroneous constant encountered
11+
--> /git/monostate/src/string.rs:45:9
12+
|
13+
45 | / const {
14+
46 | | assert!(N == mem::size_of::<T::Type>());
15+
47 | | }
16+
| |_________^
17+
18+
note: erroneous constant encountered
19+
--> /git/monostate/src/string.rs:29:33
20+
|
21+
29 | const VALUE: &'static str = T::__private.0;
22+
| ^^^^^^^^^^^^
23+
24+
note: erroneous constant encountered
25+
--> /git/monostate/src/value.rs:132:37
26+
|
27+
132 | pub const VALUE: &'static str = V::VALUE;
28+
| ^^^^^^^^
29+
" "
30+
error[E0080]: evaluation panicked: assertion failed: N == mem::size_of::<T::Type>()
31+
--> $WORKSPACE/src/string.rs
32+
|
33+
| assert!(N == mem::size_of::<T::Type>());
34+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `<(monostate::alphabet::len<8>, (monostate::alphabet::char<'a'>, monostate::alphabet::char<'s'>, monostate::alphabet::char<'d'>, monostate::alphabet::char<'f'>)) as monostate::string::Sealed>::__private::{constant#0}` failed here
35+
36+
note: erroneous constant encountered
37+
--> $WORKSPACE/src/string.rs
38+
|
39+
| / const {
40+
| | assert!(N == mem::size_of::<T::Type>());
41+
| | }
42+
| |_________^
43+
44+
note: erroneous constant encountered
45+
--> $WORKSPACE/src/string.rs
46+
|
47+
| const VALUE: &'static str = T::__private.0;
48+
| ^^^^^^^^^^^^
49+
50+
note: erroneous constant encountered
51+
--> $WORKSPACE/src/value.rs
52+
|
53+
| pub const VALUE: &'static str = V::VALUE;
54+
| ^^^^^^^^
55+
"}

0 commit comments

Comments
 (0)