为什么不能在同一结构中存储值和对该值的引用?
我有一个值,我想以自己的类型存储该值和对该值中内容的引用: struct Thing { count: u32, } struct Combined<'a>(Thing, &'a u32); fn make_combined<'a>() -> Combined<'a> { let thing = Thing { count: 42 }; Combined(thing, &thing.count) } 有时,我有一个值,并且想在同一结构中存储该值和对该值的引用: struct Combined<'a>(Thing, &'a Thing); fn make_combined<'a>() -> Combined<'a> { let thing = Thing::new(); Combined(thing, &thing) } 有时,我什至没有引用该值,并且得到了相同的错误: struct Combined<'a>(Parent, Child<'a>); fn make_combined<'a>() …