diff --git a/src/main.rs b/src/main.rs index c91514d97808f0e7f36270690a97633ef97eba20..bf9e546585553f76f1a12a762bb5a9100817625f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,7 +39,7 @@ mod trusted { static mut U1: u1::State = u1::State::new(); -static mut U2: u2::State = u2::State {}; +static mut U2: u2::State = u2::State::new(); // Main should be inside trusted fn main() { @@ -104,8 +104,16 @@ mod u1 { mod u2 { use ::*; - pub struct State {} + pub struct State { + key: &'static str, + } + + + impl State { + pub const fn new() -> Self { + State { key: &*"---" } + } pub fn user2(&mut self, sec: &Sec, u1: &mut u1::State) { println!("user2, level = {}", sec.level()); let s = auth("abc");