Safe Rust guarantees memory safety through strict compile-time constraints: ownership can be transferred, borrowing can temporarily guarantee either shared read-only or exclusive write access, and ownership and borrowing are scoped by lifetime. Automatically synthesizing correct and safe Rust code is challenging, as the generated code must not only satisfy ownership, borrowing, and lifetime constraints, but also meet type and interface requirements at compile time. This work proposes a synthesis method based on our newly defined Pushdown Colored Petri Net (PCPN) that models these compilation constraints directly from public API signatures to synthesize valid call sequences. Token colors encode dynamic resource states together with a scope level indicating the lifetime region in which a borrow is valid. The pushdown stack tracks the entering or leaving of lifetime parameter via pushing and popping tokens. A transition is enabled only when type matching and interface obligations both hold and the required resource states are available. Based on the bisimulation theory, we prove that the enabling and firing rules of PCPN are consistent with the compile-time check of these three constraints. We develop an automatic synthesis tool based on PCPN and the experimental results show that the synthesized codes are all correct.


翻译:暂无翻译

0
下载
关闭预览

相关内容

Rust 是一种注重高效、安全、并行的系统程序语言。
杀伤链分析构建与韧性优化方法
专知会员服务
51+阅读 · 2025年1月15日
EMNLP 2024 | 基于知识编辑的大模型敏感知识擦除
专知会员服务
22+阅读 · 2024年11月19日
专知会员服务
22+阅读 · 2021年6月26日
【Google】平滑对抗训练,Smooth Adversarial Training
专知会员服务
49+阅读 · 2020年7月4日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
60+阅读 · 2019年10月17日
【泡泡图灵智库】Detect-SLAM:目标检测和SLAM相互收益
泡泡机器人SLAM
14+阅读 · 2019年6月28日
强化学习三篇论文 避免遗忘等
CreateAMind
20+阅读 · 2019年5月24日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Fully-Convolutional Siamese Networks for Object Tracking论文笔记
统计学习与视觉计算组
10+阅读 · 2018年10月12日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
论文浅尝 | Improved Neural Relation Detection for KBQA
开放知识图谱
13+阅读 · 2018年1月21日
国家自然科学基金
119+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
20+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
VIP会员
最新内容
DeepSeek 版Claude Code,免费小白安装教程来了!
专知会员服务
6+阅读 · 5月5日
《美空军条令出版物 2-0:情报(2026版)》
专知会员服务
9+阅读 · 5月5日
帕兰提尔 Gotham:一个游戏规则改变器
专知会员服务
5+阅读 · 5月5日
【综述】 机器人学习中的世界模型:全面综述
专知会员服务
11+阅读 · 5月4日
伊朗的导弹-无人机行动及其对美国威慑的影响
相关基金
国家自然科学基金
119+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
20+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
18+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员