mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
use {} for Known variant just for more parity
This commit is contained in:
committed by
Sean Griffin
parent
d4df52cacb
commit
d516b263c6
@@ -79,7 +79,9 @@ struct TypeVariableData<'tcx> {
|
||||
}
|
||||
|
||||
enum TypeVariableValue<'tcx> {
|
||||
Known(Ty<'tcx>),
|
||||
Known {
|
||||
value: Ty<'tcx>
|
||||
},
|
||||
Bounded {
|
||||
default: Option<Default<'tcx>>
|
||||
}
|
||||
@@ -120,7 +122,7 @@ pub fn new() -> TypeVariableTable<'tcx> {
|
||||
|
||||
pub fn default(&self, vid: ty::TyVid) -> Option<Default<'tcx>> {
|
||||
match &self.values.get(vid.index as usize).value {
|
||||
&Known(_) => None,
|
||||
&Known { .. } => None,
|
||||
&Bounded { ref default, .. } => default.clone()
|
||||
}
|
||||
}
|
||||
@@ -161,14 +163,14 @@ pub fn instantiate(&mut self, vid: ty::TyVid, ty: Ty<'tcx>) {
|
||||
|
||||
let old_value = {
|
||||
let vid_data = &mut self.values[vid.index as usize];
|
||||
mem::replace(&mut vid_data.value, TypeVariableValue::Known(ty))
|
||||
mem::replace(&mut vid_data.value, TypeVariableValue::Known { value: ty })
|
||||
};
|
||||
|
||||
match old_value {
|
||||
TypeVariableValue::Bounded { default } => {
|
||||
self.values.record(Instantiate { vid: vid, default: default });
|
||||
}
|
||||
TypeVariableValue::Known(old_ty) => {
|
||||
TypeVariableValue::Known { value: old_ty } => {
|
||||
bug!("instantiating type variable `{:?}` twice: new-value = {:?}, old-value={:?}",
|
||||
vid, ty, old_ty)
|
||||
}
|
||||
@@ -236,7 +238,7 @@ pub fn probe_root(&mut self, vid: ty::TyVid) -> Option<Ty<'tcx>> {
|
||||
debug_assert!(self.root_var(vid) == vid);
|
||||
match self.values.get(vid.index as usize).value {
|
||||
Bounded { .. } => None,
|
||||
Known(t) => Some(t)
|
||||
Known { value } => Some(value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +339,7 @@ pub fn types_escaping_snapshot(&mut self, s: &Snapshot) -> Vec<Ty<'tcx>> {
|
||||
// created since the snapshot started or not.
|
||||
let escaping_type = match self.values.get(vid.index as usize).value {
|
||||
Bounded { .. } => bug!(),
|
||||
Known(ty) => ty,
|
||||
Known { value } => value,
|
||||
};
|
||||
escaping_types.push(escaping_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user