Skip to content

Conversation

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Sep 18, 2025

Pulls in rust-diplomat/diplomat#956

We no longer mark all our FFI modules with namespaces. The code is largely unchanged, except that diplomat_runtime.h is now under the icu4x folder, and all diplomat:: types are icu4x::diplomat::.

This allows ICU4X to be mixed with other Diplomat-using libraries.

@Manishearth Manishearth requested review from a team and sffc as code owners September 18, 2025 19:29
@dpulls
Copy link

dpulls bot commented Sep 18, 2025

⚠️ Dpulls not installed on repository rust-diplomat/diplomat. Checkout our quickstart for how to install.

@gemini-code-assist
Copy link

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

Manishearth added a commit to rust-diplomat/diplomat that referenced this pull request Sep 18, 2025
Fixes #688, fixes #920. Projects are strongly encouraged to use this to
avoid namespace pollution.

With this change, C++ projects setting `lib_name` will use that as a
toplevel namespace. Further namespaces produce sub-namespaces (e.g.
ICU4X could have `lib_name = icu4x` and `namespace = properties` on some
of its code for `icu4x::properties::blah`)

Switching from namespaces to lib_name does not change the actual code
too much EXCEPT `diplomat_runtime.h` will now be `libname::diplomat` and
will have a lib-scoped include guard. This is overall better for
everyone.


This does not affect the nanobind backend, currently. Followup:
#957

See this in action:

 - ICU4X: unicode-org/icu4x#6957
 - temporal_rs: boa-dev/temporal#581
@Manishearth Manishearth changed the title Update Diplomat to a version with lib-name Update Diplomat to using cpp lib_name Sep 18, 2025
@dpulls
Copy link

dpulls bot commented Sep 18, 2025

⚠️ Dpulls not installed on repository rust-diplomat/diplomat. Checkout our quickstart for how to install.

public:

/**
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: whitespace change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but I think it's a good whitespace change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@Manishearth Manishearth Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the Diplomat architecture (this is behind three layers of nested templates) it becomes harder and harder to fix these things.

I think we should try and fix whitespace issues when we notice them if they're easy, but we should not care that much about them.

This change actually aligns the comment with itself: I noticed it when reviewing the Diplomat change and decided it was good. I made it better in rust-diplomat/diplomat#961, but I do not think I should be required to fix these things on Diplomat update PRs. It's often a huge waste of time mucking with Jinja whitespace controls to minimize the diff.

I agree with it when the diff starts pulling in unrelated files, but this diff was going to affect all files anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. There is still a docs diff in this PR, but it is fixing the alignment as well and is intentional.

std::fs::remove_dir_all(&include)?;
std::fs::create_dir(&include)?;
if lang == "cpp" {
include = include.join("icu4x");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can diplomat create a library directory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave it up to the client. I considered it. I think it's a bit silly to unconditionally make a directory.

@Manishearth Manishearth merged commit 66b1b95 into unicode-org:main Sep 22, 2025
32 checks passed
@Manishearth Manishearth deleted the diplomat-lib-name branch September 22, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants