simplify constant value pair field access
This commit is contained in:
parent
b5ace9a906
commit
c0fc6a8b6b
1 changed files with 1 additions and 6 deletions
|
@ -183,12 +183,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
|
|||
trace!("layout computed");
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
let field_index = field.index();
|
||||
let val = if field_index == 0 {
|
||||
a
|
||||
} else {
|
||||
assert_eq!(field_index, 1);
|
||||
b
|
||||
};
|
||||
let val = [a, b][field_index];
|
||||
let field = base_layout.field(&*self, field_index).ok()?;
|
||||
trace!("projection resulted in: {:?}", val);
|
||||
Some((Value::ByVal(val), field.ty, span))
|
||||
|
|
Loading…
Reference in a new issue