Skip to content

Commit 01987d9

Browse files
jroeschJared Roesch
authored andcommitted
---
yaml --- r: 235833 b: refs/heads/stable c: d782e35 h: refs/heads/master i: 235831: e442262 v: v3
1 parent 7e3ed45 commit 01987d9

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 49eb2c6763e68ee462b5808ab558b4fa9f84fcc0
32+
refs/heads/stable: d782e35c30a9642afe4ea28614efc08025694b1b
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/middle/infer/type_variable.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ pub struct Snapshot {
4747
snapshot: sv::Snapshot
4848
}
4949

50-
enum UndoEntry {
50+
enum UndoEntry<'tcx> {
5151
// The type of the var was specified.
52-
SpecifyVar(ty::TyVid, Vec<Relation>),
52+
SpecifyVar(ty::TyVid, Vec<Relation>, Option<Default<'tcx>>),
5353
Relate(ty::TyVid, ty::TyVid),
5454
}
5555

@@ -118,8 +118,8 @@ impl<'tcx> TypeVariableTable<'tcx> {
118118
mem::replace(value_ptr, Known(ty))
119119
};
120120

121-
let relations = match old_value {
122-
Bounded { relations, .. } => relations,
121+
let (relations, default) = match old_value {
122+
Bounded { relations, default } => (relations, default),
123123
Known(_) => panic!("Asked to instantiate variable that is \
124124
already instantiated")
125125
};
@@ -128,7 +128,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
128128
stack.push((ty, dir, vid));
129129
}
130130

131-
self.values.record(SpecifyVar(vid, relations));
131+
self.values.record(SpecifyVar(vid, relations, default));
132132
}
133133

134134
pub fn new_var(&mut self,
@@ -198,7 +198,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
198198
debug!("NewElem({}) new_elem_threshold={}", index, new_elem_threshold);
199199
}
200200

201-
sv::UndoLog::Other(SpecifyVar(vid, _)) => {
201+
sv::UndoLog::Other(SpecifyVar(vid, _, _)) => {
202202
if vid.index < new_elem_threshold {
203203
// quick check to see if this variable was
204204
// created since the snapshot started or not.
@@ -229,12 +229,15 @@ impl<'tcx> TypeVariableTable<'tcx> {
229229

230230
impl<'tcx> sv::SnapshotVecDelegate for Delegate<'tcx> {
231231
type Value = TypeVariableData<'tcx>;
232-
type Undo = UndoEntry;
232+
type Undo = UndoEntry<'tcx>;
233233

234-
fn reverse(values: &mut Vec<TypeVariableData<'tcx>>, action: UndoEntry) {
234+
fn reverse(values: &mut Vec<TypeVariableData<'tcx>>, action: UndoEntry<'tcx>) {
235235
match action {
236-
SpecifyVar(vid, relations) => {
237-
values[vid.index as usize].value = Bounded { relations: relations, default: None };
236+
SpecifyVar(vid, relations, default) => {
237+
values[vid.index as usize].value = Bounded {
238+
relations: relations,
239+
default: default
240+
};
238241
}
239242

240243
Relate(a, b) => {

0 commit comments

Comments
 (0)