]> git.proxmox.com Git - rustc.git/blame - src/test/ui/const-generics/min_const_generics/macro-fail.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / const-generics / min_const_generics / macro-fail.rs
CommitLineData
29967ef6
XL
1struct Example<const N: usize>;
2
3macro_rules! external_macro {
4 () => {{
5 //~^ ERROR expected type
6 const X: usize = 1337;
7 X
8 }}
9}
10
11trait Marker<const N: usize> {}
12impl<const N: usize> Marker<N> for Example<N> {}
13
14fn make_marker() -> impl Marker<gimme_a_const!(marker)> {
fc512014 15 //~^ ERROR: type provided when a constant was expected
29967ef6 16 Example::<gimme_a_const!(marker)>
29967ef6
XL
17}
18
19fn from_marker(_: impl Marker<{
20 #[macro_export]
21 macro_rules! inline { () => {{ 3 }} }; inline!()
22}>) {}
23
24fn main() {
25 let _ok = Example::<{
26 #[macro_export]
27 macro_rules! gimme_a_const {
28 ($rusty: ident) => {{ let $rusty = 3; *&$rusty }}
29 //~^ ERROR expected type
30 //~| ERROR expected type
31 };
32 gimme_a_const!(run)
33 }>;
34
35 let _fail = Example::<external_macro!()>;
29967ef6
XL
36
37 let _fail = Example::<gimme_a_const!()>;
487cf647 38 //~^ ERROR unexpected end of macro invocation
29967ef6 39}