-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide and implement a solution for internal-facing APIs #4467
Comments
Another solution I'm open to considering is to have the macro generate It would make me very very happy if Rust itself had an annotation for this. Anything like "this API might not be semver safe" which generates a warning when using it cross-crate. |
I think what we should do for these is that we have the macro generate Generating that doc header seems nice, if we use a macro we can tweak the precise solution over time. |
@Manishearth's proposal SGTM. Either way I would like a macro so that it's easy to find and tweak over time. |
Concrete proposal:
LGTM to me and Shane. |
Specifically, the cfg should be set on the job that creates the docs uploaded to https://unicode-org.github.io/icu4x/rustdoc/, and the "unstable feature" box should be included so that people referencing those docs don't think the function is public stable. |
Open question: where should the internal docs macro live? I propose it lives in a macros file that we copy around the repo into each crate and have a CI job to ensure it remains updated, similar to Needs approval: |
Can we use symlinks? I'd rather not copy around, because then we'd have another CI job to enforce consistency, and another make job to "generate" these. |
Symlinks are annoying for Windows users, but it appears there are solutions that require some manual setup. I tend to feel that in order of priority of constituencies, the experience for new contributors should be favored over the experience of core ICU4X developers. Avoiding symlinks is harder on the core developers but easier for new contributors since they don't need any special configurations. |
We've had a symlink in the repo for months now and I haven't heard any complaints. |
I also disagree with this. ICU4X core contributors spend a lot of time contributing to ICU4X. We just removed a bunch of generated files from the repo which again and again lead to failing CI and delays for core contributors. |
The removal of the generated files you reference was done after establishing that doing so didn't substantially impact other constituencies. |
The existing symlink impacts diplomat-gen, which impacts all contributors but not clients. The proposed symlink would impact anyone building icu4x from the repo. |
Points:
Proposal:
LGTM: @Manishearth @sffc @robertbastian Implementation proposal:
LGTM: @sffc @Manishearth |
Cross posting from #5101 (comment): My opinion on this shifts if we plan to put unsafe code in |
We've hit multiple snags recently where we wanted to change a mostly-internal function that was
pub
and were blocked because of semver:cmp_iter
functions in icu_locidnew_owned
andCart
types in icu_providerSome thoughts/comments/problems:
#[doc(hidden)]
, they are less discoverable including to ICU4X developers. We can't expect ICU4X developers to look into the source code just to see if a function they want happens to be there.Here's a proposal:
Add a macro_rules that generates the following boilerplate:
The macro_rules can live in icu_locid for now. We can move it later.
To annotate an internal API, you can do this:
The
icu4x_internal
Cargo feature does not bubble up to the metacrate. It can be selectively enabled whenever it is needed. One advantage of making anicu4x_internal
feature is that we can disable it when uploading docs to docs.rs (https://docs.rs/about/metadata), although I don't think there's a way to disable just that one feature; we would need to switch from--all-features
to an explicit feature list per-crate, which is error-prone. Alternatively, I'm fine if we say we don't introduce a Cargo feature for this and simply let these APIs live in the docs.In the 1.5 or 2.0 timeframe, I suggest that we scrub our API surface and add this annotation where appropriate. A lot of things that are currently
#[doc(hidden)]
should probably use the annotation instead, and likewise things that are currently public stable should also probably use the annotation.If we agree on this, I may suggest we make a similar annotation for the provider module.
Needs approval or input from:
The text was updated successfully, but these errors were encountered: