[Do not merge, partial change to discuss] Have gecko_string_cache use &Atom instead of BorrowedAtom#12548
[Do not merge, partial change to discuss] Have gecko_string_cache use &Atom instead of BorrowedAtom#12548SimonSapin wants to merge 1 commit intomasterfrom
Conversation
|
The idea is to replace
Using a pub trait Borrow<Borrowed: ?Sized> {
fn borrow<'a>(&'a self) -> &'a Borrowed;
}Note that |
| pub struct Atom(*mut nsIAtom); | ||
| #[derive(PartialEq, Eq, Debug, Hash, Clone)] | ||
| pub struct Namespace(pub Atom); | ||
| pub type Namespace = Atom; |
There was a problem hiding this comment.
This was mostly to get things building more easily. I can re-introduce the newtype and add WeakNamespace.
|
Full change set, if you want more context: |
|
@bholley To respond to your IRC question:
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsIAtom {
pub _base: nsISupports,
pub _bitfield_1: u32,
pub mHash: u32,
/**
* WARNING! There is an invisible constraint on |mString|: the chars it
* points to must belong to an nsStringBuffer. This is so that the
* nsStringBuffer::FromData() calls above are valid.
*/
pub mString: *mut ::std::os::raw::c_ushort,
} |
|
I would prefer to add some bindgen magic to restrict those fields - see rust-lang/rust-bindgen#20 (comment). |
|
We can always change to that once bindgen supportis there. |
|
@Manishearth is adding that support right now, so maybe we can just use nsIAtom and add the belt-and-suspenders privacy annotations shortly afterwards? Would be less overall churn. |
|
Changes in dependencies being merged and published, I’ve opened #12571. Let’s move this discussion there. |
Update to selectors 0.8 (generic over atoms) This removes the `[replace]` override in geckolib and therefore unblocks #12391. This includes the `gecko_string_cache` redesign discussed in #12548. r? @bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12571) <!-- Reviewable:end -->
Update to selectors 0.8.1 (generic over atoms) This removes the `[replace]` override in geckolib and therefore unblocks #12391. This includes the `gecko_string_cache` redesign discussed in #12548. r? @bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12571) <!-- Reviewable:end -->
Update to selectors 0.8.2 (generic over atoms) This removes the `[replace]` override in geckolib and therefore unblocks #12391. This includes the `gecko_string_cache` redesign discussed in #12548. r? @bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12571) <!-- Reviewable:end -->
…(from servo:selectors-generic-atom_); r=bholley This removes the `[replace]` override in geckolib and therefore unblocks servo/servo#12391. This includes the `gecko_string_cache` redesign discussed in servo/servo#12548. r? bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 5e83b3f83bfcf48d0096442bdf5c9bf753623970 UltraBlame original commit: db13dfd0cfa9ee8de452d6083c2d5bdda74585af
…(from servo:selectors-generic-atom_); r=bholley This removes the `[replace]` override in geckolib and therefore unblocks servo/servo#12391. This includes the `gecko_string_cache` redesign discussed in servo/servo#12548. r? bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 5e83b3f83bfcf48d0096442bdf5c9bf753623970 UltraBlame original commit: db13dfd0cfa9ee8de452d6083c2d5bdda74585af
…(from servo:selectors-generic-atom_); r=bholley This removes the `[replace]` override in geckolib and therefore unblocks servo/servo#12391. This includes the `gecko_string_cache` redesign discussed in servo/servo#12548. r? bholley --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #12548 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require new tests because refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 5e83b3f83bfcf48d0096442bdf5c9bf753623970 UltraBlame original commit: db13dfd0cfa9ee8de452d6083c2d5bdda74585af
This is part of a larger change discussed at #12391 (comment), but I’d like to get feedback on this specifically first.
This change is