Ai
4 Star 16 Fork 0

Gitee 极速下载/intellij-rust

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/intellij-rust/intellij-rust
克隆/下载
build.rs 968 Bytes
一键复制 编辑 原始数据 按行查看 历史
use std::{env, fs};
use std::path::Path;
use quote::ToTokens;
use reqwest::blocking::get;
use syn::{File, Item};
fn main() {
let commit = env::var("RUSTC_COMMIT").unwrap_or(String::from("master"));
let text = get(format!("https://raw.githubusercontent.com/rust-lang/rust/{commit}/compiler/rustc_span/src/symbol.rs"))
.unwrap()
.text()
.unwrap();
let result = syn::parse_str::<File>(&text).unwrap();
for item in result.items {
if let Item::Macro(m) = item {
let name = m.mac.path.segments.to_token_stream().to_string();
if name == "symbols" {
let text = m.mac.to_token_stream().to_string();
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("symbol.rs");
fs::write(dest_path, &text).unwrap();
return;
}
}
}
panic!("Can't find `symbols` macro call");
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mirrors/intellij-rust.git
git@gitee.com:mirrors/intellij-rust.git
mirrors
intellij-rust
intellij-rust
master

搜索帮助