fn g(&self)->&mut Self{ unsafe { & mut * ( self as * const Self as * mut Self)} } as 只能转换基本数据类型 ,结构体类型 只能转换指针, 不能转换结构体引用,应该是结构体引用也被视为了复杂的结构体类型。 来源:oschina链接:https://my.oschina.net/u/4271740/blog/4267527 标签 rust