Skip to content

Commit 45a5834

Browse files
jroeschJared Roesch
authored andcommitted
---
yaml --- r: 224250 b: refs/heads/beta c: d782e35 h: refs/heads/master v: v3
1 parent 5f02029 commit 45a5834

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 49eb2c6763e68ee462b5808ab558b4fa9f84fcc0
26+
refs/heads/beta: d782e35c30a9642afe4ea28614efc08025694b1b
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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)