Skip to content

Commit 94b7d3f

Browse files
committed
impl Display properly even if its written as core::fmt::Display
1 parent 4fdcd27 commit 94b7d3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

c-bindings-gen/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,9 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, w_uses: &mut HashSet<String, NonRa
14081408

14091409
write!(w, "\talloc::format!(\"{{:?}}\", unsafe {{ o as *const crate::{} }}).into()", resolved_path).unwrap();
14101410
writeln!(w, "}}").unwrap();
1411-
} else if path_matches_nongeneric(&trait_path.1, &["Display"]) {
1411+
} else if full_trait_path_opt.as_ref().map(|s| s.as_str()) == Some("core::fmt::Display") ||
1412+
path_matches_nongeneric(&trait_path.1, &["Display"])
1413+
{
14121414
writeln!(w, "#[no_mangle]").unwrap();
14131415
writeln!(w, "/// Get the string representation of a {} object", ident).unwrap();
14141416
writeln!(w, "pub extern \"C\" fn {}_to_str(o: &crate::{}) -> Str {{", ident, resolved_path).unwrap();

0 commit comments

Comments
 (0)