1
Fork 0

more comments

This commit is contained in:
Ariel Ben-Yehuda 2017-12-06 00:51:47 +02:00
parent 37df5e0b91
commit 66c032cb2d
3 changed files with 13 additions and 8 deletions

View file

@ -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> pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
where F: FnOnce(&mut T) -> &mut U where F: FnOnce(&mut T) -> &mut U
{ {
// FIXME: fix borrow-check // FIXME(nll-rfc#40): fix borrow-check
let RefMut { value, borrow } = orig; let RefMut { value, borrow } = orig;
RefMut { RefMut {
value: f(value), value: f(value),

View file

@ -1776,7 +1776,7 @@ impl<I: Iterator> Iterator for Peekable<I> {
#[inline] #[inline]
fn nth(&mut self, n: usize) -> Option<I::Item> { 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 { if n == 0 {
match self.peeked.take() { match self.peeked.take() {
Some(v) => v, Some(v) => v,

View file

@ -236,7 +236,11 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
move_data: &'cx MoveData<'tcx>, move_data: &'cx MoveData<'tcx>,
param_env: ParamEnv<'gcx>, param_env: ParamEnv<'gcx>,
/// This keeps track of whether local variables are free-ed when the function /// 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, locals_are_invalidated_at_exit: bool,
/// This field keeps track of when storage dead or drop errors are reported /// 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 /// in order to stop duplicate error reporting and identify the conditions required
@ -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 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. // 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 { let (might_be_alive, will_be_dropped, local) = match root_place {
Place::Static(statik) => { Place::Static(statik) => {
// Thread-locals might be dropped after the function exits, but // Thread-locals might be dropped after the function exits, but
@ -1523,9 +1527,10 @@ enum Overlap {
/// if `u` is a union, we have no way of telling how disjoint /// if `u` is a union, we have no way of telling how disjoint
/// `u.a.x` and `a.b.y` are. /// `u.a.x` and `a.b.y` are.
Arbitrary, Arbitrary,
/// The places are either completely disjoint or equal - this /// The places have the same type, and are either completely disjoint
/// is the "base case" on which we recur for extensions of /// or equal - i.e. they can't "partially" overlap as can occur with
/// the place. /// unions. This is the "base case" on which we recur for extensions
/// of the place.
EqualOrDisjoint, EqualOrDisjoint,
/// The places are disjoint, so we know all extensions of them /// The places are disjoint, so we know all extensions of them
/// will also be disjoint. /// will also be disjoint.
@ -1688,7 +1693,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
Place::Projection(interior) => { Place::Projection(interior) => {
place = &interior.base; place = &interior.base;
} }
_ => { Place::Local(_) | Place::Static(_) => {
result.reverse(); result.reverse();
return result; return result;
} }