-
Notifications
You must be signed in to change notification settings - Fork 222
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
Convert BufferQueue to use Interior Mutability #542
Convert BufferQueue to use Interior Mutability #542
Conversation
Signed-off-by: Taym <[email protected]>
Signed-off-by: Taym <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes make sense for BufferQueue's internals, but we should also be able to update the usages of &mut BufferQueue
in the rest of the library. We can then verify that the panic from the testcase in servo/servo#32454 (comment) should not occur.
I tried to do that but
and it is neeed 2 places:
|
Sorry, I missed your last comment when you wrote it. What's the code that actually uses BufferQueue as an iterator? |
Ah, I see:
|
Sorry 🙏 , I am not getting notification from this repo, yes the code you shared! any ideas? |
I suspect we'll need to use my idea of accepting an argument that can obtain a mutable reference on demand. We might want to try an enum that is either &mut or RefCell and add a method like: |
Actually, I think the easiest solution is to extract the |
Signed-off-by: Taym <[email protected]>
@@ -336,15 +336,17 @@ impl<Sink: TokenSink> Tokenizer<Sink> { | |||
match input.eat(pat, eq) { | |||
None if self.at_eof => Some(false), | |||
None => { | |||
self.temp_buf.extend(input); | |||
while let Some(data) = input.next() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdm I extracted next()
and and reimplemented extend
d1ca0bb
to
d86b273
Compare
Thanks! I'll pull the latest change into my branch and run tests with it. |
Signed-off-by: Taym <[email protected]>
d86b273
to
c110578
Compare
Signed-off-by: Taym <[email protected]>
Verified that these changes are correct via #548 and servo/servo#32820, so let's merge this. |
Part of servo/servo#32454
from @jdm comment