Fix error codes index generation

This commit is contained in:
Guillaume Gomez 2019-11-12 16:58:37 +01:00
parent cfd4e9722e
commit ec50a750f9

View File

@ -14,7 +14,9 @@ fn main() {
if entry.file_name() == "error_codes.rs" {
println!("cargo:rerun-if-changed={}", entry.path().to_str().unwrap());
let file = fs::read_to_string(entry.path()).unwrap()
.replace("syntax::register_diagnostics!", "register_diagnostics!");
.replace("crate::register_diagnostics!", "register_diagnostics!")
.replace(": include_str!(\"./",
": include_str!(\"../../../../../../../../src/librustc_error_codes/");
let contents = format!("(|| {{\n{}\n}})()", file);
fs::write(&out_dir.join(&format!("error_{}.rs", idx)), &contents).unwrap();