generic shuffle continues

This commit is contained in:
dylan_DPC 2018-07-13 16:40:24 +05:30
parent d25231f84a
commit 4b5f0ba8c2
2 changed files with 10 additions and 10 deletions

View file

@ -34,10 +34,10 @@ use super::TypeChecker;
///
/// NB. This computation requires normalization; therefore, it must be
/// performed before
pub(super) fn generate<'gcx, 'tcx, V: LiveVariableMap>(
pub(super) fn generate<'gcx, 'tcx>(
cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
mir: &Mir<'tcx>,
liveness: &LivenessResults<V>,
liveness: &LivenessResults<Local>,
flow_inits: &mut FlowAtLocation<MaybeInitializedPlaces<'_, 'gcx, 'tcx>>,
move_data: &MoveData<'tcx>,
) {
@ -55,7 +55,7 @@ pub(super) fn generate<'gcx, 'tcx, V: LiveVariableMap>(
}
}
struct TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx, V: LiveVariableMap>
struct TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx>
where
'typeck: 'gen,
'flow: 'gen,
@ -65,7 +65,7 @@ where
{
cx: &'gen mut TypeChecker<'typeck, 'gcx, 'tcx>,
mir: &'gen Mir<'tcx>,
liveness: &'gen LivenessResults<V>,
liveness: &'gen LivenessResults<Local>,
flow_inits: &'gen mut FlowAtLocation<MaybeInitializedPlaces<'flow, 'gcx, 'tcx>>,
move_data: &'gen MoveData<'tcx>,
drop_data: FxHashMap<Ty<'tcx>, DropData<'tcx>>,

View file

@ -103,18 +103,18 @@ pub struct LivenessMode {
}
/// A combination of liveness results, used in NLL.
pub struct LivenessResults<V: LiveVariableMap> {
pub struct LivenessResults<V> {
/// Liveness results where a regular use makes a variable X live,
/// but not a drop.
pub regular: LivenessResult<V::LiveVar>,
pub regular: LivenessResult<V>,
/// Liveness results where a drop makes a variable X live,
/// but not a regular use.
pub drop: LivenessResult<V::LiveVar>,
pub drop: LivenessResult<V>,
}
impl<V: LiveVariableMap> LivenessResults<V> {
pub fn compute<'tcx>(mir: &Mir<'tcx>, map: &dyn LiveVariableMap<LiveVar = V>) -> LivenessResults<V::LiveVar> {
impl<V, M: LiveVariableMap<LiveVar = V>> LivenessResults<V> {
pub fn compute<'tcx>(mir: &Mir<'tcx>, map: &M) -> LivenessResults<V> {
LivenessResults {
regular: liveness_of_locals(
&mir,
@ -138,7 +138,7 @@ impl<V: LiveVariableMap> LivenessResults<V> {
/// Compute which local variables are live within the given function
/// `mir`. The liveness mode `mode` determines what sorts of uses are
/// considered to make a variable live (e.g., do drops count?).
pub fn liveness_of_locals<'tcx, V: LiveVariableMap>(mir: &Mir<'tcx>, mode: LivenessMode) -> LivenessResult<V::LiveVar> {
pub fn liveness_of_locals<'tcx, V>(mir: &Mir<'tcx>, mode: LivenessMode) -> LivenessResult<V> {
let locals = mir.local_decls.len();
let def_use: IndexVec<_, _> = mir.basic_blocks()
.iter()