Small fixes to code comments.

This commit is contained in:
Sergio Benitez 2018-06-24 07:43:31 -07:00
parent 87a466211b
commit 3413129296
2 changed files with 6 additions and 5 deletions

View File

@ -27,9 +27,10 @@ impl Parser {
// Our `Parser` is self-referential. We cast a pointer to the heap
// allocation as `&'static` to allow the storage of the reference
// along-side the allocation. This is safe as long as `buffer` is never
// dropped while `self` lives and an instance or reference to `cursor`
// is never allowed to escape. Both of these properties can be
// confirmed with a cursor look over the method signatures of `Parser`.
// dropped while `self` lives, `buffer` is never mutated, and an
// instance or reference to `cursor` is never allowed to escape. These
// properties can be confirmed with a cursory look over the method
// signatures and implementations of `Parser`.
let cursor = unsafe {
let buffer: &'static TokenBuffer = ::std::mem::transmute(&*buffer);
buffer.begin()

View File

@ -91,10 +91,10 @@ pub struct LocalRequest<'c> {
// `Send` nor `Sync`. The second is more difficult to argue. First, observe
// that any methods of `LocalRequest` that _remove_ values from `Request`
// only remove _Copy_ values, in particular, `SocketAddr`. Second, the
// lifetime of the `Request` object is tied tot he lifetime of the
// lifetime of the `Request` object is tied to the lifetime of the
// `LocalResponse`, so references from `Request` cannot be dangling in
// `Response`. And finally, observe how all of the data stored in `Request`
// is convered into its owned counterpart before insertion, ensuring stable
// is converted into its owned counterpart before insertion, ensuring stable
// addresses. Together, these properties guarantee the second condition.
request: Rc<Request<'c>>,
data: Vec<u8>