Skip to content

Instantly share code, notes, and snippets.

@aDotInTheVoid
Created March 22, 2021 19:23
Show Gist options
  • Save aDotInTheVoid/3fa72984c04a91e91aed1ed327a2cb96 to your computer and use it in GitHub Desktop.
Save aDotInTheVoid/3fa72984c04a91e91aed1ed327a2cb96 to your computer and use it in GitHub Desktop.
Make defid rustfmtable
diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs
index 7fa1a3eb0f5..6a22af30206 100644
--- a/compiler/rustc_interface/src/callbacks.rs
+++ b/compiler/rustc_interface/src/callbacks.rs
@@ -42,14 +42,14 @@ fn track_diagnostic(diagnostic: &Diagnostic) {
/// This is a callback from librustc_hir as it cannot access the implicit state
/// in librustc_middle otherwise.
fn def_id_debug(def_id: rustc_hir::def_id::DefId, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "DefId({}:{}", def_id.krate, def_id.index.index())?;
+ write!(f, "DefId(\"{}:{}", def_id.krate, def_id.index.index())?;
tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx {
write!(f, " ~ {}", tcx.def_path_debug_str(def_id))?;
}
Ok(())
})?;
- write!(f, ")")
+ write!(f, "\")")
}
/// Sets up the callbacks in prior crates which we want to refer to the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment