Skip to content
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

Moving fallback options into icu_provider #3651

Merged
merged 17 commits into from
Aug 15, 2023

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Jul 7, 2023

The LocaleFallbackConfig is the options bag for an icu::locid_transform::LocaleFallbacker. It was previously defined in icu_provider_adapters, with its members FallbackPriority and FallbackSupplement in icu_provider. After moving fallback logic out of provider code, they should also be moved out. However, as icu_provider depends on them (for data key metadata), they have to be in icu_locid instead of icu_locid_transform. I think that's an ok solution, as they define behaviour of locales.

#3504

@Manishearth Manishearth removed their request for review July 7, 2023 17:28
@robertbastian robertbastian requested review from Manishearth and removed request for dminor, zbraniecki, nciric and Manishearth July 13, 2023 09:06
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Not convinced that icu_locid is the best place; maybe @zbraniecki has thoughts.

I'd not necessarily be opposed to moving more of these primitives to icu_provider.

components/locid/src/fallback.rs Outdated Show resolved Hide resolved
@robertbastian
Copy link
Member Author

Another option I'd be happy with is to define these as #[doc(hidden)] in icu_provider, and have their canonical documented location be in icu_locid_transform.

@sffc
Copy link
Member

sffc commented Jul 19, 2023

Another option I'd be happy with is to define these as #[doc(hidden)] in icu_provider, and have their canonical documented location be in icu_locid_transform.

I'm open to that, but can we keep the DataKey::fallback_config function in that world?

@robertbastian robertbastian requested a review from sffc July 20, 2023 12:19
sffc
sffc previously approved these changes Jul 21, 2023
components/locid/Cargo.toml Outdated Show resolved Hide resolved
Comment on lines +187 to +188
// This is a reexport of a hidden module, which works fine in HTML doc but
// doesn't seem to be reachable anywhere in JSON.
Copy link
Member

Choose a reason for hiding this comment

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

File an issue about this upstream somewhere?

CC @Manishearth

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 don't know if this is actually an upstream issue and I don't want to spend a day figuring it out.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah doc(hidden) is a mess, I would still recommend filing a bug with a non-reduced testcase, or mentioning it in zulip.

Copy link
Member

Choose a reason for hiding this comment

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

This might have been rust-lang/rust#109697

@robertbastian robertbastian changed the title Moving fallback options into icu_locid Moving fallback options into icu_provider Jul 21, 2023
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

By the looks of that thread, they want it such that if an item is doc(hidden), it should always be doc(hidden), and it's considered a bug if a re-export of that item shows up in docs

This whole defining of enums in one crate and exporting them from some other crate is really not great anyway.

@sffc sffc added the discuss Discuss at a future ICU4X-SC meeting label Jul 21, 2023
@Manishearth
Copy link
Member

By the looks of that thread, they want it such that if an item is doc(hidden), it should always be doc(hidden), and it's considered a bug if a re-export of that item shows up in docs

No, that thread is a rejected proposal (I was one of the people opposing it); I was just giving context on doc(hidden) having a lot of subtle behaviors that they wish to improve. That thread is a heavy-handed attempt to fix rust-lang/rust#109449 and rust-lang/rust#53417 which it links to, and there's also some discussion of JSON near the end.

Those issues were fixed by adding documentation. What I'm highlighting is that that there's a bunch of subtle behavior aroudn this and some of it is unintuitive but intentional, while other bits are unintuitive and unintentional, but it's known that this area is a mess, and I think a bug report would be helpful (because it is almost certainly a bug).

@sffc
Copy link
Member

sffc commented Jul 21, 2023

The thread says fairly explicitly:

I propose closing this PR and opening a new one to document the new decision (and fix any weird inconsistencies): doc(hidden) will be inherited when an item is re-exported, whether through named use or glob use.

@Manishearth
Copy link
Member

Ah yes, that is the status quo. But not quite "should always be doc(hidden)", we do kinda want to try and introduce a doc(no_hidden) that can override this behavior.

@robertbastian
Copy link
Member Author

@sffc what do you want to discuss here?

@sffc
Copy link
Member

sffc commented Jul 24, 2023

We have constraints that seem incompatible:

  • @sffc does not want these in icu_locid because they are about fallbacking, a concept which icu_locid does not otherwise contain
  • @robertbastian does not want these in icu_provider because they are about locale fallback, a concept which icu_provider does not otherwise contain
  • They can't go into icu_locid_transform because they are used in DataKeyMetadata
  • We don't want to duplicate the enums into icu_provider because duplicated enums are unnecessarily confusing
  • And we've found that it is really quite messy and against the grain to doc(hidden) these in icu_provider and then publicly re-export them in icu_locid_transform

So I put it on the discussion queue in order to maybe figure out a path forward.

@robertbastian
Copy link
Member Author

And we've found that it is really quite messy and against the grain to doc(hidden) these in icu_provider and then publicly re-export them in icu_locid_transform

I don't think that's the case

@sffc
Copy link
Member

sffc commented Aug 10, 2023

Conclusion: OK to depend on the current behavior of doc(hidden); @Manishearth plans to advocate that if that behavior changes, then doc(visible) needs to be added at the same time, and we can adopt that annotation when available.

@sffc sffc self-requested a review August 10, 2023 17:54
@sffc sffc removed the discuss Discuss at a future ICU4X-SC meeting label Aug 10, 2023
Manishearth
Manishearth previously approved these changes Aug 14, 2023
@robertbastian
Copy link
Member Author

@sffc please review or at least remove the request changes. This PR has multiple conflicts a day, and we decided last week that we're going to merge this as-is.

Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

sorry for the slow review

@robertbastian robertbastian merged commit 95916c9 into unicode-org:main Aug 15, 2023
@robertbastian robertbastian deleted the locid branch August 15, 2023 16:30
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.

3 participants