Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions crates/edit/src/icu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,15 @@ fn utext_access_impl<'a>(ut: &mut icu_ffi::UText, native_index: usize, forward:
ut.a = tb.generation() as i64;
} else {
// Check if one of the caches already contains the requested range.
for (i, cache) in double_cache.cache.iter().enumerate() {
if cache.utf8_range.contains(&index_contained) {
double_cache.mru = i != 0;
return cache;
}
//
// TODO: Due to borrowing issues in stable Rust 1.99 (and possibly subsequent versions),
// we cannot use any methods on double_cache (e.g. iterators or indexing helpers).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Leonard Hecker (@lhecker) the comment seems inaccurate. It isn't a bug, regression nor "issue" on stable, stable is working exactly as intended. It's a difference in how the new borrow checker on nightly works vs. Rust stable.

See running RUSTFLAGS="-Zpolonius=off" cargo +nightly build --release before this commit, produces same error as building with stable did.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Something can work as intended and still be an issue for me. They are not mutually exclusive.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

True, but still misleading comment if read without said internal knowledge of author's thoughts.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, arguably, it's an issue if disabling the new borrow checker--which changes this behavior--resolves it. Somewhat of an existence proof of there being a problem, yeah?

Behavior X is present in stable.
Behavior X is not present in nightly, unless you toggle the "go back to the thing that had behavior X" switch.

Put another way: if it wasn't an issue, why would it appear to be fixed by the new (better, less buggy, better-researched, etc. etc. etc.) borrow checker?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While I'm not a native English speaker, I consider this sentence reasonable and will keep it as-is. It's unclear at this point who of us is in the wrong, so I'll wait for a tie breaker.

That said, this is just a comment. It does not bear a significant meaning in the first place.

if double_cache.cache[0].utf8_range.contains(&index_contained) {
double_cache.mru = false; // aka 0
return &double_cache.cache[0];
} else if double_cache.cache[1].utf8_range.contains(&index_contained) {
double_cache.mru = true; // aka 1
return &double_cache.cache[1];
}
}

Expand Down
Loading