Debian Codegraph @

tests/compile-fail/construct-with-errors.rs

raw symbols SCIP
1 // Copyright (c) 2021 Pierre Chifflier <[email protected]>
2 //
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6 // option. This file may not be copied, modified, or distributed
7 // except according to those terms.
8
9 extern crate pnet_macros;
10 extern crate pnet_macros_support;
11 use pnet_macros::packet;
12
13 #[derive(Clone, Debug)]
14 pub struct Toto{
15 dummy: u16,
16 }
17
18 #[packet]
19 pub struct PacketU16 {
20 #[construct_with()] //~ ERROR #[construct_with] must have at least one argument
21 banana: Toto,
22 #[payload]
23 payload: Vec<u8>,
24 }
25
26 #[packet]
27 pub struct PacketU16B {
28 #[construct_with("test")] //~ ERROR #[construct_with] should be of the form #[construct_with(<primitive types>)]
29 banana: Toto,
30 #[payload]
31 payload: Vec<u8>,
32 }
33
34 #[packet]
35 pub struct PacketU16C {
36 #[construct_with(::foo:bar)] //~ ERROR #[construct_with] should be of the form #[construct_with(<primitive types>)]
37 banana: Toto,
38 #[payload]
39 payload: Vec<u8>,
40 }
41
42 #[packet]
43 pub struct PacketU16D {
44 #[construct_with(Vec<u8>)] //~ ERROR #[construct_with] should be of the form #[construct_with(<primitive types>)]
45 banana: Toto,
46 #[payload]
47 payload: Vec<u8>,
48 }
49
50 #[packet]
51 pub struct PacketU16E {
52 #[construct_with(test)] //~ ERROR arguments to #[construct_with] must be primitives
53 banana: Toto,
54 #[payload]
55 payload: Vec<u8>,
56 }
57
58
59 fn main() {}