Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReplace Rc<RefCell<Request>> with Rc<Request> #9172
Conversation
|
@bors-servo: r+ |
|
|
|
|
||
| let req = request.borrow(); | ||
| let url = req.url_list.last().unwrap(); | ||
| let url = request.current_url().clone(); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nikkisquared
Jan 6, 2016
Author
Contributor
that was an oversight on my part, I've fixed it locally now!
This comment has been minimized.
This comment has been minimized.
KiChjang
Jan 6, 2016
Member
There are other places where current_url() is followed by a clone(). Make sure you fix those as well.
358d6ca
to
15249fa
| let referer; | ||
| { | ||
| referer = http_request.referer.clone(); | ||
| } |
This comment has been minimized.
This comment has been minimized.
KiChjang
Jan 6, 2016
Member
Why is this here? Isn't it just enough to do let referer = http_request.referer.clone()?
This comment has been minimized.
This comment has been minimized.
nikkisquared
Jan 7, 2016
Author
Contributor
That's weird, I swear I ran into this and fixed it. Must've been a similar legacy handling from elsewhere. I've updated it now- no clone is needed at all! Cloning was just to get around pointer lifetimes.
7673332
to
ee6b8bf
|
@bors-servo r+ |
|
|
| request.clone() | ||
| } else { | ||
| Rc::new(RefCell::new(request.borrow().clone())) | ||
| request.clone() |
This comment has been minimized.
This comment has been minimized.
KiChjang
Jan 7, 2016
Member
Wait, sorry, this conditional check isn't even needed at all if both branches result in request.clone().
This comment has been minimized.
This comment has been minimized.
KiChjang
Jan 7, 2016
Member
According to the spec, this really should be a copy of request. So Rc::try_unwrap(request).ok().clone() would be the way here.
This comment has been minimized.
This comment has been minimized.
nikkisquared
Jan 7, 2016
Author
Contributor
guh, I thought I got that one before, too! I've reworked that whole bit, the spec requires the if statement which I added a todo about
ee6b8bf
to
ca94d77
| credentials_flag: bool, | ||
| authentication_fetch_flag: bool) -> Response { | ||
|
|
||
| // Step 1 | ||
| // should this ever not be done? | ||
| let http_request = request.clone() |
This comment has been minimized.
This comment has been minimized.
KiChjang
Jan 7, 2016
Member
After reading the spec, what you had before made sense, but not on the else branch. It should have been something like Rc::new(Rc::try_unwrap(request).ok().clone()) instead.
Also, missing semicolon.
|
@bors-servo delegate+ |
|
|
ca94d77
to
afa8762
|
@bors-servo: r+ |
|
|
Replace Rc<RefCell<Request>> with Rc<Request> To make using Request easier, I've changed it from an Rc<RefCell<T>> to just Rc<T>, and updated individual fields to RefCell<T> or Cell<T> as needed. Git seems to be telling me there's a conflict with request.rs, which I resolved locally, but I'm not sure what to do (if anything) to make it easier to merge. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9172) <!-- Reviewable:end -->
|
@bors-servo: r+ |
|
|
e09e3db
to
67f4df5
|
@bors-servo: r+ |
|
|
Replace Rc<RefCell<Request>> with Rc<Request> To make using Request easier, I've changed it from an `Rc<RefCell<T>>` to just `Rc<T>`, and updated individual fields to `RefCell<T>` or `Cell<T>` as needed. Git seems to be telling me there's a conflict with request.rs, which I resolved locally, but I'm not sure what to do (if anything) to make it easier to merge. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9172) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Replace Rc<RefCell<Request>> with Rc<Request> To make using Request easier, I've changed it from an `Rc<RefCell<T>>` to just `Rc<T>`, and updated individual fields to `RefCell<T>` or `Cell<T>` as needed. Git seems to be telling me there's a conflict with request.rs, which I resolved locally, but I'm not sure what to do (if anything) to make it easier to merge. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9172) <!-- Reviewable:end -->
|
|
Replace Rc<RefCell<Response>> with Rc<Response> Similar to why I'm doing #9172, I'm changing `Rc<RefCell<Response>>` into `Rc<Response>` and wrapping fields in `RefCell<T>` as needed. So far I've only needed to change `url_list`, but I'm sure I'll need to update more fields in the future. There's two lines that don't compile that I'm not going to bother trying to fix until #9172 is approved, because getting them to work now will just require more changes after merging with the changes #9172 makes to them. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9195) <!-- Reviewable:end -->
nikkisquared commentedJan 6, 2016
To make using Request easier, I've changed it from an
Rc<RefCell<T>>to justRc<T>, and updated individual fields toRefCell<T>orCell<T>as needed. Git seems to be telling me there's a conflict with request.rs, which I resolved locally, but I'm not sure what to do (if anything) to make it easier to merge.