Skip to content

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arielb1 committed Dec 5, 2017
1 parent 37df5e0 commit 66c032c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/libcore/cell.rs
Expand Up @@ -1084,7 +1084,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
where F: FnOnce(&mut T) -> &mut U
{
// FIXME: fix borrow-check
// FIXME(nll-rfc#40): fix borrow-check
let RefMut { value, borrow } = orig;
RefMut {
value: f(value),
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Expand Up @@ -1776,7 +1776,7 @@ impl<I: Iterator> Iterator for Peekable<I> {

#[inline]
fn nth(&mut self, n: usize) -> Option<I::Item> {
// FIXME: merge these when borrow-checking gets better.
// FIXME(#6393): merge these when borrow-checking gets better.
if n == 0 {
match self.peeked.take() {
Some(v) => v,
Expand Down
17 changes: 11 additions & 6 deletions src/librustc_mir/borrow_check/mod.rs
Expand Up @@ -236,7 +236,11 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
move_data: &'cx MoveData<'tcx>,
param_env: ParamEnv<'gcx>,
/// This keeps track of whether local variables are free-ed when the function
/// exits even without a `StorageDead`.
/// exits even without a `StorageDead`, which appears to be the case for
/// constants.
///
/// I'm not sure this is the right approach - @eddyb could you try and
/// figure this out?
locals_are_invalidated_at_exit: bool,
/// This field keeps track of when storage dead or drop errors are reported
/// in order to stop duplicate error reporting and identify the conditions required
Expand Down Expand Up @@ -973,7 +977,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
// we just know that all locals are dropped at function exit (otherwise
// we'll have a memory leak) and assume that all statics have a destructor.
//
// FIXME: allow thread-locals to borrow other thread locals?x
// FIXME: allow thread-locals to borrow other thread locals?
let (might_be_alive, will_be_dropped, local) = match root_place {
Place::Static(statik) => {
// Thread-locals might be dropped after the function exits, but
Expand Down Expand Up @@ -1523,9 +1527,10 @@ enum Overlap {
/// if `u` is a union, we have no way of telling how disjoint
/// `u.a.x` and `a.b.y` are.
Arbitrary,
/// The places are either completely disjoint or equal - this
/// is the "base case" on which we recur for extensions of
/// the place.
/// The places have the same type, and are either completely disjoint
/// or equal - i.e. they can't "partially" overlap as can occur with
/// unions. This is the "base case" on which we recur for extensions
/// of the place.
EqualOrDisjoint,
/// The places are disjoint, so we know all extensions of them
/// will also be disjoint.
Expand Down Expand Up @@ -1688,7 +1693,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
Place::Projection(interior) => {
place = &interior.base;
}
_ => {
Place::Local(_) | Place::Static(_) => {
result.reverse();
return result;
}
Expand Down

0 comments on commit 66c032c

Please sign in to comment.