+impl Lvalue {
+ pub fn new(source: &'static str) -> Lvalue {
+ Lvalue { source: source, drop_flag_info: DropFlagInfo::None }
+ }
+
+ pub fn upvar<'blk, 'tcx>(source: &'static str,
+ bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId) -> Lvalue {
+ let info = if Lvalue::has_dropflag_hint(bcx, id) {
+ DropFlagInfo::ZeroAndMaintain(id)
+ } else {
+ DropFlagInfo::None
+ };
+ let info = if bcx.tcx().sess.nonzeroing_move_hints() { info } else { DropFlagInfo::None };
+ debug!("upvar Lvalue at {}, id: {} info: {:?}", source, id, info);
+ Lvalue { source: source, drop_flag_info: info }
+ }
+
+ pub fn match_input<'blk, 'tcx>(source: &'static str,
+ bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId) -> Lvalue
+ {
+ let info = if Lvalue::has_dropflag_hint(bcx, id) {
+ // match_input is used to move from the input into a
+ // separate stack slot; it must zero (at least until we
+ // improve things to track drop flags for the fragmented
+ // parent match input expression).
+ DropFlagInfo::ZeroAndMaintain(id)
+ } else {
+ DropFlagInfo::None
+ };
+ let info = if bcx.tcx().sess.nonzeroing_move_hints() { info } else { DropFlagInfo::None };
+ debug!("match_input Lvalue at {}, id: {} info: {:?}", source, id, info);
+ Lvalue { source: source, drop_flag_info: info }
+ }
+
+ pub fn local<'blk, 'tcx>(source: &'static str,
+ bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId,
+ aliases_other_state: bool)
+ -> Lvalue
+ {
+ let info = if Lvalue::has_dropflag_hint(bcx, id) {
+ if aliases_other_state {
+ DropFlagInfo::ZeroAndMaintain(id)
+ } else {
+ DropFlagInfo::DontZeroJustUse(id)
+ }
+ } else {
+ DropFlagInfo::None
+ };
+ let info = if bcx.tcx().sess.nonzeroing_move_hints() { info } else { DropFlagInfo::None };
+ debug!("local Lvalue at {}, id: {} info: {:?}", source, id, info);
+ Lvalue { source: source, drop_flag_info: info }
+ }
+
+ pub fn store_arg<'blk, 'tcx>(source: &'static str,
+ bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId) -> Lvalue
+ {
+ let info = if Lvalue::has_dropflag_hint(bcx, id) {
+ DropFlagInfo::ZeroAndMaintain(id)
+ } else {
+ DropFlagInfo::None
+ };
+ let info = if bcx.tcx().sess.nonzeroing_move_hints() { info } else { DropFlagInfo::None };
+ debug!("store_arg Lvalue at {}, id: {} info: {:?}", source, id, info);
+ Lvalue { source: source, drop_flag_info: info }
+ }
+
+ pub fn binding<'blk, 'tcx>(source: &'static str,
+ bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId,
+ name: ast::Name) -> Lvalue {
+ let info = if Lvalue::has_dropflag_hint(bcx, id) {
+ DropFlagInfo::DontZeroJustUse(id)
+ } else {
+ DropFlagInfo::None
+ };
+ let info = if bcx.tcx().sess.nonzeroing_move_hints() { info } else { DropFlagInfo::None };
+ debug!("binding Lvalue at {}, id: {} name: {} info: {:?}",
+ source, id, name, info);
+ Lvalue { source: source, drop_flag_info: info }
+ }
+
+ fn has_dropflag_hint<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
+ id: ast::NodeId) -> bool {
+ bcx.fcx.lldropflag_hints.borrow().has_hint(id)
+ }
+}
+